delete old package releases
use digest as package tag
This commit is contained in:
parent
a673ab047f
commit
be32f23c79
1 changed files with 42 additions and 3 deletions
45
pipeline.yml
45
pipeline.yml
|
@ -7,9 +7,8 @@ resources:
|
||||||
type: registry-image
|
type: registry-image
|
||||||
source:
|
source:
|
||||||
repository: git.pim.kunis.nl/pim/static
|
repository: git.pim.kunis.nl/pim/static
|
||||||
tag: latest
|
|
||||||
username: pim
|
username: pim
|
||||||
password: ((registry_token))
|
password: ((api_key))
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- name: build-and-deploy-static-website
|
- name: build-and-deploy-static-website
|
||||||
|
@ -55,10 +54,50 @@ jobs:
|
||||||
params:
|
params:
|
||||||
DOCKERFILE: site-repo/Dockerfile
|
DOCKERFILE: site-repo/Dockerfile
|
||||||
run:
|
run:
|
||||||
path: build
|
path: sh
|
||||||
|
args:
|
||||||
|
- -exc
|
||||||
|
- |
|
||||||
|
build
|
||||||
|
ls image
|
||||||
|
cat image/digest | cut -d ":" -f 2- > image/tags
|
||||||
|
- task: get-site-packages
|
||||||
|
config:
|
||||||
|
platform: linux
|
||||||
|
image_resource:
|
||||||
|
type: registry-image
|
||||||
|
source:
|
||||||
|
repository: badouralix/curl-jq
|
||||||
|
outputs:
|
||||||
|
- name: site-packages
|
||||||
|
run:
|
||||||
|
path: sh
|
||||||
|
args:
|
||||||
|
- -exc
|
||||||
|
- |
|
||||||
|
ls -lash
|
||||||
|
curl -X 'GET' 'https://git.pim.kunis.nl/api/v1/packages/pim?type=container&q=static' -H 'accept: application/json' | jq -rc 'map(.version) | .[]' > site-packages/packages.txt
|
||||||
|
cat site-packages/packages.txt
|
||||||
|
- task: delete-old-packages
|
||||||
|
config:
|
||||||
|
platform: linux
|
||||||
|
image_resource:
|
||||||
|
type: registry-image
|
||||||
|
source:
|
||||||
|
repository: badouralix/curl-jq
|
||||||
|
inputs:
|
||||||
|
- name: site-packages
|
||||||
|
run:
|
||||||
|
path: sh
|
||||||
|
args:
|
||||||
|
- -exc
|
||||||
|
- |
|
||||||
|
ls -lash
|
||||||
|
while read pkg; do curl -X 'DELETE' "https://git.pim.kunis.nl/api/v1/packages/pim/container/static/$pkg?token=((api_key))" -H 'accept: application/json'; done < site-packages/packages.txt
|
||||||
- put: site-registry-image
|
- put: site-registry-image
|
||||||
params:
|
params:
|
||||||
image: image/image.tar
|
image: image/image.tar
|
||||||
|
additional_tags: image/tags
|
||||||
- task: deploy-site
|
- task: deploy-site
|
||||||
config:
|
config:
|
||||||
platform: linux
|
platform: linux
|
||||||
|
|
Reference in a new issue