Skip to content

Delete Outdated Docker Image #8

Delete Outdated Docker Image

Delete Outdated Docker Image #8

Workflow file for this run

name: Branch Deleted
on: delete
jobs:
delete:
if: github.event.ref_type == 'branch'
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
- name: Define linked test image name
id: image_name
run: |
echo "name=${{vars.DOCKER_IMAGE}}:test-${{steps.meta.outputs.version}}" >> $GITHUB_OUTPUT
- name: Clean up
shell: bash
run: |
registry="https://registry-1.docker.io"
name=${{steps.image_name.outputs.name}}
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$(
curl -sSL -I \
-H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
"http://${registry}/v2/${name}/manifests/$(
curl -sSL "http://${registry}/v2/${name}/tags/list" | jq -r '.tags[0]'
)" \
| awk '$1 == "Docker-Content-Digest:" { print $2 }' \
| tr -d $'\r' \
)"
- name: Define linked image name
id: image_name

Check failure on line 30 in .github/workflows/delete_image.yml

View workflow run for this annotation

GitHub Actions / Branch Deleted

Invalid workflow file

The workflow is not valid. .github/workflows/delete_image.yml (Line: 30, Col: 13): The identifier 'image_name' may not be used more than once within the same scope.
run: |
echo "name=${{vars.DOCKER_IMAGE}}:${{steps.meta.outputs.version}}" >> $GITHUB_OUTPUT
- name: Clean up
shell: bash
run: |
registry="https://registry-1.docker.io"
name=${{steps.image_name.outputs.name}}
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$(
curl -sSL -I \
-H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
"http://${registry}/v2/${name}/manifests/$(
curl -sSL "http://${registry}/v2/${name}/tags/list" | jq -r '.tags[0]'
)" \
| awk '$1 == "Docker-Content-Digest:" { print $2 }' \
| tr -d $'\r' \
)"