-
Notifications
You must be signed in to change notification settings - Fork 3k
83 lines (74 loc) · 2.59 KB
/
Copy pathimage-delete.yml
File metadata and controls
83 lines (74 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Delete image from registry
env:
OWNER: ${{ github.repository_owner }}
on:
workflow_dispatch:
inputs:
image:
description: Image name to delete (e.g. base-notebook)
required: true
type: choice
options:
- docker-stacks-foundation
- base-notebook
- minimal-notebook
- scipy-notebook
- r-notebook
- julia-notebook
- tensorflow-notebook
- pytorch-notebook
- datascience-notebook
- pyspark-notebook
- all-spark-notebook
tag:
description: Image tag to delete (e.g. 2024-01-01 or latest)
required: true
type: string
registry:
description: Registry to delete from
required: true
type: choice
default: quay
options:
- dockerhub
- quay
- both
permissions: {}
jobs:
image-delete:
runs-on: ubuntu-24.04
environment: registry-image-delete
permissions:
contents: read
timeout-minutes: 5
if: (github.repository_owner == 'jupyter' || github.repository_owner == 'mathbunnyru') && github.ref == 'refs/heads/main'
steps:
- name: Install skopeo 📦
run: sudo apt-get update && sudo apt-get install -y skopeo
- name: Login to Docker Hub 🔐
if: inputs.registry == 'dockerhub' || inputs.registry == 'both'
env:
DOCKERHUB_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
skopeo login docker.io \
--username "$DOCKERHUB_USERNAME" \
--password "$DOCKERHUB_TOKEN"
- name: Login to Quay.io 🔐
if: inputs.registry == 'quay' || inputs.registry == 'both'
run: |
skopeo login quay.io \
--username ${{ secrets.QUAY_USERNAME }} \
--password ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Delete tag from Docker Hub 🗑️
if: inputs.registry == 'dockerhub' || inputs.registry == 'both'
run: |
skopeo delete \
docker://docker.io/${{ env.OWNER }}/${{ inputs.image }}:${{ inputs.tag }}
echo "Successfully deleted ${{ env.OWNER }}/${{ inputs.image }}:${{ inputs.tag }} from Docker Hub"
- name: Delete tag from Quay.io 🗑️
if: inputs.registry == 'quay' || inputs.registry == 'both'
run: |
skopeo delete \
docker://quay.io/${{ env.OWNER }}/${{ inputs.image }}:${{ inputs.tag }}
echo "Successfully deleted ${{ env.OWNER }}/${{ inputs.image }}:${{ inputs.tag }} from Quay.io"