mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 18:20:07 +01:00
fix: add most gitlab options
This commit is contained in:
parent
3161819c57
commit
262729e9bb
1 changed files with 42 additions and 55 deletions
|
|
@ -19,6 +19,11 @@
|
||||||
else v;
|
else v;
|
||||||
|
|
||||||
subType = options: lib.types.submodule {inherit options;};
|
subType = options: lib.types.submodule {inherit options;};
|
||||||
|
mkNullOption = type:
|
||||||
|
lib.mkOption {
|
||||||
|
default = null;
|
||||||
|
type = lib.types.nullOr type;
|
||||||
|
};
|
||||||
|
|
||||||
configType = with lib;
|
configType = with lib;
|
||||||
subType {
|
subType {
|
||||||
|
|
@ -45,18 +50,10 @@
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
# gitlab opts
|
# gitlab opts
|
||||||
before_script = mkOption {
|
|
||||||
type = types.listOf types.str;
|
|
||||||
default = [];
|
|
||||||
};
|
|
||||||
script = mkOption {
|
script = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
after_script = mkOption {
|
|
||||||
type = types.listOf types.str;
|
|
||||||
default = [];
|
|
||||||
};
|
|
||||||
stage = mkOption {
|
stage = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
};
|
};
|
||||||
|
|
@ -64,34 +61,34 @@
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = cfg.default-nix-image;
|
default = cfg.default-nix-image;
|
||||||
};
|
};
|
||||||
variables = mkOption {
|
after_script = mkNullOption (types.listOf types.str);
|
||||||
type = types.nullOr types.attrs;
|
allow_failure = mkNullOption (types.either types.attrs types.bool);
|
||||||
default = null;
|
artifacts = mkNullOption (types.attrs);
|
||||||
};
|
before_script = mkNullOption (types.listOf types.str);
|
||||||
artifacts = mkOption {
|
cache = mkNullOption (types.attrs);
|
||||||
type = types.nullOr types.attrs;
|
coverage = mkNullOption (types.str);
|
||||||
default = null;
|
dependencies = mkNullOption (types.listOf types.str);
|
||||||
};
|
environment = mkNullOption (types.either types.attrs types.str);
|
||||||
when = mkOption {
|
extends = mkNullOption (types.str);
|
||||||
type = types.nullOr types.str;
|
hooks = mkNullOption (types.attrs);
|
||||||
default = null;
|
id_tokens = mkNullOption (types.attrs);
|
||||||
};
|
"inherit" = mkNullOption (types.attrs);
|
||||||
start_in = mkOption {
|
interruptile = mkNullOption (types.bool);
|
||||||
type = types.nullOr types.str;
|
needs = mkNullOption (types.listOf types.str);
|
||||||
default = null;
|
publish = mkNullOption (types.str);
|
||||||
};
|
pages = mkNullOption (types.attrs);
|
||||||
allow_failure = mkOption {
|
parallel = mkNullOption (types.either types.int types.attrs);
|
||||||
type = types.nullOr types.bool;
|
release = mkNullOption (types.attrs);
|
||||||
default = null;
|
retry = mkNullOption (types.either types.int types.attrs);
|
||||||
};
|
rules = mkNullOption (types.listOf types.attrs);
|
||||||
needs = mkOption {
|
resource_group = mkNullOption (types.str);
|
||||||
type = types.nullOr (types.listOf types.str);
|
secrets = mkNullOption (types.attrs);
|
||||||
default = null;
|
services = mkNullOption (types.listOf types.attrs);
|
||||||
};
|
start_in = mkNullOption (types.str);
|
||||||
rules = mkOption {
|
tags = mkNullOption (types.listOf types.str);
|
||||||
type = types.nullOr (types.listOf types.attrs);
|
timeout = mkNullOption (types.str);
|
||||||
default = null;
|
variables = mkNullOption (types.attrs);
|
||||||
};
|
when = mkNullOption (types.str);
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options = with lib; {
|
options = with lib; {
|
||||||
|
|
@ -104,22 +101,12 @@
|
||||||
'';
|
'';
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
image = mkOption {
|
image = mkNullOption (types.str);
|
||||||
type = types.nullOr types.str;
|
variables = mkNullOption (types.attrs);
|
||||||
default = null;
|
default = mkNullOption (types.attrs);
|
||||||
};
|
stages = mkNullOption (types.listOf types.str);
|
||||||
variables = mkOption {
|
include = mkNullOption (types.attrs);
|
||||||
type = types.nullOr types.attrs;
|
workflow = mkNullOption (types.attrs);
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
default = mkOption {
|
|
||||||
type = types.nullOr types.attrs;
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
stages = mkOption {
|
|
||||||
type = types.nullOr (types.listOf types.str);
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
jobs = mkOption {
|
jobs = mkOption {
|
||||||
type = types.lazyAttrsOf jobType;
|
type = types.lazyAttrsOf jobType;
|
||||||
default = {};
|
default = {};
|
||||||
|
|
@ -141,7 +128,7 @@
|
||||||
// lib.optionalAttrs job.nix {
|
// lib.optionalAttrs job.nix {
|
||||||
before_script =
|
before_script =
|
||||||
arr
|
arr
|
||||||
++ job.before_script;
|
++ job.before_script or [];
|
||||||
};
|
};
|
||||||
|
|
||||||
jobs = filterAttrsRec (n: v: v != null) config.ci.jobs;
|
jobs = filterAttrsRec (n: v: v != null) config.ci.jobs;
|
||||||
|
|
@ -153,7 +140,7 @@
|
||||||
jobsMappedForDeps =
|
jobsMappedForDeps =
|
||||||
mapAttrs (key: job: {
|
mapAttrs (key: job: {
|
||||||
name = "gitlab-ci-job-deps:${key}";
|
name = "gitlab-ci-job-deps:${key}";
|
||||||
value = pkgs.writeShellScript "gitlab-ci-jobs:${key}" ''
|
value = pkgs.writeShellScript "gitlab-ci-job-deps:${key}" ''
|
||||||
export PATH="${lib.makeBinPath job.deps}:$PATH";
|
export PATH="${lib.makeBinPath job.deps}:$PATH";
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
@ -162,7 +149,7 @@
|
||||||
jobsMappedForScript =
|
jobsMappedForScript =
|
||||||
mapAttrs (key: job: {
|
mapAttrs (key: job: {
|
||||||
name = "gitlab-ci-job:${key}";
|
name = "gitlab-ci-job:${key}";
|
||||||
value = pkgs.writeShellScriptBin "gitlab-ci-jobs:${key}" (lib.strings.concatLines (job.before_script ++ job.script ++ job.after_script));
|
value = pkgs.writeShellScriptBin "gitlab-ci-job:${key}" (lib.strings.concatLines (job.before_script or [] ++ job.script ++ job.after_script or []));
|
||||||
})
|
})
|
||||||
jobs;
|
jobs;
|
||||||
# build the deps specific for this job before anything, this way the deps should be fetched from the cache
|
# build the deps specific for this job before anything, this way the deps should be fetched from the cache
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue