Skip to content

Commit

Permalink
Pipeline - Fixing "delete env when PR is closed" (#2245)
Browse files Browse the repository at this point in the history
* Pipeline - Adding acr img clean up

TODO
Fixed #2210

* Adding step to login into Azure

* Updating job name and order of azure login step

* Updating cli command

* Updating cli to get the list of acr images

* Adding ACR name and correct image name to get the list

* removing show-tags from the cmd

* Adding image tag for the list

* removing extra tags for the list

* updating cmd to get the tags

* Filtering out the tags

* Adding order by command for the repo

* Updating the variable name

* Removing limit on the query

* Adding comparison for the active PR and images

* Adding pipeline to run the matrix

* Adding output for the comparison step

* Adding prop as JSON param

* Deleting test image

* Adding image name with tag to delete it

* Updating schedule and adding login steps for Azure

* cleaning weekly check and adding updated checks

* removing the tags limit

* Adding limiting to 250

* Adding deletion step to clean up the image

* Adding comment and reducing noise

* Adding non-pr prefixed tags

* Tags - Wrapping it with quote

* Updating the variable name

* echoing non-pr tags

* merging non-pr tags

* Fixing the variable name

* updating variable name

* Adding prefix condition for non-pr tags

* wrapping text around input values

* Adding additional checks to not delete production and staging acr

* Adding staging and production sha

* removing PRs for temporary

* deleting based on digest value

* Getting digest data for specific ACR

* replacing repository with registery

* manifest for the specific tag

* getting digest value in a different way

* removing test docker image

* Adding github sha to track it

* adding period with the output

* Removing sha tag from the docker img

* Adding prs tags only to delete

* prefixing with dollar sign

* Adding non-prs tags

* Changing the limit of tag list

* Cleaning up the steps for the delete slots

* Removing redundant steps

* wrapping the tags within a quote

* Removing acr login

* Adding condition to stop the second flow

* Removing PR trigger

* Passing JSON to call delete pr flow

* Adding step to remove untagged digests

* Adding PR trigger

* Updating the query to retrieve the manifest

* Adding acr tag

* Updating the props for the list

* adding delete command to delete untagged shas

* Adding yes prop to confirm delete

* removing PR trigger

* Removing testing scripts

* Fixing - Pipeline for the delete PR

TODO

* Adding condition to check the template
  • Loading branch information
amankumarrr committed Mar 5, 2024
1 parent 438aaf8 commit 0f975d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/workflows/pr-close-delete-env.yml
Expand Up @@ -37,6 +37,13 @@ jobs:
id: set-matrix
run: |
$slotIDs = '${{ env.SLOT_NAME }}'
if($slotIDs -notlike '`[*')
{
$array = $slotIDs -split " "
$slotIDs = ConvertTo-Json -Compress @($array)
}
echo "matrix=$slotIDs" >> $env:GITHUB_OUTPUT
delete-slot-and-acr-cleanup:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/template-delete-acr-image.yml
@@ -1,4 +1,4 @@
name: Delete - Docker image from ACR
name: Tempalte - Delete Docker image from ACR

on:
workflow_call:
Expand Down Expand Up @@ -34,6 +34,13 @@ jobs:
id: set-matrix
run: |
$imageTags = '${{ env.IMAGE_TAGS }}'
if($imageTags -notlike '`[*')
{
$array = $imageTags -split " "
$imageTags = ConvertTo-Json -Compress @($array)
}
echo "matrix=$imageTags" >> $env:GITHUB_OUTPUT
delete-acr-image:
Expand Down

0 comments on commit 0f975d5

Please sign in to comment.