Add promote job
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone Build is failing
continuous-integration/drone/promote/production Build is passing

This commit is contained in:
2024-11-22 11:04:21 +01:00
parent b62f5d0a03
commit 2ffba27f1d

View File

@@ -55,3 +55,55 @@ volumes:
- name: containers - name: containers
host: host:
path: /var/lib/containers path: /var/lib/containers
---
kind: pipeline
type: kubernetes
name: promote
steps:
- name: promote
image: mgoltzsche/podman:5.3.1
privileged: true
environment:
REGISTRY_USERNAME:
from_secret: registry_username
REGISTRY_PASSWORD:
from_secret: registry_password
REGISTRY_SERVER: "docker.io"
RELEASE_IMAGE_NAME: "docker.io/genunix/restic"
commands:
- podman login --username "$${REGISTRY_USERNAME}" --password "$${REGISTRY_PASSWORD}" "$${REGISTRY_SERVER}"
- echo "== Promoting $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA} into production"
- podman pull docker://$${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA}
- podman push $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA} docker://$${RELEASE_IMAGE_NAME}:latest
- podman logout "$${REGISTRY_SERVER}"
volumes:
- name: containers
path: /var/lib/containers
- name: cleanup
image: mgoltzsche/podman:5.3.1
privileged: true
environment:
RELEASE_IMAGE_NAME: "docker.io/genunix/restic"
commands:
- podman rmi -f $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA}
- podman rmi -f $${RELEASE_IMAGE_NAME}:latest
- podman image prune -f
volumes:
- name: containers
path: /var/lib/containers
when:
branch:
- master
trigger:
event:
- promote
target:
- production
volumes:
- name: containers
host:
path: /var/lib/containers