mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +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;
|
||||
|
||||
subType = options: lib.types.submodule {inherit options;};
|
||||
mkNullOption = type:
|
||||
lib.mkOption {
|
||||
default = null;
|
||||
type = lib.types.nullOr type;
|
||||
};
|
||||
|
||||
configType = with lib;
|
||||
subType {
|
||||
|
|
@ -45,18 +50,10 @@
|
|||
default = [];
|
||||
};
|
||||
# gitlab opts
|
||||
before_script = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
};
|
||||
script = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
};
|
||||
after_script = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
};
|
||||
stage = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
|
|
@ -64,34 +61,34 @@
|
|||
type = types.str;
|
||||
default = cfg.default-nix-image;
|
||||
};
|
||||
variables = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
};
|
||||
artifacts = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
};
|
||||
when = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
start_in = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
allow_failure = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
needs = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
};
|
||||
rules = mkOption {
|
||||
type = types.nullOr (types.listOf types.attrs);
|
||||
default = null;
|
||||
};
|
||||
after_script = mkNullOption (types.listOf types.str);
|
||||
allow_failure = mkNullOption (types.either types.attrs types.bool);
|
||||
artifacts = mkNullOption (types.attrs);
|
||||
before_script = mkNullOption (types.listOf types.str);
|
||||
cache = mkNullOption (types.attrs);
|
||||
coverage = mkNullOption (types.str);
|
||||
dependencies = mkNullOption (types.listOf types.str);
|
||||
environment = mkNullOption (types.either types.attrs types.str);
|
||||
extends = mkNullOption (types.str);
|
||||
hooks = mkNullOption (types.attrs);
|
||||
id_tokens = mkNullOption (types.attrs);
|
||||
"inherit" = mkNullOption (types.attrs);
|
||||
interruptile = mkNullOption (types.bool);
|
||||
needs = mkNullOption (types.listOf types.str);
|
||||
publish = mkNullOption (types.str);
|
||||
pages = mkNullOption (types.attrs);
|
||||
parallel = mkNullOption (types.either types.int types.attrs);
|
||||
release = mkNullOption (types.attrs);
|
||||
retry = mkNullOption (types.either types.int types.attrs);
|
||||
rules = mkNullOption (types.listOf types.attrs);
|
||||
resource_group = mkNullOption (types.str);
|
||||
secrets = mkNullOption (types.attrs);
|
||||
services = mkNullOption (types.listOf types.attrs);
|
||||
start_in = mkNullOption (types.str);
|
||||
tags = mkNullOption (types.listOf types.str);
|
||||
timeout = mkNullOption (types.str);
|
||||
variables = mkNullOption (types.attrs);
|
||||
when = mkNullOption (types.str);
|
||||
};
|
||||
in {
|
||||
options = with lib; {
|
||||
|
|
@ -104,22 +101,12 @@
|
|||
'';
|
||||
default = {};
|
||||
};
|
||||
image = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
variables = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
};
|
||||
default = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
};
|
||||
stages = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
};
|
||||
image = mkNullOption (types.str);
|
||||
variables = mkNullOption (types.attrs);
|
||||
default = mkNullOption (types.attrs);
|
||||
stages = mkNullOption (types.listOf types.str);
|
||||
include = mkNullOption (types.attrs);
|
||||
workflow = mkNullOption (types.attrs);
|
||||
jobs = mkOption {
|
||||
type = types.lazyAttrsOf jobType;
|
||||
default = {};
|
||||
|
|
@ -141,7 +128,7 @@
|
|||
// lib.optionalAttrs job.nix {
|
||||
before_script =
|
||||
arr
|
||||
++ job.before_script;
|
||||
++ job.before_script or [];
|
||||
};
|
||||
|
||||
jobs = filterAttrsRec (n: v: v != null) config.ci.jobs;
|
||||
|
|
@ -153,7 +140,7 @@
|
|||
jobsMappedForDeps =
|
||||
mapAttrs (key: job: {
|
||||
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";
|
||||
'';
|
||||
})
|
||||
|
|
@ -162,7 +149,7 @@
|
|||
jobsMappedForScript =
|
||||
mapAttrs (key: job: {
|
||||
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;
|
||||
# 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