Skip to content

chore(vhdbuilder): add COSI conversion for ACL VHD images#8532

Closed
bfjelds wants to merge 2 commits into
mainfrom
user/bfjelds/acl-cosi-generation
Closed

chore(vhdbuilder): add COSI conversion for ACL VHD images#8532
bfjelds wants to merge 2 commits into
mainfrom
user/bfjelds/acl-cosi-generation

Conversation

@bfjelds
Copy link
Copy Markdown
Member

@bfjelds bfjelds commented May 18, 2026

What this PR does / why we need it:

Add a post-build pipeline step that converts AzureContainerLinux (ACL) VHD images to COSI format using ImageCustomizer's convert command (v1.2.0-2). Export ACL COSI image, used for A/B updates.

Changes:

  • New script: convert-vhd-to-cosi.sh downloads ACL VHD from blob storage, runs ImageCustomizer convert (VHD -> COSI), and uploads the COSI file
  • New make target: convert-vhd-to-cosi in packer.mk
  • Pipeline vars: set IMG_CUSTOMIZER_CONTAINER and IMG_CUSTOMIZER_VERSION on ACL build jobs in both PR and release pipelines
  • Builder template: add Convert ACL VHD to COSI step after SIG->classic conversion, conditioned on OS_SKU=AzureContainerLinux
  • Immutable copy: updated to also copy/remove .cosi files for ACL builds

Which issue(s) this PR fixes:

Fixes #

Add a post-build pipeline step that converts AzureContainerLinux (ACL) VHD
images to COSI format using ImageCustomizer's convert command (v1.2.0-2).

Changes:
- New script: convert-vhd-to-cosi.sh downloads ACL VHD from blob storage,
  runs ImageCustomizer convert (VHD -> COSI), and uploads the COSI file
- New make target: convert-vhd-to-cosi in packer.mk
- Pipeline vars: set IMG_CUSTOMIZER_CONTAINER and IMG_CUSTOMIZER_VERSION
  on ACL build jobs in both PR and release pipelines
- Builder template: add Convert ACL VHD to COSI step after SIG->classic
  conversion, conditioned on OS_SKU=AzureContainerLinux
- Immutable copy: updated to also copy/remove .cosi files for ACL builds

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Brian Fjeldstad <bfjelds@microsoft.com>
Copilot AI review requested due to automatic review settings May 18, 2026 19:44
@bfjelds bfjelds changed the title chore(vhdbuilder): add COSI conversion for ACL VHD images [WIP] chore(vhdbuilder): add COSI conversion for ACL VHD images May 18, 2026
@bfjelds bfjelds changed the title [WIP] chore(vhdbuilder): add COSI conversion for ACL VHD images chore(vhdbuilder): add COSI conversion for ACL VHD images May 18, 2026
echo "Successfully copied VHD to immutable container"
if [ "${OS_SKU}" = "AzureContainerLinux" ]; then
echo "Copying ${DESTINATION_STORAGE_CONTAINER}/${CAPTURED_SIG_VERSION}.cosi to immutable storage container"
az storage blob copy start --account-name "$STORAGE_ACCOUNT_NAME" --destination-blob "${CAPTURED_SIG_VERSION}.cosi" --destination-container "$VHD_CONTAINER_NAME" --source-uri "${DESTINATION_STORAGE_CONTAINER}/${CAPTURED_SIG_VERSION}.cosi" --auth-mode login || exit 1
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find correct place to upload

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a post-build pipeline stage that converts AzureContainerLinux (ACL) VHD images to COSI format using the imagecustomizer convert tool, and propagates the new .cosi artifact through the immutable-blob copy step.

Changes:

  • New script convert-vhd-to-cosi.sh + convert-vhd-to-cosi make target that downloads the ACL VHD, runs imagecustomizer convert in a container, and uploads the resulting .cosi back to blob storage.
  • New pipeline step in .builder-release-template.yaml (conditioned on OS_SKU=AzureContainerLinux) and extension to the immutable-copy step that also copies/removes .cosi files.
  • ACL build jobs in both PR and release pipelines now set SIG_SOURCE_* and IMG_CUSTOMIZER_CONTAINER/IMG_CUSTOMIZER_VERSION (mcr.microsoft.com/azurelinux/imagecustomizer:1.2.0-2).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vhdbuilder/packer/imagecustomizer/scripts/convert-vhd-to-cosi.sh New script: pulls ACL VHD, runs ImageCustomizer convert to COSI, uploads result.
packer.mk Adds convert-vhd-to-cosi make target wrapping the new script.
.pipelines/templates/.builder-release-template.yaml Adds ACL-only Convert-to-COSI step; extends immutable copy step to also copy/remove the .cosi blob.
.pipelines/.vsts-vhd-builder.yaml Sets ACL SIG source variables and ImageCustomizer container/version for amd64 + arm64 PR jobs.
.pipelines/.vsts-vhd-builder-release.yaml Same variable additions for the release pipeline.

…ntainer

Match adamsanaglo's proof-of-concept upload destination:
- Upload to AFD_UPLOAD_ENDPOINT/COSI_CONTAINER/{config}-{version}.cosi
- Use IMG_CUSTOMIZER_CONFIG for blob name prefix (cosi-acl)
- Remove COSI copy-to-immutable logic (no longer in staging container)
- Pass AFD_UPLOAD_ENDPOINT, COSI_CONTAINER, IMG_CUSTOMIZER_CONFIG env vars

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Brian Fjeldstad <bfjelds@microsoft.com>
exit $azExitCode
fi

echo "Successfully converted and uploaded COSI: ${AFD_UPLOAD_ENDPOINT}/${COSI_CONTAINER}/${COSI_BLOB_NAME}"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to register with nebraska

@@ -0,0 +1,104 @@
#!/bin/bash
set -euo pipefail
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echo '##vso[task.setvariable variable=ARCHITECTURE]X86_64'
echo '##vso[task.setvariable variable=ENABLE_FIPS]True'
echo '##vso[task.setvariable variable=ENABLE_TRUSTED_LAUNCH]True'
echo '##vso[task.setvariable variable=ENABLE_CGROUPV2]True'
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add vars here?

echo '##vso[task.setvariable variable=ENABLE_FIPS]True'
echo '##vso[task.setvariable variable=ENABLE_TRUSTED_LAUNCH]True'
echo '##vso[task.setvariable variable=ENABLE_CGROUPV2]True'
displayName: Setup Build Variables
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add vars here?

echo '##vso[task.setvariable variable=ENABLE_FIPS]True'
echo '##vso[task.setvariable variable=ENABLE_TRUSTED_LAUNCH]True'
echo '##vso[task.setvariable variable=ENABLE_CGROUPV2]True'
displayName: Setup Build Variables
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set vars here?

echo '##vso[task.setvariable variable=ENABLE_FIPS]True'
echo '##vso[task.setvariable variable=ENABLE_TRUSTED_LAUNCH]True'
echo '##vso[task.setvariable variable=ENABLE_CGROUPV2]True'
displayName: Setup Build Variables
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set vars here?

@bfjelds bfjelds closed this May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants