Skip to content

Commit

Permalink
Initial version of manual delete docker #TASK-7417
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfeSanahuja committed Feb 19, 2025
1 parent f28577c commit ad2b9d4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/manual-delete-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Manual Delete Docker Image

on:
workflow_dispatch:


jobs:
call-delete-docker:
name: Call Reusable Delete Docker Workflow
uses: opencb/cellbase/.github/workflows/reusable-delete-docker.yml@develop
with:
task: ${{ inputs.task }}
secrets: inherit
32 changes: 32 additions & 0 deletions .github/workflows/reusable-delete-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Reusable delete docker workflow from DockerHub

on:
workflow_call:
inputs:
task:
type: string
required: true
secrets:
DOCKER_HUB_USER:
required: true
DOCKER_HUB_PASSWORD:
required: true

jobs:
delete-docker:
name: Execute delete docker image
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '10'
- name: Validate task name
if: ${{ !startsWith(inputs.task, 'TASK') }}
run: |
echo "Error: Can't delete ${{ inputs.task }}. Only Docker images related to TASK branches can be deleted"
exit 1
- name: Delete in Docker Hub
if: ${{ startsWith(inputs.task, 'TASK') }}
run: |
echo "Deleting docker image ${{ inputs.task }}"
python3 ./cellbase-app/app/cloud/docker/docker-build.py delete --images base --tag ${{ inputs.task }} --username ${{ secrets.DOCKER_HUB_USER }} --password ${{ secrets.DOCKER_HUB_PASSWORD }}

0 comments on commit ad2b9d4

Please sign in to comment.