Skip to content

Commit 239aa51

Browse files
committed
Merge branch 'main' into 2.0
2 parents 668b0c9 + a746959 commit 239aa51

265 files changed

Lines changed: 4038 additions & 4526 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Feel free to delete sections of the template which do not apply to your PR, or a
1717
- [ ] All source files have up-to-date hashes in the `*.signatures.json` files
1818
- [ ] `sudo make go-tidy-all` and `sudo make go-test-coverage` pass
1919
- [ ] Documentation has been updated to match any changes to the build system
20+
- [ ] If you are adding/removing a .spec file that has multiple-versions supported, please add [@microsoft/cbl-mariner-multi-package-reviewers](https://github.com/orgs/microsoft/teams/cbl-mariner-multi-package-reviewers) team as reviewer [(Eg. golang has 2 versions 1.18, 1.21+)](https://github.com/microsoft/azurelinux/tree/2.0/SPECS/golang)
2021
- [ ] Ready to merge
2122

2223
---

.github/workflows/check-kernel-config.yml

Lines changed: 0 additions & 79 deletions
This file was deleted.

.github/workflows/validate-cg-manifest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ do
227227
# Parsing output instead of using error codes because 'wget' returns code 8 for FTP, even if the file exists.
228228
# Sample HTTP(S) output: Remote file exists.
229229
# Sample FTP output: File ‘time-1.9.tar.gz’ exists.
230-
if ! wget --secure-protocol=TLSv1_2 --spider --timeout=2 --tries=10 "${manifesturl}" 2>&1 | grep -qP "^(Remote file|File ‘.*’) exists.*"
230+
if ! wget --secure-protocol=TLSv1_2 --spider --timeout=30 --tries=10 "${manifesturl}" 2>&1 | grep -qP "^(Remote file|File ‘.*’) exists.*"
231231
then
232232
echo "Registration for $name:$version has invalid URL '$manifesturl' (could not download)" >> bad_registrations.txt
233233
fi

.pipelines/CodeQL/CodeQL.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
name: CodeQL CBL-Mariner repository
55

6+
trigger: none
7+
68
resources:
79
repositories:
810
- repository: CBL-Mariner-Pipelines
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
distroless-packages-base
22
nodejs18
3+
prebuilt-ca-certificates
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
distroless-packages-base
22
prometheus
3+
prebuilt-ca-certificates
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
distroless-packages-base
22
prometheus-adapter
3+
prebuilt-ca-certificates
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
distroless-packages-base
22
python3
3+
prebuilt-ca-certificates

.pipelines/containerSourceData/scripts/BuildBaseContainers.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ set -e
2828
# │ container_tarballs
2929
# │ ├── container_base
3030
# │ │ ├── core-2.0.20230607.tar.gz
31+
# │ ├── core_container_builder
32+
# │ │ ├── core-container-builder-2.0.20230607.tar.gz
3133
# │ ├── distroless_base
3234
# │ │ ├── distroless-base-2.0.20230607.tar.gz
3335
# │ ├── distroless_debug
@@ -100,6 +102,7 @@ function validate_inputs {
100102
fi
101103

102104
BASE_TARBALL=$(find "$CONTAINER_TARBALLS_DIR" -name "core-[0-9.]*.tar.gz")
105+
BASE_BUILDER_TARBALL=$(find "$CONTAINER_TARBALLS_DIR" -name "core-container-builder-[0-9.]*.tar.gz")
103106
DISTROLESS_BASE_TARBALL=$(find "$CONTAINER_TARBALLS_DIR" -name "distroless-base-[0-9.]*.tar.gz")
104107
DISTROLESS_DEBUG_TARBALL=$(find "$CONTAINER_TARBALLS_DIR" -name "distroless-debug-[0-9.]*.tar.gz")
105108
DISTROLESS_MINIMAL_TARBALL=$(find "$CONTAINER_TARBALLS_DIR" -name "distroless-minimal-[0-9.]*.tar.gz")
@@ -162,6 +165,7 @@ function initialization {
162165
EULA_FILE_NAME="EULA-Container.txt"
163166

164167
# Image types
168+
BASE_BUILDER="base-builder"
165169
BASE="base"
166170
DISTROLESS="distroless"
167171
MARINARA="marinara"
@@ -199,8 +203,15 @@ function initialization {
199203
echo "DISTROLESS_DEBUG_IMAGE_NAME -> $DISTROLESS_DEBUG_IMAGE_NAME"
200204
echo "DISTROLESS_DEBUG_NONROOT_IMAGE_NAME -> $DISTROLESS_DEBUG_NONROOT_IMAGE_NAME"
201205
echo "MARINARA_IMAGE_NAME -> $MARINARA_IMAGE_NAME"
206+
207+
ROOT_FOLDER="$(git rev-parse --show-toplevel)"
208+
EULA_FILE_PATH="$ROOT_FOLDER/.pipelines/container_artifacts/data"
202209
}
203210

211+
function build_builder_image {
212+
echo "+++ Build builder image"
213+
docker import - "$BASE_BUILDER" < "$BASE_BUILDER_TARBALL"
214+
}
204215
function docker_build {
205216
local image_type=$1
206217
local image_full_name=$2
@@ -214,8 +225,6 @@ function docker_build {
214225
local build_dir="$WORK_DIR/container_build_dir"
215226
mkdir -p "$build_dir"
216227

217-
ROOT_FOLDER="$(git rev-parse --show-toplevel)"
218-
EULA_FILE_PATH="$ROOT_FOLDER/.pipelines/container_artifacts/data"
219228
if [ -d "$EULA_FILE_PATH" ]; then
220229
cp "$EULA_FILE_PATH/$EULA_FILE_NAME" "$build_dir"/
221230
fi
@@ -272,13 +281,21 @@ function docker_build_marinara {
272281
local build_dir="$WORK_DIR/marinara_build_dir"
273282
mkdir -p "$build_dir"
274283
git clone "https://github.com/microsoft/$MARINARA.git" "$build_dir"
275-
pushd "$build_dir"
276-
sed -E "s|^FROM mcr\..*installer$|FROM $BASE_IMAGE_NAME as installer|g" -i "dockerfile-$MARINARA"
284+
285+
if [ -d "$EULA_FILE_PATH" ]; then
286+
cp "$EULA_FILE_PATH/$EULA_FILE_NAME" "$build_dir"/
287+
fi
288+
289+
pushd "$build_dir" > /dev/null
290+
291+
sed -E "s|^FROM mcr\..*installer$|FROM $BASE_BUILDER as installer|g" -i "dockerfile-$MARINARA"
277292

278293
docker build . \
279294
-t "$MARINARA_IMAGE_NAME" \
280295
-f dockerfile-$MARINARA \
281296
--build-arg AZL_VERSION="$AZL_VERSION" \
297+
--build-arg INSTALL_DEPENDENCIES=false \
298+
--build-arg EULA=$EULA_FILE_NAME \
282299
--no-cache \
283300
--progress=plain
284301

@@ -327,4 +344,5 @@ function build_images {
327344
print_inputs
328345
validate_inputs
329346
initialization
347+
build_builder_image
330348
build_images

.pipelines/containerSourceData/scripts/PublishContainers.sh

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,32 @@ FILE_EXT='.txt'
7575
# TODO: We may need to update this value for Azure Linux 3.0.
7676
OS_VERSION_PREFIX="cbl-mariner-"
7777
DISTRO_IDENTIFIER="cm"
78+
END_OF_LIFE_1_YEAR=$(date -d "+1 year" "+%Y-%m-%dT%H:%M:%SZ")
79+
80+
# Login to the container registry.
81+
# Also login ORAS to the container registry.
82+
# $1: container registry name
83+
function acr_login {
84+
local container_registry=$1
85+
local oras_access_token
86+
87+
echo "+++ az login into Azure ACR $container_registry"
88+
oras_access_token=$(az acr login --name "$container_registry" --expose-token --output tsv --query accessToken)
89+
oras login "$container_registry.azurecr.io" \
90+
--username "00000000-0000-0000-0000-000000000000" \
91+
--password "$oras_access_token"
92+
}
93+
94+
# Attach the end-of-life annotation to the container image.
95+
# $1: image name
96+
function oras_attach {
97+
local image_name=$1
98+
99+
oras attach \
100+
--artifact-type "application/vnd.microsoft.artifact.lifecycle" \
101+
--annotation "vnd.microsoft.artifact.lifecycle.end-of-life.date=$END_OF_LIFE_1_YEAR" \
102+
"$image_name"
103+
}
78104

79105
function create_multi_arch_tags {
80106
# $1: original container (without '-amd64' or '-arm64' extension in tag)
@@ -168,6 +194,7 @@ function create_multi_arch_tags {
168194
echo "+++ push $full_multiarch_tag tag"
169195
docker manifest push "$full_multiarch_tag"
170196
echo "+++ $full_multiarch_tag tag pushed successfully"
197+
oras_attach "$full_multiarch_tag"
171198

172199
# Save the multi-arch tag to a file.
173200
image_basename=${multiarch_name#*/}
@@ -233,22 +260,21 @@ do
233260
echo "Image name: $image_name"
234261
echo
235262
container_registry="${image_name%%.*}"
236-
echo "+++ login into Azure ACR $container_registry"
237-
az acr login --name "$container_registry"
263+
acr_login "$container_registry"
238264

239265
amd64_image=${image_name%-*}-amd64
240266
docker pull "$amd64_image"
267+
oras_attach "$amd64_image"
241268

242269
# Some container images are only built for AMD64 architecture.
243270
if [[ $ARCHITECTURE_TO_BUILD == *"ARM64"* ]]; then
244271
arm64_image=${image_name%-*}-arm64
245272
docker pull "$arm64_image"
273+
oras_attach "$arm64_image"
246274
fi
247275

248276
if [[ $container_registry != "$TARGET_ACR" ]]; then
249-
echo "+++ login into Azure ACR $TARGET_ACR"
250-
az acr login --name "$TARGET_ACR"
251-
277+
acr_login "$TARGET_ACR"
252278
echo "Retagging the images to $TARGET_ACR"
253279
# E.g., If container_registry is azurelinuxdevpreview and TARGET_ACR is azurelinuxpreview, then
254280
# azurelinuxdevpreview.azurecr.io/base/core:2.0 -> azurelinuxpreview.azurecr.io/base/core:2.0
@@ -258,13 +284,15 @@ do
258284
docker image tag "$amd64_image" "$amd64_retagged_image_name"
259285
docker rmi "$amd64_image"
260286
docker image push "$amd64_retagged_image_name"
287+
oras_attach "$amd64_retagged_image_name"
261288

262289
if [[ $ARCHITECTURE_TO_BUILD == *"ARM64"* ]]; then
263290
arm64_retagged_image_name=${arm64_image/"$container_registry"/"$TARGET_ACR"}
264291
echo "Retagged arm64 image: $arm64_retagged_image_name"
265292
docker image tag "$arm64_image" "$arm64_retagged_image_name"
266293
docker rmi "$arm64_image"
267294
docker image push "$arm64_retagged_image_name"
295+
oras_attach "$arm64_retagged_image_name"
268296
fi
269297

270298
image_name=$amd64_retagged_image_name

0 commit comments

Comments
 (0)