delete-public-image.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. name: "Infra: Image Testing: Delete"
  2. on:
  3. workflow_dispatch:
  4. pull_request:
  5. types: ['unlabeled', 'closed']
  6. jobs:
  7. remove:
  8. if: ${{ github.event.label.name == 'status/image_testing' || ( github.event.action == 'closed' && (contains(github.event.pull_request.labels, 'status/image_testing'))) }}
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: get branch name
  12. id: extract_branch
  13. run: |
  14. echo
  15. tag='${{ github.event.pull_request.number }}'
  16. echo "tag=${tag}" >> $GITHUB_OUTPUT
  17. - name: Configure AWS credentials for Kafka-UI account
  18. uses: aws-actions/configure-aws-credentials@v3
  19. with:
  20. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  21. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  22. aws-region: us-east-1
  23. - name: Login to Amazon ECR
  24. id: login-ecr
  25. uses: aws-actions/amazon-ecr-login@v1
  26. with:
  27. registry-type: 'public'
  28. - name: Remove from ECR
  29. id: remove_from_ecr
  30. run: |
  31. aws ecr-public batch-delete-image \
  32. --repository-name kafka-ui-custom-build \
  33. --image-ids imageTag=${{ steps.extract_branch.outputs.tag }} \
  34. --region us-east-1