Pipeline Inputs
For pipelines using spec: inputs:, pass values via CLI flags or a YAML file.
Usage#
glci run --input force_build=true --input runner_version=17.6.0
glci run --inputs-file inputs.yml
glci run --inputs-file defaults.yml --input force_build=true # CLI overrides file
glci show --input force_build=true # works with show too
glci merged --input force_build=true # and with merged
Input types#
| Type | Accepted values | Normalization |
|---|---|---|
string | Any value | None |
boolean | A YAML boolean, or the text true or false. See Boolean inputs | Resolves to true/false |
number | Text (--input, or a quoted YAML value) is read by GitLab’s JSON parser: any number it reads counts, NaN and Infinity included, with surrounding whitespace allowed, while .5, Inf, 1.e3 and "0x1F" are refused. In YAML (default:, an include entry’s inputs:, --inputs-file, a trigger’s inputs:) an unquoted YAML 1.1 number counts as GitLab reads it: .5 is 0.5, .inf is Infinity, 0x1F is 31, 010 is 8, 1_000 is 1000 and 1:30 is 5400. A plain 1e3 is no YAML number, so it is read as text too | Resolves to the number as Ruby prints it: 1e3 is 1000.0, 5.00 is 5.0, 007 is 7, +5 is 5 (see How values are substituted). A quoted or --input decimal written with more than 16 digits is a BigDecimal to GitLab, which prints it with all its significant digits; glci reads it as a float |
array | Any value | A list when the block is the whole value, its hash and list items intact; inside other text, the list as Ruby prints it, ["a", {:k=>"v"}], as GitLab writes it. Elements can be read with [N]; see Array elements |
Boolean inputs#
A boolean input accepts the same values GitLab does, and every route applies the same rule. GitLab parses the value as JSON and keeps it only when the result is true or false. So a value passes in two cases:
- It is a YAML boolean. This covers
default:, an include entry’sinputs:,--inputs-file, and a trigger’sinputs:. GitLab reads YAML the way Psych does, so an unquotedtrue,false,yes,no,onoroffin any letter case is a boolean. - It is the text
trueorfalse, in lower case. Surrounding whitespace is allowed. This covers--input flag=trueand a quoted"true"in YAML. GitLab’s pipeline API accepts the same strings.
Everything else fails with GitLab’s error, `flag` input: provided value is not a boolean. That includes a quoted "yes", "no", "on", "1", "0" or "TRUE", the integer 1, and --input flag=yes. A refused default fails with resolved default: `flag` input: default value is not a boolean, even when a supplied value overrides it, as on GitLab. For a value that reads as a boolean, such as yes, on, 1 or TRUE, glci adds ; write true or false to the message.
The same word therefore behaves differently in YAML and on the command line. flag: on in an inputs file is a boolean and passes, while --input flag=on is the text on and is refused, as GitLab refuses it from the API.
| Where the value comes from | Accepted | Refused |
|---|---|---|
YAML (default:, include inputs:, --inputs-file, trigger inputs:) | true, false, unquoted yes/no/on/off in any case, "true", "false" | "yes", "on", "1", "TRUE", 1, 0, a list or a hash |
--input, the TUI run form | true, false | yes, on, 1, 0, TRUE, and an empty --input flag= unless the input takes its default from rules: |
A boolean field left empty in the TUI run form supplies no value, so the input takes its default.
Inputs file format#
# inputs.yml
force_build: true
runner_version: "17.6.0"
environment: staging
deploy_rules: # an array input, hash items included
- if: $CI_COMMIT_BRANCH
when: manual
The file must be a mapping of input names to values. Anything else, such as a list, fails with parsing inputs file: must be a mapping of input names to values. An empty file supplies no inputs.
A value reaches a boolean, number or array input as the same value would from an include entry’s inputs:. A list or a hash keeps its structure, and a float keeps the .0 Ruby prints (3.0). Two differences remain:
- A list or a hash given to a
stringinput arrives as YAML flow text ([a, 1]). From an include it arrives as Ruby prints it (["a", 1]). - An entry with no value (
flag:) is the empty string. GitLab treats it as no value, so the input takes its default.
Conditional defaults with rules:#
An input can take its options and default from a rules: list instead of declaring them directly. Rules are evaluated in order and the first match wins; an entry with no if: is the fallback.
spec:
inputs:
environment:
options: ['development', 'production']
default: 'development'
instance_type:
rules:
- if: $[[ inputs.environment ]] == 'development'
options: ['small', 'medium']
default: 'small'
- if: $[[ inputs.environment ]] == 'production'
options: ['large', 'xlarge']
default: 'large'
A rule’s if: can only reference other inputs. CI/CD variables are not in scope, so a $CI_COMMIT_TAG written in an input rule is undefined whatever triggered the pipeline. Comparing an undefined value against "" is false, so a rule written that way never matches — and $CI_COMMIT_TAG == null is always true, so a rule written that way always matches. This is GitLab’s behaviour, which evaluates these rules with the inputs alone.
Inputs resolve in declaration order. A rule may reference another input, but only one declared before it will have a value — a reference to an input declared later sees nothing, not that input’s default, unless the caller supplied a value for it explicitly. That is how GitLab resolves them, and it is worth knowing because it looks like a bug:
spec:
inputs:
image: # declared first
rules:
- if: $[[ inputs.flavor ]] == 'slim'
default: 'alpine'
- default: 'debian' # always taken: flavor has no value yet
flavor:
default: 'slim'
Swap the two entries and image resolves to alpine.
A rule may also name an input that does not exist, or two inputs may read each other. Neither is an error — GitLab accepts both, and so does glci: an unknown name is simply undefined, and a cycle cannot loop because each input resolves exactly once. The practical consequence is that a typo in an input reference is silent: the rule never matches and the fallback wins, with nothing reported. Check the resolved value with glci merged if a rule is not behaving.
Further rules, all matching GitLab:
rules:cannot be combined with a top-leveldefault:oroptions:.- Every rule must carry a
default:key.default:with no value is allowed on a rule that declares nooptions:, and leaves the input without one. The same is true of a top-leveldefault:: the key’s presence is what makes the input optional, sodefault:alone means “optional, no value” rather than a default of any kind. - A rule declaring
options:must have itsdefault:among them, compared as written, without coercion:default: '1'is not amongoptions: [1, 2], whiledefault: 3is amongoptions: [3.0]. A valuelessdefault:counts only if the list itself has anullentry (options: [null, 'a']), which is how GitLab compares it; otherwise the two cannot be combined. For anarrayinput, the default array itself has to be one of the options, and when the input resolves each of its elements must be an option too, which is whyais listed alongside[a]inoptions: [[a], a, b]withdefault: [a]. - A rule whose
options:list is empty or holds nothing butfalseandnullcounts as declaring no options for that check, as GitLab reads the list with Ruby truthiness, sooptions: [false]withdefault: trueparses. The resolved default is still checked against the list when the input resolves, as any value is, so for anything but abooleaninput such a default usually fails there instead. - Any rule carrying a
default:key makes the input optional, whether or not that rule ends up matching. - If no rule matches and none is unconditional, the input resolves to no value rather than erroring, and is not checked against any options. Add a trailing entry with no
if:if that is not what you want. - Supplying an empty value for a rules-bearing input does not override the rule: the empty string is discarded and the matching rule’s default applies. A plain input with a
default:behaves the opposite way, where--input key=does override it. - A resolved input keeps its declared type in a rule, which is not only about text:
- A
booleaninput set tofalseis falsy. Astringinput whose value happens to be"false"is not. - A
numberorarrayinput is never equal to a quoted string, however alike the two print.$[[ inputs.count ]] == "3"is false forcount: {type: number, default: 3}, because GitLab compares anIntegeragainst aString. Compare against another input of the same type, or declare the input as astring. - Two
numberinputs compare by value, as Ruby compares numbers, not by how they print:1000equals1e3(1000.0),-0.0equals0, andNaNequals nothing, not even itself. - An empty
arrayinput is falsy, soif: $[[ inputs.list ]]takes the fallback whenlistresolved to[]. A non-empty array is truthy. A regex match reads an array as Ruby prints it,["a", "b"], quotes included. - Only an input already resolved carries its type. A value supplied for an input declared later is still plain text in an earlier input’s rule.
- A
- A rule’s resolved
default:is checked against its input’s type even when you supply a value that overrides it, as GitLab does:count: {type: number, rules: [{default: abc}]}fails whatever--input count=says. A rule’soptions:are not type-checked, so this is the only place such a default is reported.
Input definitions from other files (spec:include)#
A spec: header can load input definitions from other files with spec: include:, the same way GitLab does:
spec:
include:
- local: /shared-inputs.yml
- project: my-group/shared-configs
ref: main
file: /ci/common-inputs.yml
- remote: https://example.com/ci/shared-inputs.yml
inputs:
version:
default: '1.0'
---
deploy:
script: echo "$[[ inputs.environment ]] $[[ inputs.version ]]"
# shared-inputs.yml
inputs:
environment:
options: ['staging', 'production']
default: staging
local:,remote:andproject:are supported, fetched the same way as an ordinaryinclude:, and a plain string is read aslocal:orremote:.local:accepts wildcards: in the root pipeline and the files it includes from the working tree they match the working tree, and in a file read from another project they match that project’s files, listed through its repository tree. Aproject:entry may list several files.template:,component:andartifact:are refused, as on GitLab:spec:include does not support template: includes; only `local`, `remote`, `project` are supported.- Entries accept only
local,remote,project,file,ref,integrityandcache. Arules:orinputs:key fails the parse.integrity:andcache:are accepted but not acted on, as for an ordinaryinclude:: a remote file is not checked against itsintegrity:hash. - Each file may contain only an
inputs:mapping. Anything else, such as a job, fails the parse:header include file contains unknown keys: job. - Definitions merge in include order, then the inline
inputs:follow. The merged order is the declaration order, so an inline input’srules:can read an included input. - An input defined twice, in two files or in a file and inline, is an error rather than an override, as on GitLab:
Duplicate input keys found: environment. Input keys must be unique across all included files and inline specifications. Within one file, an input written twice is a duplicate YAML key: the last definition is kept, with no error, as on GitLab. $VARreferences in the locations are expanded as ininclude:, with one difference: the globalvariables:block is not read, in the root pipeline or in any included file, as on GitLab, which never expands an include location with it. Pass the variable with--env,.glci.envor a preset. A plain-string entry is expanded before glci decides betweenlocal:andremote:, soinclude: $SHARED_INPUTS_URLholding a URL is a remote include.- A
project:entry needs a GitLab token. Where an ordinaryproject:include with no token is skipped with a warning, aspec:includeone fails the parse, since the file’s inputs cannot be interpolated without its definitions. - An included file can use
spec:includetoo. Its entries are resolved where the file was included from, as on GitLab: alocal:entry in a file pulled in byproject:reads your working tree, not that project. A CI/CD component cannot usespec:include, on GitLab or in glci. - The included definitions count wherever inputs do:
--inputand--inputs-fileare validated against them, and the TUI’s input form lists them. - On the lint-API route (
GLCI_PREFER_API=1), a pipeline whose root file or alocal:file it includes usesspec:includeis parsed offline instead, since glci fetches the files itself, and glci warnsAPI parsing failed, falling back to offline parser: spec:include is resolved by the offline parser only.
How values are substituted#
Blocks are substituted into the parsed YAML, as GitLab does, not into the raw file text:
- A value is placed into the string that holds its block, so quotes, backslashes, newlines or
:in it are never re-read as YAML. An input containing'works inside a single-quoted scalar, andposix_escapeoutput keeps its backslashes inside a double-quoted one. - A block that is the whole value takes its input’s type. A
stringinput stays a string even when it readstrueor123, and anumber,booleanorarrayinput becomes that type. An indexed element takes the element’s own type (see Array elements).splityields a list of strings, so*.go,trueanda: bstay strings. - So a
stringinput standing in for a wholeallow_failure:,interruptible:,retry:orparallel:fails the pipeline with GitLab’s type error, even one holdingyesoron, such asjobs:build allow failure should be a hash or a boolean valueorretry config has to be either an integer or a hash, rather than being read asfalseor as no retry. Declare the inputtype: booleanortype: numberinstead. - A float written in YAML, whether a
default:, an array element or a value in an include entry’sinputs:, is rendered as Ruby prints it, as GitLab does:3.0stays3.0(glci used to render it as3). A string element of an array is quoted when it would otherwise read back as another type, so["3.10", "20"]stays a list of strings. A list or a hash given to astringinput, as itsdefault:or through an include entry’sinputs:, becomes the text Ruby prints for it,["a", "b"]or{:k=>"v"}, as GitLab’svalue.to_sdoes, and itsoptions:are compared against that text. Anumberinput is substituted as the number it resolves to, whichever route its value came by:--input count=3.50gives3.5, anddefault: 1e3gives1000.0. Astringinput keeps the text written,1e3included. One divergence remains: a whole float that is the whole value of a key, or a value in a trigger’sinputs:, loses its.0(N: $[[ inputs.n ]]gives1000where GitLab gives1000.0), as a literalN: 5.0does. - An
arrayinput that is the whole value keeps its items as written, at any depth: a hash stays a hash, a nested list a list and a string a string. So a CI/CD Catalog component can take itsrules:orneeds:as an array input (rules: $[[ inputs.rules ]]), and a rule’swhen: manualor a need’sartifacts: falseapplies, whether the array is the input’sdefault:, an include entry’sinputs:value, a list in--inputs-file, or--inputtext such as--input 'rules=[{if: $X, when: manual}]'. One divergence remains: glci holds a hash’s keys unordered, so they come out sorted. That changes nothing forrules:,needs:orservices:, butparallel: matrix:names its shards in key order, so a matrix passed through an array input (matrix: $[[ inputs.matrix ]]) with keys that are not in alphabetical order gets shard names that differ from GitLab’s:{STACK: [app], PROVIDER: [aws]}names the shardjob: [aws, app]where GitLab hasjob: [app, aws]. A--inputvalue is read as written, so its order is kept. glci used to write a hash item as text such asmap[if:$CI_COMMIT_BRANCH when:manual], which made every rule an unknown string, so the job ran ason_success. - A whole-value block that yields a list inside a sequence, such as a
script:item, is spliced into that sequence, one item per element. - Keys are interpolated too, job names included.
- A block naming an input the file’s
spec:header does not declare, inline or throughspec:include, fails the parse, as on GitLab:unknown interpolation provided: `typo` in `inputs.typo`. Each file with a header is checked against its own, the root pipeline’s and every included file’s alike. Each file is interpolated once, against its own header only: the root pipeline’s inputs never reach an included file. A file with nospec:header, the root pipeline or an included one, is not interpolated at all, so its blocks stay as written even when the root declares the input they name, and even when GitLab would refuse the block in a file with a header (an index out of range, an unknown function). A single-document file with a top-levelspec:key and no---has no header either: itsspec:is an ordinary top-level key, which GitLab refuses as one that is no job, and so does glci (see Validation). This holds on both routes, offline and underGLCI_PREFER_API=1, where an unknown interpolation in the root file, or in a local include glci inlines, is reported before anything is sent to the Lint API. glci used to fill the root pipeline’s inputs into an included file with no header of its own, where GitLab leaves the block literal; to pass a value into an included file, give it aspec:header and pass the value through the include entry’sinputs:. - A block in a YAML comment or in the
spec:header is never evaluated. An input rule’sif:reads other inputs through rule evaluation, described above, not through substitution.
Array elements#
A block can read one element of an array input with [N], counting from 0, and reach further into nested arrays and into hashes:
spec:
inputs:
arr:
type: array
default: [x, y, z]
platforms:
type: array
default: [[amd64, arm64], {name: riscv, tags: [rv64]}]
---
job-$[[ inputs.arr[1] ]]:
script:
- echo $[[ inputs.arr[0] ]]
- echo $[[ inputs.platforms[0][1] ]] $[[ inputs.platforms[1].name ]] $[[ inputs.platforms[1].tags[0] ]]
This makes one job, job-y, running echo x and echo arm64 riscv rv64.
- A segment takes up to five indices (
[0][1][0]), and a.keyafter one reads a hash element. An access splits into at most five dot-separated parts, as on GitLab, so the last part keeps any dots it holds. - The element keeps its type. A block that is the whole value becomes the element itself: a nested array is a list, spliced into a sequence such as
script:like any other list, a hash is a mapping, and a number stays a number. Inside other text it reads as Ruby prints it: a nested array as["a", "b"],nullas nothing. A hash reads as the Ruby GitLab runs (3.3) prints it,{:name=>"riscv", :tags=>["rv64"]}, except that glci sorts its keys where GitLab keeps their written order. - A string element is a string, so the functions accept it:
$[[ inputs.arr[0] | posix_escape ]]works where$[[ inputs.arr | posix_escape ]]does not. - Leading zeros are ignored, so
[01]is[1]. A negative index, a non-numeric one and spaces inside the brackets are not indices. - Indexing works where a block is substituted, not in a
spec: inputs:rule’sif:, which takes only$[[ inputs.name ]], as on GitLab. - Each of these fails the parse with GitLab’s message, rather than leaving the block in the job. glci prefixes each message with the block it came from, as for functions:
| Access | Error |
|---|---|
inputs.arr[3] | array index 3 out of bounds (size: 3) in `inputs.arr[3]` |
inputs.name[0] for a string, number or boolean input, or an index into an element that is not an array | cannot index into non-array value at [0] in `inputs.name[0]` |
inputs.arr[-1], inputs.arr[a], inputs.arr[] | invalid array index in `inputs.arr[-1]`: `-1` is not a valid index |
inputs.arr[0, or a decimal such as inputs.arr[1.5] (the access splits on . first) | invalid array index in `inputs.arr[0`: missing closing bracket |
inputs.[0] | invalid indexed access without a key in `inputs.[0]` |
inputs[0].arr | cannot index into non-array value at [0] in `inputs[0].arr` |
inputs, alone | invalid pattern used for interpolation. valid pattern is $[[ inputs.input ]] |
inputs.arr[0]x, or inputs.my-list[0] for a name with a hyphen | invalid array index syntax in `inputs.arr[0]x` |
inputs.arr[0][0][0][0][0][0] | too many array indices in `inputs.arr[0][0][0][0][0][0]` (maximum depth: 5) |
inputs.arr.first, or a key a hash element lacks | unknown interpolation provided: `first` in `inputs.arr.first` |
| an access longer than 1024 bytes | maximum interpolation expression size exceeded |
An input name containing a hyphen can be used whole ($[[ inputs.my-list ]]) but not indexed, on GitLab or in glci. A block is closed by the first ]], so $[[ inputs.arr[0]]] reads as inputs.arr[0 followed by a ]: leave a space before the closing brackets.
Functions#
An interpolation block can pipe its value through up to three functions, applied in the order written:
spec:
inputs:
variant:
default: '$IMAGE_FLAVOUR'
runner_tags:
default: 'docker, linux'
message:
default: "it's done"
---
.base::image-sha:
image: example/img:sha
build:
extends: .base::image-$[[ inputs.variant | expand_vars ]]
tags: $[[ inputs.runner_tags | split(',') ]]
script:
- echo $[[ inputs.message | posix_escape ]]
Run with --env IMAGE_FLAVOUR=sha, build extends .base::image-sha, gets the docker and linux tags, and runs echo it\'s\ done.
| Function | Result |
|---|---|
expand_vars | Expands $VAR and ${VAR} references. A variable it cannot find is left as written. |
truncate(<offset>,<length>) | The length characters starting at offset; empty when offset is past the end. |
posix_escape | The value escaped for a POSIX shell, so it reaches the command as one word. |
split('<separator>') | A list: the value split on separator, each element trimmed, empty ones dropped. split(' ') splits on any run of whitespace. Inside other text the list reads as Ruby prints it, ["a", "b"]. |
- In the root pipeline and the files it includes,
expand_varssees the variables GitLab allows ininclude:- the predefined server variables (CI_SERVER_FQDN,CI_SERVER_HOST,CI_SERVER_URL,CI_SERVER_PROTOCOL,CI_SERVER_PORT), the project and pipeline predefined variables of the simulated context (CI_PROJECT_*,CI_COMMIT_REF_NAME,CI_PIPELINE_SOURCEand the like), and over them the CI/CD variables you pass with--env,--env-file,.glci.envor a preset. The globalvariables:block is not among them, so a variable defined only there is left unexpanded, as GitLab does. Job variables such asCI_JOB_IDare not either, on GitLab or in glci. - Variables fetched from the GitLab API are not available to a root pipeline’s
expand_varsyet, so those stay as written. Pass any you need with--envor.glci.env, as for a variable in aninclude:path. - In a
trigger:child or cross-project pipeline,expand_varsreads the wider set described under Child and cross-project pipelines: the predefinedCI_*variables, the variables fetched from the API and the variables the trigger job forwards, under your local layers. A masked API variable is refused there too, but a forwarded variable is not masked, even one set from a masked parent variable, as on GitLab. - A masked variable - named by
--maskor a preset’smasked:list, with a value GitLab would accept for masking - is refused, as on GitLab:error in `expand_vars` function: variable expansion error: masked variables cannot be expanded.--unmaskdoes not change that, since it only affects what is displayed. - On the lint-API route (
GLCI_PREFER_API=1, or the fallback when offline parsing fails) the interpolated configuration is sent to your GitLab instance’s lint API, including any valuesexpand_varstook from--env,--env-file,.glci.envor a preset. posix_escapeis not a security boundary, which GitLab also points out - do not rely on it to make untrusted input safe.- Every function takes a string: a
stringinput, or a string element of anarrayinput such asinputs.arr[0]. Using one on aboolean,numberor wholearrayinput, or on an element that is not a string, fails the parse. splithas to be the last function in the chain, since it returns a list rather than a string.- An unknown function, more than three functions, a
splitthat is not last, or an emptysplitseparator fails the parse with GitLab’s error message. Several errors in one block are reported together, comma-separated, up to three. glci prefixes the message with the block it came from, which GitLab does not:
CI configuration is invalid: parsing CI config: interpolating pipeline inputs: `$[[ inputs.message | upcase ]]`: no function matching `upcase`: check that the function name, arguments, and types are correct
A block is closed by the first ]], even one inside a quoted argument, so split(']]') is not a valid function on GitLab or in glci.
Validation#
glci validates inputs before starting the pipeline:
Known names:
--inputand--inputs-filemay name only inputs the root file’sspec:header declares, inline or throughspec: include:. An undeclared name fails the parse with GitLab’s error, naming the root file by its path in the repository, rather than being dropped while the input it was meant for takes its default:CI configuration is invalid: parsing CI config: `.gitlab-ci.yml`: unknown input arguments: enviroment. It is checked before the inputs are resolved, so a misspelt name is not mistaken for the required input it was meant to supply, and it is reported on its own, where GitLab also appends the errors of the other inputs. Several names are listed together, sorted.A header to declare them: inputs for a root file with no
spec:header, which used to be ignored, fail withGiven inputs not defined in the `spec` section of the included configuration file. A header is aspec:document followed by---and the body. A single-document file with a top-levelspec:key has no header, and for one glci adds why to the message:; a top-level spec: is a header only when a `---` line and the pipeline follow it. Given no inputs, such a file is still refused: itsspec:is a top-level key that is no job, so glci reportsjobs spec config should implement the script:, run:, or trigger: keyword, as GitLab does.Where they apply: both checks apply on every parse route to
glci run(and the TUI run form andglci retry, which send the same request),lint,show,jobs,variables,mergedanddoctor, and to the inputs a cross-project trigger passes to the target project’s CI file. All of them exceptdoctorprintCI configuration is invalid: parsing CI config: ...and exit 1, the code for an invalid configuration (the TUI run form shows it in the run view instead);doctorfails its CI config row. GitLab refuses the pipeline the same way, because it creates a pipeline by including its CI file with the pipeline’s inputs.Input names: an input named by an unquoted
yes,no,on,off,trueorfalse, in any letter case, is a boolean to GitLab and is refused, in aspec:header or aspec: include:file:header:spec:inputs:true key must be an alphanumeric string(header:spec:inputs:input ...for a false one). Quote it to use the word:"on":.Required inputs: Inputs without a
defaultmust be provided. Error messages include the input’sdescriptionif available.Type checking: Boolean inputs refuse anything but a YAML boolean or the text
true/falsewith`flag` input: provided value is not a boolean. See Boolean inputs. Number inputs refuse a value GitLab does not read as a number with`count` input: provided value is not a number(resolved default: `count` input: default value is not a numberfor a default). See Input types.Options: When
options:is declared, the value, and the default too, must be one of them. When the input usesrules:, the matching rule’s options apply. Values are compared the way GitLab compares them, by type rather than by text:- A
stringinput’s value is matched against each option’s text, as Ruby prints it: a YAML3.0option admits3.0, not3. - A
numberinput’s value is read as a number and matched against the options as YAML typed them, sooptions: ["3"](a string) does not admit3, whileoptions: [3.0]does. - An
arrayinput’s value passes when every element is one of the options:["dev", "staging"]passesoptions: [dev, staging, production]. An integer element is not matched by a float option (3againstoptions: [3.0]), as GitLab compares elements strictly. A value that is not an array fails with`list` input: provided value is not an array(default valuefor the default). options: []is still a list of options, and admits no value at all.- A
booleaninput may not declareoptions:. GitLab refuses it, and glci refuses it when parsing, soglci lintreports it:`flag` input: Options can only be used with string, number, and array inputs. The exception is an input whosedefault:has no value: it is never validated until a value is supplied, so it parses and lints clean, and any value supplied for it is refused with the same message. A rule’soptions:are allowed on abooleaninput, and constrain nothing. - A top-level
options:must be a list of at most 50 entries, none of themnull(input "env": options must be a list,cannot define more than 50 options,options array cannot contain null values). A rule’s list may hold anull.options: null, at the top level or in a rule, counts as no options at all.
A value outside the options fails with GitLab’s message, such as
`env` input: `qa` cannot be used because it is not in the list of allowed options. Anumberinput’s message saysthe list of the allowed optionsand shows the value as a number, as GitLab’s does. A failing default is prefixed withresolved default:.- A
An included file or component whose inputs do not resolve fails the parse, naming the include it came from:
CI configuration is invalid: parsing CI config: resolving includes: include local "/ci/comp.yml": resolving inputs: required input "env" not provided
An include’s inputs come only from that include entry’s own inputs: map. --input and --inputs-file reach the root file’s spec: and nothing else, which is also how GitLab behaves.
The entry may supply only inputs the included file declares. An argument its spec: header does not declare, including every argument for a header that declares no inputs, fails the parse with GitLab’s error rather than being dropped while the input it was meant for silently takes its default:
CI configuration is invalid: parsing CI config: resolving includes: include local "/ci/comp.yml": unknown input arguments: enviroment
Several unknown names are listed together, comma-separated. GitLab lists them in the order the entry writes them; glci sorts them alphabetically. An inputs: for a file with no spec: header fails too, with Given inputs not defined in the `spec` section of the included configuration file, and an inputs: that is not a mapping fails with Given inputs must be a hash. A header is a spec: document followed by --- and the body. A single-document file with a top-level spec: key has no header, so it is refused when given inputs, as on GitLab. Included without inputs, it is refused all the same, as its spec: is a top-level key that is no job. Add the ---. An empty inputs: {}, or an inputs: with no value, supplies nothing and is accepted by any file.
These checks apply on every parse route. Under GLCI_PREFER_API=1 (or the Lint API fallback), a local: include that carries inputs: is inlined into the request like any other local include, interpolated with those inputs, so what is checked is the file in your working tree, the includes nested in it as well. A file whose header uses spec: include: is resolved by the offline parser instead.
An entry under rules: is checked only when its rules keep it, on both routes, since GitLab never reads a file whose rules drop it. glci decides those rules itself, against the simulated context, apart from the few the Lint API route leaves for GitLab (see Include rules).
A project: entry that lists several files under file: gives its inputs: to each file, and each is checked and interpolated against its own header, as GitLab does; so is each match of a wildcard local:.
Interactive TUI#
The TUI (glci with no subcommand) shows an input form with descriptions and defaults pre-filled. Required inputs are highlighted and validated before submission.
On a boolean field, Enter sets the value to false when it is true, and to true otherwise, so a field holding yes or TRUE becomes true. A value other than true or false is shown with GitLab’s error below the field. A boolean or number field left empty supplies no value, so the input takes its default, or fails as a missing required input.
An input whose default/options come from rules: is shown blank and unmarked: the form does not evaluate the rules, so nothing is pre-filled and the matching rule’s options: are not enforced there. They are still enforced when the pipeline is resolved, so a value the rule forbids fails the run rather than the form.