1
0
Fork 0

fix cleanup
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Massaki Archambault 2021-12-26 00:13:33 -05:00
parent d25e59f713
commit 83de939022
1 changed files with 6 additions and 4 deletions

View File

@ -40,7 +40,7 @@ steps:
---
kind: pipeline
type: kubernetes
name: build-multiarch-manifest
name: create-multiarch-manifest
steps:
- name: docker manifest
@ -55,10 +55,12 @@ steps:
DOCKER_PASSWORD:
from_secret: docker_password
- name: cleanup
image: curlimages/curl
image: alpine
commands:
- curl -u "$DOCKER_USERNAME:$DOCKER_PASSWORD" -X "DELETE" https://cloud.docker.com/v2/repositories/${DRONE_REPO}/tags/${DRONE_COMMIT_SHA:0:8}-arm64
- curl -u "$DOCKER_USERNAME:$DOCKER_PASSWORD" -X "DELETE" https://cloud.docker.com/v2/repositories/${DRONE_REPO}/tags/${DRONE_COMMIT_SHA:0:8}-amd64
- apk add curl jq
- 'DOCKER_TOKEN="$(curl -sf -XPOST -H "Content-Type: application/json" -d "{\"username\":\"$DOCKER_USERNAME\",\"password\":\"$DOCKER_PASSWORD\"}" https://hub.docker.com/v2/users/login | jq --raw-output .token)"'
- 'curl -sf -XDELETE -H "Accept: application/json" -H "Authorization: Bearer $DOCKER_TOKEN" https://hub.docker.com/v2/repositories/${DRONE_REPO}/tags/${DRONE_COMMIT_SHA:0:8}-arm64/'
- 'curl -sf -XDELETE -H "Accept: application/json" -H "Authorization: Bearer $DOCKER_TOKEN" https://hub.docker.com/v2/repositories/${DRONE_REPO}/tags/${DRONE_COMMIT_SHA:0:8}-amd64/'
environment:
DOCKER_USERNAME:
from_secret: docker_username