Skip to content

Commit

Permalink
Add life cycle metadata to container image (#842)
Browse files Browse the repository at this point in the history
This change adds life cycle metadata to the container image.

Followed this document:
https://eng.ms/docs/more/containers-secure-supply-chain/lifecycle-and-lineage

This adds metadata end-of-life annotation at the image build time so
that it does not get flagged later in downstream.
  • Loading branch information
Sohamdg081992 authored Apr 23, 2024
1 parent 03603eb commit 79c6c76
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .pipelines/azure-pipeline-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ stages:
--artifact-type 'application/vnd.cncf.notary.signature' \
./payload.json:application/cose \
-a "io.cncf.notary.x509chain.thumbprint#S256=[\"79E6A702361E1F60DAA84AEEC4CBF6F6420DE6BA\"]"
oras attach $(LINUX_FULL_IMAGE_NAME) \
--artifact-type 'application/vnd.microsoft.artifact.lifecycle' \
--annotation "vnd.microsoft.artifact.lifecycle.end-of-life.date=$(date -u -d '-1 hour' +"%Y-%m-%dT%H:%M:%SZ")"
workingDirectory: $(Build.ArtifactStagingDirectory)/linux/
displayName: "ORAS Push Artifacts in $(Build.ArtifactStagingDirectory)/linux/"
condition: and(succeeded(), eq(variables.IS_MAIN_BRANCH, true))
Expand Down Expand Up @@ -568,6 +571,9 @@ stages:
--artifact-type 'application/vnd.cncf.notary.signature' \
./payload.json:application/cose \
-a "io.cncf.notary.x509chain.thumbprint#S256=[\"79E6A702361E1F60DAA84AEEC4CBF6F6420DE6BA\"]"
oras attach $(LINUX_CCP_FULL_IMAGE_NAME) \
--artifact-type 'application/vnd.microsoft.artifact.lifecycle' \
--annotation "vnd.microsoft.artifact.lifecycle.end-of-life.date=$(date -u -d '-1 hour' +"%Y-%m-%dT%H:%M:%SZ")"
workingDirectory: $(Build.ArtifactStagingDirectory)/linuxccp/
displayName: "ORAS Push Artifacts in $(Build.ArtifactStagingDirectory)/linuxccp/"
condition: and(succeeded(), eq(variables.IS_MAIN_BRANCH, true))
Expand Down Expand Up @@ -716,6 +722,9 @@ stages:
--artifact-type 'application/vnd.cncf.notary.signature' \
./payload.json:application/cose \
-a "io.cncf.notary.x509chain.thumbprint#S256=[\"79E6A702361E1F60DAA84AEEC4CBF6F6420DE6BA\"]"
oras attach $(TARGET_ALLOCATOR_FULL_IMAGE_NAME) \
--artifact-type 'application/vnd.microsoft.artifact.lifecycle' \
--annotation "vnd.microsoft.artifact.lifecycle.end-of-life.date=$(date -u -d '-1 hour' +"%Y-%m-%dT%H:%M:%SZ")"
workingDirectory: $(Build.ArtifactStagingDirectory)/targetallocator/
displayName: "ORAS Push Artifacts in $(Build.ArtifactStagingDirectory)/targetallocator/"
condition: and(succeeded(), eq(variables.IS_MAIN_BRANCH, true))
Expand Down Expand Up @@ -793,6 +802,9 @@ stages:
--artifact-type 'application/vnd.cncf.notary.signature' \
./payload.json:application/cose \
-a "io.cncf.notary.x509chain.thumbprint#S256=[\"79E6A702361E1F60DAA84AEEC4CBF6F6420DE6BA\"]"
oras attach $(LINUX_CONFIG_READER_FULL_IMAGE_NAME) \
--artifact-type 'application/vnd.microsoft.artifact.lifecycle' \
--annotation "vnd.microsoft.artifact.lifecycle.end-of-life.date=$(date -u -d '-1 hour' +"%Y-%m-%dT%H:%M:%SZ")"
workingDirectory: $(Build.ArtifactStagingDirectory)/linuxcfgreader/
displayName: "ORAS Push Artifacts in $(Build.ArtifactStagingDirectory)/linuxcfgreader/"
condition: and(succeeded(), eq(variables.IS_MAIN_BRANCH, true))
Expand Down Expand Up @@ -1005,6 +1017,9 @@ stages:
Copy-Item -Path $currentDirectory\oras.exe -Destination "$env:USERPROFILE\bin\"
$env:PATH = "$env:USERPROFILE\bin;$env:PATH"
oras attach $(WINDOWS_FULL_IMAGE_NAME) --artifact-type application/vnd.cncf.notary.signature ./payload.json:application/cose -a io.cncf.notary.x509chain.thumbprint#S256=[\""79E6A702361E1F60DAA84AEEC4CBF6F6420DE6BA\""]
oras attach $(WINDOWS_FULL_IMAGE_NAME) \
--artifact-type 'application/vnd.microsoft.artifact.lifecycle' \
--annotation "vnd.microsoft.artifact.lifecycle.end-of-life.date=$(powershell -Command "(Get-Date).AddHours(-1).ToString('yyyy-MM-ddTHH:mm:ssZ')")"
workingDirectory: $(Build.ArtifactStagingDirectory)/windows
displayName: "Download, install Oras and run oras attach"
condition: and(succeeded(), eq(variables.IS_MAIN_BRANCH, true))
Expand Down

0 comments on commit 79c6c76

Please sign in to comment.