fix(ci): build correct package and hopefully handle cache issues

This commit is contained in:
technofab 2025-02-21 18:52:55 +01:00
parent 7569fcd086
commit 244142274d

View file

@ -53,15 +53,15 @@ nix-ci:build:
paths: paths:
- .nix-cache/ - .nix-cache/
before_script: before_script:
# generated-gitlab-ci.yml exists in the cache # generated-gitlab-ci-<pipeline>.yml exists in the cache
- '[ -f "generated-gitlab-ci.yml" ] && export CACHED=true && echo "A cached pipeline file exists (skip cache with NIX_CI_FORCE_BUILD)" || true' - '[ -f "generated-gitlab-ci-${_NIX_CI_PIPELINE_NAME}.yml" ] && export CACHED=true && echo "A cached pipeline file exists (skip cache with NIX_CI_FORCE_BUILD)" || true'
# allow the user to manually skip the cache (when the key files are not correctly configured etc.) # allow the user to manually skip the cache (when the key files are not correctly configured etc.)
- '[ -n "$_NIX_CI_FORCE_BUILD" ] && unset CACHED && echo "Caching skipped for this job (through NIX_CI_FORCE_BUILD)" || true' - '[ -n "$_NIX_CI_FORCE_BUILD" ] && unset CACHED && echo "Caching skipped for this job (through NIX_CI_FORCE_BUILD)" || true'
# only setup when we need to generate the pipeline yaml # only setup when we need to generate the pipeline yaml
- 'if [ -z "$CACHED" ]; then source setup_nix_ci; fi' - 'if [ -z "$CACHED" ]; then source setup_nix_ci; fi'
script: script:
# build the generated-gitlab-ci.yml if it does not exist in the cache # build the generated-gitlab-ci.yml if it does not exist in the cache
- 'if [ -z "$CACHED" ]; then nix build .#gitlab-ci-config && install result generated-gitlab-ci.yml; fi' - 'if [ -z "$CACHED" ]; then nix build .#gitlab-ci:pipeline:${_NIX_CI_PIPELINE_NAME} && install result generated-gitlab-ci-${_NIX_CI_PIPELINE_NAME}.yml; fi'
after_script: after_script:
# NOTE: environment variables of before_script and script don't exist here anymore # NOTE: environment variables of before_script and script don't exist here anymore
# #