chore(gitlab-ci): first stub of major ci update

This commit is contained in:
Sarah Vaupel 2024-08-19 01:00:50 +02:00
parent ce3dcfdbd3
commit 8140ebdc6d

View File

@ -24,13 +24,14 @@ variables:
default: default:
image: image:
name: registry.uniworx.de/fradrive/fradrive/fradrive-env:latest # Debian 12.5 Bookworm name: dind
entrypoint: [""] # name: registry.uniworx.de/fradrive/fradrive/fradrive-env:latest # Debian 12.5 Bookworm
docker: # entrypoint: [""]
platform: x86_64 # docker:
user: ${ENV_USER} # platform: x86_64
before_script: # user: ${ENV_USER}
- chown -R ${ENV_USER} . # Change project directory ownership to (non-root) user inside docker container # before_script:
# - chown -R ${ENV_USER} . # Change project directory ownership to (non-root) user inside docker container
artifacts: artifacts:
name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}"
expire_in: "1 day" expire_in: "1 day"
@ -38,62 +39,110 @@ default:
interruptible: true interruptible: true
stages: # TODO: Rethink and reintroduce stages
- setup # stages:
- build # - setup
- lint # - build
- test # - lint
- container # - test
- prepare release # - container
- release # - prepare release
# - release
frontend image:
frontend dependencies:
stage: setup
cache:
- &npm-cache
key: default-npm
paths: &npm-paths
- node_modules/
- .npm/
- .npmrc
script: script:
- make node_modules # TODO: define make target for this
- make -- --docker-build-frontend-build FRADRIVE_DOCKERFILE=frontend
- docker image save frontend | gzip > docker/frontend/image.tar.gz
artifacts: artifacts:
paths: *npm-paths paths:
- docker/frontend/image.tar.gz
well-known: frontend build:
stage: setup
script:
- make well-known
needs: needs:
- job: frontend dependencies - job: frontend image
artifacts: true artifacts: true
script:
- zcat docker/frontend/image.tar.gz | docker image load
- docker run --rm -it -v ${CI_PROJECT_DIR}:/fradrive --env FRADRIVE_MAKE_TARGET=frontend-build frontend # TODO: define new make target or make current target compatible
artifacts:
paths:
- /fradrive/node_modules
- /fradrive/well-known
cache: cache:
- &frontend-cache - &frontend-cache
key: default-frontend key: default-frontend
paths: paths:
- .well-known-cache - /fradrive/.npm/
artifacts: - /fradrive/.well-known-cache/
paths:
- well-known/
- .well-known-cache/
# TODO: cache is always uploaded even if up-to-date; prevent re-upload when up-to-date frontend lint:
backend dependencies: needs:
stage: setup - job: frontend image
cache: artifacts: true
- &stack-cache
key: default-stack frontend test:
paths: needs:
- .stack/ - job: frontend image
- .stack-work/ artifacts: true
- job: frontend build
artifacts: true
push image(s):
needs:
- job: frontend image
artifacts: true
script: script:
- make backend-dependencies-prod - docker load ...
artifacts: - docker tag ...
paths: - docker push ...
- .stack/
- .stack-work/ # frontend dependencies:
# stage: setup
# cache:
# - &npm-cache
# key: default-npm
# paths: &npm-paths
# - node_modules/
# - .npm/
# - .npmrc
# script:
# - make node_modules
# artifacts:
# paths: *npm-paths
# well-known:
# stage: setup
# script:
# - make well-known
# needs:
# - job: frontend dependencies
# artifacts: true
# cache:
# - &frontend-cache
# key: default-frontend
# paths:
# - .well-known-cache
# artifacts:
# paths:
# - well-known/
# - .well-known-cache/
# # TODO: cache is always uploaded even if up-to-date; prevent re-upload when up-to-date
# backend dependencies:
# stage: setup
# cache:
# - &stack-cache
# key: default-stack
# paths:
# - .stack/
# - .stack-work/
# script:
# - make backend-dependencies-prod
# artifacts:
# paths:
# - .stack/
# - .stack-work/
frontend build: frontend build:
stage: build stage: build