chore(gitlab-ci): restructure containers stage

This commit is contained in:
Sarah Vaupel 2024-08-21 03:21:10 +02:00
parent 200fc96208
commit 0bdc63040d

View File

@ -14,11 +14,16 @@ variables:
# TODO: old vars; review and maybe remove
AWS_SHARED_CREDENTIALS_FILE: "/etc/aws/credentials"
TRANSFER_METER_FREQUENCY: "2s"
CONTAINER_REGISTRY: registry.uniworx.de/fradrive/fradrive/
default:
image:
name: registry.uniworx.de/fradrive/fradrive/debian-podman:latest
name: registry.uniworx.de/uniworx/containers/debian:12.5
entrypoint: [""]
docker:
platform: x86_64
# name: registry.uniworx.de/fradrive/fradrive/debian-podman:latest
# name: registry.uniworx.de/fradrive/fradrive/docker:dind
# name: registry.uniworx.de/fradrive/fradrive/fradrive-env:latest # Debian 12.5 Bookworm
# entrypoint: [""]
@ -37,22 +42,63 @@ default:
stages:
- build images
- containers
- compile
- lint
- test
- push images
- release # TODO
# TODO: apply rules:changes for image jobs to only execute jobs when Dockerfiles change
frontend image:
stage: build images
stage: containers
image: &buildah quay.io/buildah/stable:latest
script:
# TODO: define make target for this?
- make -- --docker-build-frontend-build FRADRIVE_SERVICE=frontend CONTAINER_RUNNER=podman-compose
- podman image save frontend | gzip > docker/frontend/image.tar.gz
artifacts:
paths:
- docker/frontend/image.tar.gz
- buildah bud -t frontend docker/frontend/Dockerfile
- buildah push frontend $CONTAINER_REGISTRY/frontend
# - make -- --docker-build-frontend-build FRADRIVE_SERVICE=frontend CONTAINER_RUNNER=podman-compose
# # - podman image save frontend | gzip > docker/frontend/image.tar.gz
# artifacts:
# paths:
# - docker/frontend/image.tar.gz
# push frontend image:
# stage: containers
# needs:
# - job: build frontend image
# artifacts: true
# image: quay.io/skopeo/stable:latest
# script:
# - skopeo --insecure-policy copy --dest-creds "${CI_REGISTRY_USER}:${CI_JOB_TOKEN}" docker-archive://$(pwd)/docker/frontend/image.tar.gz docker://${CI_REGISTRY_IMAGE}:${VERSION}
# - skopeo --insecure-policy copy --src-creds "${CI_REGISTRY_USER}:${CI_JOB_TOKEN}" --dest-creds "${CI_REGISTRY_USER}:${CI_JOB_TOKEN}" docker://${CI_REGISTRY_IMAGE}:${VERSION} docker://${CI_REGISTRY_IMAGE}:latest
# #- *load-frontend-image
# # - docker image tag
# - podman push frontend
# # variables:
# # GIT_STRATEGY: none
backend image:
stage: containers
image: *buildah
script:
- buildah bud -t backend docker/backend/Dockerfile
- buildah push backend $CONTAINER_REGISTRY/backend
# script:
# - make -- --docker-build-backend-build FRADRIVE_SERVICE=backend CONTAINER_RUNNER=podman-compose
# - podman image save backend | gzip > docker/backend/image.tar.gz
# artifacts:
# paths:
# - docker/backend/image.tar.gz
# push backend image:
# stage: containers
# needs:
# - job: backend image
# artifacts: true
# script:
# - *load-backend-image
# - podman push backend
frontend build:
stage: compile
@ -96,30 +142,6 @@ frontend test:
cache: *frontend-cache
push frontend image:
stage: push images
needs:
- job: frontend image
artifacts: true
- job: frontend build
artifacts: false
- job: frontend test
artifacts: false
script:
- *load-frontend-image
# - docker image tag
- podman push frontend
backend image:
stage: build images
script:
# TODO: define make target for this?
- make -- --docker-build-backend-build FRADRIVE_SERVICE=backend CONTAINER_RUNNER=podman-compose
- podman image save backend | gzip > docker/backend/image.tar.gz
artifacts:
paths:
- docker/backend/image.tar.gz
backend build:
stage: compile
needs:
@ -158,19 +180,6 @@ backend test:
- make -- --docker-run-backend-test FRADRIVE_SERVICE=backend CONTAINER_RUNNER=podman-compose
cache: *backend-cache
push backend image:
stage: push images
needs:
- job: backend image
artifacts: true
- job: backend build
artifacts: false
- job: backend test
artifacts: false
script:
- *load-backend-image
- podman push backend
# frontend dependencies:
# stage: setup
# cache: