let forgejo manage versions

This commit is contained in:
Pim Kunis 2023-06-14 13:51:50 +02:00
parent 1a18dedf63
commit d2272c54c5
3 changed files with 38 additions and 34 deletions

1
deploy.md Normal file
View file

@ -0,0 +1 @@
`fly -t home set-pipeline -l secrets.yml -l vars.yml -p concourse-apprise-notifier -c pipeline.yml`

View file

@ -11,6 +11,7 @@ resources:
repository: git.pim.kunis.nl/pim/concourse-apprise-notifier repository: git.pim.kunis.nl/pim/concourse-apprise-notifier
username: pim username: pim
password: ((api_key)) password: ((api_key))
tag: ((image_version))
icon: docker icon: docker
jobs: jobs:
@ -40,40 +41,41 @@ jobs:
build build
ls image ls image
cat image/digest | cut -d ":" -f 2- > image/tag cat image/digest | cut -d ":" -f 2- > image/tag
- task: get-old-packages # - task: get-old-packages
config: # config:
platform: linux # platform: linux
image_resource: # image_resource:
type: registry-image # type: registry-image
source: # source:
repository: badouralix/curl-jq # repository: badouralix/curl-jq
outputs: # outputs:
- name: old-packages # - name: old-packages
run: # run:
path: sh # path: sh
args: # args:
- -exc # - -exc
- | # - |
ls -lash # ls -lash
curl -X 'GET' 'https://git.pim.kunis.nl/api/v1/packages/pim?type=container&q=concourse-apprise-notifier' -H 'accept: application/json' | jq -rc 'map(.version) | .[]' > old-packages/packages.txt # curl -X 'GET' 'https://git.pim.kunis.nl/api/v1/packages/pim/container/concourse-apprise-notifier/((image_version))'
cat old-packages/packages.txt # curl -X 'GET' 'https://git.pim.kunis.nl/api/v1/packages/pim?type=container&q=concourse-apprise-notifier' -H 'accept: application/json' | jq -rc 'map(.version) | .[]' > old-packages/packages.txt
- task: delete-old-packages # cat old-packages/packages.txt
config: # - task: delete-old-packages
platform: linux # config:
image_resource: # platform: linux
type: registry-image # image_resource:
source: # type: registry-image
repository: badouralix/curl-jq # source:
inputs: # repository: badouralix/curl-jq
- name: old-packages # inputs:
run: # - name: old-packages
path: sh # run:
args: # path: sh
- -exc # args:
- | # - -exc
ls -lash # - |
while read pkg; do curl -X 'DELETE' "https://git.pim.kunis.nl/api/v1/packages/pim/container/concourse-apprise-notifier/$pkg?token=((api_key))" -H 'accept: application/json'; done < old-packages/packages.txt # ls -lash
# while read pkg; do curl -X 'DELETE' "https://git.pim.kunis.nl/api/v1/packages/pim/container/concourse-apprise-notifier/$pkg?token=((api_key))" -H 'accept: application/json'; done < old-packages/packages.txt
- put: registry-image - put: registry-image
params: params:
image: image/image.tar image: image/image.tar
additional_tags: image/tag additional_tags: 'latest ((image_version))'

1
vars.yml Normal file
View file

@ -0,0 +1 @@
image_version: "1.1"