mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
fix(ci): work around gitlab's variable substitution limitations
This commit is contained in:
parent
b4071d4171
commit
7569fcd086
2 changed files with 20 additions and 7 deletions
|
|
@ -4,8 +4,8 @@ spec:
|
|||
type: string
|
||||
description: |
|
||||
(empty for auto) | none | runner | cachix | attic
|
||||
When left empty $NIX_CI_CACHE_STRATEGY will be used, which defaults to none
|
||||
default: ""
|
||||
Sets the default strategy and will be overridden by $NIX_CI_CACHE_STRATEGY
|
||||
default: "none"
|
||||
cache_files:
|
||||
type: array
|
||||
description: |
|
||||
|
|
@ -19,17 +19,29 @@ stages:
|
|||
variables:
|
||||
# which version of the image should be used
|
||||
_NIX_CI_VERSION: ${NIX_CI_VERSION}
|
||||
_NIX_CI_IMAGE: ${NIX_CI_IMAGE:-registry.gitlab.com/technofab/nix-gitlab-ci/nix-ci:${_NIX_CI_VERSION}}
|
||||
_NIX_CI_IMAGE: registry.gitlab.com/technofab/nix-gitlab-ci/nix-ci:${_NIX_CI_VERSION}
|
||||
# force build the pipeline yaml
|
||||
_NIX_CI_FORCE_BUILD: ${NIX_CI_FORCE_BUILD}
|
||||
# disable caching on the child pipeline jobs
|
||||
_NIX_CI_DISABLE_CACHE: ${NIX_CI_DISABLE_CACHE}
|
||||
# type of cache strategy to use (none, runner, attic, cachix)
|
||||
_CACHE_STRATEGY_TMP: $[[ inputs.cache_strategy ]]
|
||||
_NIX_CI_CACHE_STRATEGY: ${NIX_CI_CACHE_STRATEGY:-${_CACHE_STRATEGY_TMP:-none}}
|
||||
_NIX_CI_CACHE_STRATEGY: $[[ inputs.cache_strategy ]]
|
||||
# for multiple pipelines
|
||||
_NIX_CI_PIPELINE_NAME: ${NIX_CI_PIPELINE_NAME:-${CI_PIPELINE_SOURCE:-default}}
|
||||
_NIX_CI_PIPELINE_NAME: ${CI_PIPELINE_SOURCE}
|
||||
.env_overrides: &env_overrides
|
||||
rules:
|
||||
- if: $NIX_CI_IMAGE != null
|
||||
variables:
|
||||
_NIX_CI_IMAGE: $NIX_CI_IMAGE
|
||||
- if: $NIX_CI_CACHE_STRATEGY != null
|
||||
variables:
|
||||
_NIX_CI_CACHE_STRATEGY: $NIX_CI_CACHE_STRATEGY
|
||||
- if: $NIX_CI_PIPELINE_NAME != null
|
||||
variables:
|
||||
_NIX_CI_PIPELINE_NAME: $NIX_CI_PIPELINE_NAME
|
||||
- when: on_success
|
||||
nix-ci:build:
|
||||
<<: *env_overrides
|
||||
stage: build
|
||||
image: $_NIX_CI_IMAGE
|
||||
cache:
|
||||
|
|
@ -60,6 +72,7 @@ nix-ci:build:
|
|||
paths:
|
||||
- generated-gitlab-ci.yml
|
||||
nix-ci:trigger:
|
||||
<<: *env_overrides
|
||||
stage: trigger
|
||||
needs:
|
||||
- nix-ci:build
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue