Skip to content

Commit

Permalink
Add life cycle metadata to container insights dev images (#1241)
Browse files Browse the repository at this point in the history
* Add life cycle metadata to container image

* only add dev annotations for dev images
  • Loading branch information
wanlonghenry authored Jun 5, 2024
1 parent 383547a commit cddc0d3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .pipelines/azure_pipeline_mergedbranches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ variables:
repoImageName: '${{ variables.containerRegistry }}.azurecr.io/public/azuremonitor/containerinsights/cidev'
IS_PR: $[eq(variables['Build.Reason'], 'PullRequest')]
IS_MAIN_BRANCH: $[eq(variables['Build.SourceBranchName'], 'ci_prod')]
IS_RELEASE: $[ne(variables['TELEMETRY_TAG'], '')]

jobs:
- job: common
Expand Down Expand Up @@ -238,6 +239,15 @@ jobs:
displayName: "ORAS Push Artifacts in $(Build.ArtifactStagingDirectory)/linux/"
condition: eq(variables.IS_PR, false)
- bash: |
set -euxo pipefail
oras attach ${{ variables.repoImageName }}:$(linuxImagetag) \
--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: eq(variables.IS_RELEASE, false)
- task: AzureCLI@2
displayName: "Vulnerability Scan with Trivy"
inputs:
Expand Down Expand Up @@ -837,6 +847,13 @@ jobs:
displayName: "Run oras attach"
condition: eq(variables.IS_PR, false)
- powershell: |
$env:PATH = "$env:USERPROFILE\bin;$env:PATH"
oras attach ${{ variables.repoImageName }}:$(windowsImageTag) --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: "Run oras attach"
condition: eq(variables.IS_RELEASE, false)
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
Expand Down

0 comments on commit cddc0d3

Please sign in to comment.