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
|
|
@ -14,7 +14,6 @@
|
||||||
flake = {};
|
flake = {};
|
||||||
perSystem = {
|
perSystem = {
|
||||||
pkgs,
|
pkgs,
|
||||||
inputs',
|
|
||||||
config,
|
config,
|
||||||
system,
|
system,
|
||||||
...
|
...
|
||||||
|
|
@ -26,6 +25,7 @@
|
||||||
mdformat.enable = true;
|
mdformat.enable = true;
|
||||||
yamlfmt.enable = true;
|
yamlfmt.enable = true;
|
||||||
};
|
};
|
||||||
|
settings.formatter.yamlfmt.excludes = ["templates/nix-gitlab-ci.yml"];
|
||||||
};
|
};
|
||||||
devenv.shells.default = {
|
devenv.shells.default = {
|
||||||
containers = pkgs.lib.mkForce {};
|
containers = pkgs.lib.mkForce {};
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ spec:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
(empty for auto) | none | runner | cachix | attic
|
(empty for auto) | none | runner | cachix | attic
|
||||||
When left empty $NIX_CI_CACHE_STRATEGY will be used, which defaults to none
|
Sets the default strategy and will be overridden by $NIX_CI_CACHE_STRATEGY
|
||||||
default: ""
|
default: "none"
|
||||||
cache_files:
|
cache_files:
|
||||||
type: array
|
type: array
|
||||||
description: |
|
description: |
|
||||||
|
|
@ -19,17 +19,29 @@ stages:
|
||||||
variables:
|
variables:
|
||||||
# which version of the image should be used
|
# which version of the image should be used
|
||||||
_NIX_CI_VERSION: ${NIX_CI_VERSION}
|
_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
|
# force build the pipeline yaml
|
||||||
_NIX_CI_FORCE_BUILD: ${NIX_CI_FORCE_BUILD}
|
_NIX_CI_FORCE_BUILD: ${NIX_CI_FORCE_BUILD}
|
||||||
# disable caching on the child pipeline jobs
|
# disable caching on the child pipeline jobs
|
||||||
_NIX_CI_DISABLE_CACHE: ${NIX_CI_DISABLE_CACHE}
|
_NIX_CI_DISABLE_CACHE: ${NIX_CI_DISABLE_CACHE}
|
||||||
# type of cache strategy to use (none, runner, attic, cachix)
|
# type of cache strategy to use (none, runner, attic, cachix)
|
||||||
_CACHE_STRATEGY_TMP: $[[ inputs.cache_strategy ]]
|
_NIX_CI_CACHE_STRATEGY: $[[ inputs.cache_strategy ]]
|
||||||
_NIX_CI_CACHE_STRATEGY: ${NIX_CI_CACHE_STRATEGY:-${_CACHE_STRATEGY_TMP:-none}}
|
|
||||||
# for multiple pipelines
|
# 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:
|
nix-ci:build:
|
||||||
|
<<: *env_overrides
|
||||||
stage: build
|
stage: build
|
||||||
image: $_NIX_CI_IMAGE
|
image: $_NIX_CI_IMAGE
|
||||||
cache:
|
cache:
|
||||||
|
|
@ -60,6 +72,7 @@ nix-ci:build:
|
||||||
paths:
|
paths:
|
||||||
- generated-gitlab-ci.yml
|
- generated-gitlab-ci.yml
|
||||||
nix-ci:trigger:
|
nix-ci:trigger:
|
||||||
|
<<: *env_overrides
|
||||||
stage: trigger
|
stage: trigger
|
||||||
needs:
|
needs:
|
||||||
- nix-ci:build
|
- nix-ci:build
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue