Skip to content

API Reference

Structs

AddChildrenProps

Initializer

1
2
3
4
5
6
7
import gcix

gcix.AddChildrenProps(
  jobs_or_job_collections: typing.List[typing.Union[Job, JobCollection]],
  name: str = None,
  stage: str = None
)

Properties

Name Type Description
jobs_or_job_collections typing.List[typing.Union[Job, JobCollection]] No description.
name str No description.
stage str No description.

jobs_or_job_collectionsRequired
jobs_or_job_collections: typing.List[typing.Union[Job, JobCollection]]

nameOptional
name: str
  • Type: str

stageOptional
stage: str
  • Type: str

ArtifactsProps

Initializer

import gcix

gcix.ArtifactsProps(
  excludes: typing.List[str] = None,
  expire_in: str = None,
  expose_as: str = None,
  name: str = None,
  paths: typing.List[str] = None,
  public: bool = None,
  reports: typing.List[ArtifactsReport] = None,
  untracked: bool = None,
  when: WhenStatement = None
)

Properties

Name Type Description
excludes typing.List[str] Paths that prevent files from being added to an artifacts archive.
expire_in str How long the artifacts will be saved before it gets deleted.
expose_as str Used to expose artifacts in merge requests.
name str Name of the artifacts archive.
paths typing.List[str] Paths relative to project directory $CI_PROJECT_DIR, found files will be used to create the artifacts.
public bool True makes artifacts public.
reports typing.List[ArtifactsReport] Reports must be a valid dictionary, the key represents a ArtifactsReport and the value must be a valid relativ file path to the reports file.
untracked bool If true adds all untracked file to artifacts archive.
when WhenStatement When to upload artifacts, Only on_success, on_failure or always is allowed.

excludesOptional
excludes: typing.List[str]
  • Type: typing.List[str]

Paths that prevent files from being added to an artifacts archive.


expire_inOptional
expire_in: str
  • Type: str

How long the artifacts will be saved before it gets deleted.


expose_asOptional
expose_as: str
  • Type: str

Used to expose artifacts in merge requests.


nameOptional
name: str
  • Type: str

Name of the artifacts archive.

Internally defaults to {PredefinedVariables.ciJobName}-{PredefinedVariables.ciCommitRefSlug}.


pathsOptional
paths: typing.List[str]
  • Type: typing.List[str]

Paths relative to project directory $CI_PROJECT_DIR, found files will be used to create the artifacts.


publicOptional
public: bool
  • Type: bool

True makes artifacts public.


reportsOptional
reports: typing.List[ArtifactsReport]

Reports must be a valid dictionary, the key represents a ArtifactsReport and the value must be a valid relativ file path to the reports file.


untrackedOptional
untracked: bool
  • Type: bool

If true adds all untracked file to artifacts archive.


whenOptional
when: WhenStatement

When to upload artifacts, Only on_success, on_failure or always is allowed.


ArtifactsReport

Initializer

1
2
3
4
5
6
import gcix

gcix.ArtifactsReport(
  file: str,
  report_type: str
)

Properties

Name Type Description
file str Relative path withing the project, where to find the generated report file.
report_type str https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html ArtifactsReport type to use.

fileRequired
file: str
  • Type: str

Relative path withing the project, where to find the generated report file.


report_typeRequired
report_type: str
  • Type: str

https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html ArtifactsReport type to use.


CacheKeyProps

Initializer

1
2
3
4
5
6
7
import gcix

gcix.CacheKeyProps(
  files: typing.List[str] = None,
  key: str = None,
  prefix: str = None
)

Properties

Name Type Description
files typing.List[str] No description.
key str No description.
prefix str No description.

filesOptional
files: typing.List[str]
  • Type: typing.List[str]

keyOptional
key: str
  • Type: str
  • Default: gcix.PredefinedVariables.ciCommitRefSlug

prefixOptional
prefix: str
  • Type: str

CacheProps

Initializer

1
2
3
4
5
6
7
8
9
import gcix

gcix.CacheProps(
  paths: typing.List[str],
  cache_key: CacheKey = None,
  policy: CachePolicy = None,
  untracked: bool = None,
  when: WhenStatement = None
)

Properties

Name Type Description
paths typing.List[str] No description.
cache_key CacheKey No description.
policy CachePolicy No description.
untracked bool Set the untracked keyword to True to cache all files that are untracked in your Git repository.
when WhenStatement No description.

pathsRequired
paths: typing.List[str]
  • Type: typing.List[str]

cache_keyOptional
cache_key: CacheKey
  • Type: CacheKey
  • Default: to CacheKey with default arguments.

policyOptional
policy: CachePolicy

untrackedOptional
untracked: bool
  • Type: bool

Set the untracked keyword to True to cache all files that are untracked in your Git repository.


whenOptional
when: WhenStatement

ChildDict

Initializer

1
2
3
4
5
6
7
import gcix

gcix.ChildDict(
  child: typing.Union[Job, JobCollection],
  name: str = None,
  stage: str = None
)

Properties

Name Type Description
child typing.Union[Job, JobCollection] No description.
name str No description.
stage str No description.

childRequired
child: typing.Union[Job, JobCollection]

nameOptional
name: str
  • Type: str

stageOptional
stage: str
  • Type: str

ImageProps

Initializer

1
2
3
4
5
6
7
import gcix

gcix.ImageProps(
  name: str,
  entrypoint: typing.List[str] = None,
  tag: str = None
)

Properties

Name Type Description
name str No description.
entrypoint typing.List[str] No description.
tag str No description.

nameRequired
name: str
  • Type: str

entrypointOptional
entrypoint: typing.List[str]
  • Type: typing.List[str]

tagOptional
tag: str
  • Type: str

IncludeArtifactProps

Initializer

1
2
3
4
5
6
import gcix

gcix.IncludeArtifactProps(
  artifact: str,
  job: str
)

Properties

Name Type Description
artifact str Relative path to the artifact which is produced by job.
job str Job name to include the artifact from.

artifactRequired
artifact: str
  • Type: str

Relative path to the artifact which is produced by job.


jobRequired
job: str
  • Type: str

Job name to include the artifact from.


IncludeFileProps

Initializer

1
2
3
4
5
6
7
import gcix

gcix.IncludeFileProps(
  file: str,
  project: str,
  ref: str = None
)

Properties

Name Type Description
file str Relative path to the file to include.
project str Project to include the file from.
ref str Project branch to include the file from.

fileRequired
file: str
  • Type: str

Relative path to the file to include.


projectRequired
project: str
  • Type: str

Project to include the file from.


refOptional
ref: str
  • Type: str

Project branch to include the file from.


IncludeLocalProps

Initializer

1
2
3
4
5
import gcix

gcix.IncludeLocalProps(
  local: str
)

Properties

Name Type Description
local str Relative path to the file within this repository to include.

localRequired
local: str
  • Type: str

Relative path to the file within this repository to include.


IncludeRemoteProps

Initializer

1
2
3
4
5
import gcix

gcix.IncludeRemoteProps(
  remote: str
)

Properties

Name Type Description
remote str URL to include the file from.

remoteRequired
remote: str
  • Type: str

URL to include the file from.


IncludeTemplateProps

Initializer

1
2
3
4
5
import gcix

gcix.IncludeTemplateProps(
  template: str
)

Properties

Name Type Description
template str Gitlab template pipeline to include.

templateRequired
template: str
  • Type: str

Gitlab template pipeline to include.


JobProps

Initializer

import gcix

gcix.JobProps(
  scripts: typing.List[str],
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]] = None,
  artifacts: Artifacts = None,
  cache: Cache = None,
  dependencies: typing.List[typing.Union[Job, JobCollection]] = None,
  image: typing.Union[str, Image] = None,
  name: str = None,
  needs: typing.List[typing.Union[Job, JobCollection, Need]] = None,
  rules: typing.List[Rule] = None,
  stage: str = None,
  tags: typing.List[str] = None,
  variables: typing.Mapping[str] = None
)

Properties

Name Type Description
scripts typing.List[str] No description.
allow_failure typing.Union[bool, typing.List[typing.Union[int, float]]] No description.
artifacts Artifacts No description.
cache Cache No description.
dependencies typing.List[typing.Union[Job, JobCollection]] No description.
image typing.Union[str, Image] No description.
name str No description.
needs typing.List[typing.Union[Job, JobCollection, Need]] No description.
rules typing.List[Rule] No description.
stage str No description.
tags typing.List[str] No description.
variables typing.Mapping[str] No description.

scriptsRequired
scripts: typing.List[str]
  • Type: typing.List[str]

allow_failureOptional
allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

artifactsOptional
artifacts: Artifacts

cacheOptional
cache: Cache

dependenciesOptional
dependencies: typing.List[typing.Union[Job, JobCollection]]

imageOptional
image: typing.Union[str, Image]
  • Type: typing.Union[str, Image]

nameOptional
name: str
  • Type: str

needsOptional
needs: typing.List[typing.Union[Job, JobCollection, Need]]

rulesOptional
rules: typing.List[Rule]
  • Type: typing.List[Rule]

stageOptional
stage: str
  • Type: str

tagsOptional
tags: typing.List[str]
  • Type: typing.List[str]

variablesOptional
variables: typing.Mapping[str]
  • Type: typing.Mapping[str]

NeedProps

Initializer

1
2
3
4
5
6
7
8
9
import gcix

gcix.NeedProps(
  artifacts: bool = None,
  job: str = None,
  pipeline: str = None,
  project: str = None,
  ref: str = None
)

Properties

Name Type Description
artifacts bool No description.
job str No description.
pipeline str No description.
project str No description.
ref str No description.

artifactsOptional
artifacts: bool
  • Type: bool
  • Default: true

jobOptional
job: str
  • Type: str
  • Default: undefined but requires pipeline to be set.

pipelineOptional
pipeline: str
  • Type: str
  • Default: undefined which requires job to be set.

projectOptional
project: str
  • Type: str
  • Default: undefined

refOptional
ref: str
  • Type: str
  • Default: undefined

PipelineProps

Initializer

1
2
3
4
5
import gcix

gcix.PipelineProps(
  includes: typing.List[Include] = None
)

Properties

Name Type Description
includes typing.List[Include] You can add global gcix.Includes to the pipeline. Gitlab CI Documentation: "Use include to include external YAML files in your CI/CD configuration.".

includesOptional
includes: typing.List[Include]

You can add global gcix.Includes to the pipeline. Gitlab CI Documentation: "Use include to include external YAML files in your CI/CD configuration.".


RenderedImage

This module represents the Gitlab CI Image keyword. Use Image to specify a Docker image to use for the gcix.Job.

Instances of this class are intended to be immutable. Image objects are typically defined in a central location and often reused throughout the codebase. Modifying an Image object at one place may result in unexpected changes at any other reference to that object. Therefore, this class does not provide any setter methods to modify its properties directly.

However, you can create an altered copy of an Image object using the .withTag() and .withEntrypoint() methods. These methods return a new Image object with the specified modifications, allowing you to reuse the original Image object while making specific changes for a particular use case.

By following this approach, you can maintain a central repository of Image objects and easily create customized versions as needed, without affecting the original object or introducing unintended side effects.

Initializer

1
2
3
4
5
6
import gcix

gcix.RenderedImage(
  name: str,
  entrypoint: typing.List[str] = None
)

Properties

Name Type Description
name str No description.
entrypoint typing.List[str] No description.

nameRequired
name: str
  • Type: str

entrypointOptional
entrypoint: typing.List[str]
  • Type: typing.List[str]

RenderedIncludeArtifact

Initializer

1
2
3
4
5
6
import gcix

gcix.RenderedIncludeArtifact(
  artifact: str,
  job: str
)

Properties

Name Type Description
artifact str No description.
job str No description.

artifactRequired
artifact: str
  • Type: str

jobRequired
job: str
  • Type: str

RenderedIncludeFile

Initializer

1
2
3
4
5
6
7
import gcix

gcix.RenderedIncludeFile(
  file: str,
  project: str,
  ref: str = None
)

Properties

Name Type Description
file str No description.
project str No description.
ref str No description.

fileRequired
file: str
  • Type: str

projectRequired
project: str
  • Type: str

refOptional
ref: str
  • Type: str

RenderedIncludeLocal

Initializer

1
2
3
4
5
import gcix

gcix.RenderedIncludeLocal(
  local: str
)

Properties

Name Type Description
local str No description.

localRequired
local: str
  • Type: str

RenderedIncludeRemote

Initializer

1
2
3
4
5
import gcix

gcix.RenderedIncludeRemote(
  remote: str
)

Properties

Name Type Description
remote str No description.

remoteRequired
remote: str
  • Type: str

RenderedIncludeTemplate

Initializer

1
2
3
4
5
import gcix

gcix.RenderedIncludeTemplate(
  template: str
)

Properties

Name Type Description
template str No description.

templateRequired
template: str
  • Type: str

RenderedJob

Initializer

1
2
3
import gcix

gcix.RenderedJob()

RuleProps

Initializer

import gcix

gcix.RuleProps(
  allow_failure: bool = None,
  changes: typing.List[str] = None,
  exists: typing.List[str] = None,
  if_statement: str = None,
  variables: typing.Mapping[str] = None,
  when: WhenStatement = None
)

Properties

Name Type Description
allow_failure bool No description.
changes typing.List[str] No description.
exists typing.List[str] No description.
if_statement str No description.
variables typing.Mapping[str] No description.
when WhenStatement No description.

allow_failureOptional
allow_failure: bool
  • Type: bool
  • Default: false

changesOptional
changes: typing.List[str]
  • Type: typing.List[str]

existsOptional
exists: typing.List[str]
  • Type: typing.List[str]

if_statementOptional
if_statement: str
  • Type: str

variablesOptional
variables: typing.Mapping[str]
  • Type: typing.Mapping[str]

whenOptional
when: WhenStatement

ServiceProps

Initializer

1
2
3
4
5
import gcix

gcix.ServiceProps(
  name: str
)

Properties

Name Type Description
name str No description.

nameRequired
name: str
  • Type: str

TriggerJobProps

Initializer

import gcix

gcix.TriggerJobProps(
  branch: str = None,
  includes: typing.List[typing.Union[IncludeLocal, IncludeFile, IncludeRemote, IncludeTemplate, IncludeArtifact]] = None,
  name: str = None,
  project: str = None,
  stage: str = None,
  strategy: str = None
)

Properties

Name Type Description
branch str No description.
includes typing.List[typing.Union[IncludeLocal, IncludeFile, IncludeRemote, IncludeTemplate, IncludeArtifact]] No description.
name str No description.
project str No description.
stage str No description.
strategy str No description.

branchOptional
branch: str
  • Type: str

includesOptional
includes: typing.List[typing.Union[IncludeLocal, IncludeFile, IncludeRemote, IncludeTemplate, IncludeArtifact]]

nameOptional
name: str
  • Type: str

projectOptional
project: str
  • Type: str

stageOptional
stage: str
  • Type: str

strategyOptional
strategy: str
  • Type: str

Classes

Artifacts

This class represents the artifacts keyword.

Gitlab CI documentation: "Use artifacts to specify a list of files and directories that are attached to the gcix.Job when it succeeds, fails, or always. [...] by default, gcix.Jobs in later stages automatically download all the artifacts created by jobs in earlier stages. You can control artifact download behavior in Job's with dependencies."

Initializers

import gcix

gcix.Artifacts(
  excludes: typing.List[str] = None,
  expire_in: str = None,
  expose_as: str = None,
  name: str = None,
  paths: typing.List[str] = None,
  public: bool = None,
  reports: typing.List[ArtifactsReport] = None,
  untracked: bool = None,
  when: WhenStatement = None
)
Name Type Description
excludes typing.List[str] Paths that prevent files from being added to an artifacts archive.
expire_in str How long the artifacts will be saved before it gets deleted.
expose_as str Used to expose artifacts in merge requests.
name str Name of the artifacts archive.
paths typing.List[str] Paths relative to project directory $CI_PROJECT_DIR, found files will be used to create the artifacts.
public bool True makes artifacts public.
reports typing.List[ArtifactsReport] Reports must be a valid dictionary, the key represents a ArtifactsReport and the value must be a valid relativ file path to the reports file.
untracked bool If true adds all untracked file to artifacts archive.
when WhenStatement When to upload artifacts, Only on_success, on_failure or always is allowed.

excludesOptional
  • Type: typing.List[str]

Paths that prevent files from being added to an artifacts archive.


expire_inOptional
  • Type: str

How long the artifacts will be saved before it gets deleted.


expose_asOptional
  • Type: str

Used to expose artifacts in merge requests.


nameOptional
  • Type: str

Name of the artifacts archive.

Internally defaults to {PredefinedVariables.ciJobName}-{PredefinedVariables.ciCommitRefSlug}.


pathsOptional
  • Type: typing.List[str]

Paths relative to project directory $CI_PROJECT_DIR, found files will be used to create the artifacts.


publicOptional
  • Type: bool

True makes artifacts public.


reportsOptional

Reports must be a valid dictionary, the key represents a ArtifactsReport and the value must be a valid relativ file path to the reports file.


untrackedOptional
  • Type: bool

If true adds all untracked file to artifacts archive.


whenOptional

When to upload artifacts, Only on_success, on_failure or always is allowed.


Methods

Name Description
add_excludes No description.
add_paths No description.
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

add_excludes
1
2
3
def add_excludes(
  excludes: typing.List[str]
) -> None
excludesRequired
  • Type: typing.List[str]

add_paths
1
2
3
def add_paths(
  paths: typing.List[str]
) -> None
pathsRequired
  • Type: typing.List[str]

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
excludes typing.List[str] No description.
paths typing.List[str] No description.
expire_in str No description.
expose_as str No description.
name str No description.
public bool No description.
reports typing.List[ArtifactsReport] No description.
untracked bool No description.
when WhenStatement No description.
ordered_excludes OrderedStringSet No description.
ordered_paths OrderedStringSet No description.

excludesRequired
excludes: typing.List[str]
  • Type: typing.List[str]

pathsRequired
paths: typing.List[str]
  • Type: typing.List[str]

expire_inOptional
expire_in: str
  • Type: str

expose_asOptional
expose_as: str
  • Type: str

nameOptional
name: str
  • Type: str

publicOptional
public: bool
  • Type: bool

reportsOptional
reports: typing.List[ArtifactsReport]

untrackedOptional
untracked: bool
  • Type: bool

whenOptional
when: WhenStatement

ordered_excludesRequired
ordered_excludes: OrderedStringSet

ordered_pathsRequired
ordered_paths: OrderedStringSet

Cache

This class represents the cache keyword.

Gitlab CI documentation:

"Use cache to specify a list of files and directories to cache between gcix.Jobs. [...] Caching is shared between gcix.Pipelines and gcix.Jobs. Caches are restored before artifacts."

Initializers

1
2
3
4
5
6
7
8
9
import gcix

gcix.Cache(
  paths: typing.List[str],
  cache_key: CacheKey = None,
  policy: CachePolicy = None,
  untracked: bool = None,
  when: WhenStatement = None
)
Name Type Description
paths typing.List[str] No description.
cache_key CacheKey No description.
policy CachePolicy No description.
untracked bool Set the untracked keyword to True to cache all files that are untracked in your Git repository.
when WhenStatement No description.

pathsRequired
  • Type: typing.List[str]

cache_keyOptional
  • Type: CacheKey
  • Default: to CacheKey with default arguments.

policyOptional

untrackedOptional
  • Type: bool

Set the untracked keyword to True to cache all files that are untracked in your Git repository.


whenOptional

Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
cache_key CacheKey No description.
paths typing.List[str] No description.
policy CachePolicy No description.
untracked bool No description.
when WhenStatement No description.

cache_keyRequired
cache_key: CacheKey

pathsRequired
paths: typing.List[str]
  • Type: typing.List[str]

policyOptional
policy: CachePolicy

untrackedOptional
untracked: bool
  • Type: bool

whenOptional
when: WhenStatement

CacheKey

This class represents the cache:key keyword.

Gitlab CI documentation: "The key keyword defines the affinity of caching between jobs. You can have a single cache for all jobs, cache per-job, cache per-branch, or any other way that fits your workflow."

Initializers

1
2
3
4
5
6
7
import gcix

gcix.CacheKey(
  files: typing.List[str] = None,
  key: str = None,
  prefix: str = None
)
Name Type Description
files typing.List[str] No description.
key str No description.
prefix str No description.

filesOptional
  • Type: typing.List[str]

keyOptional
  • Type: str
  • Default: gcix.PredefinedVariables.ciCommitRefSlug

prefixOptional
  • Type: str

Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
files typing.List[str] No description.
key str No description.
prefix str No description.

filesOptional
files: typing.List[str]
  • Type: typing.List[str]

keyOptional
key: str
  • Type: str

prefixOptional
prefix: str
  • Type: str

Image

Initializers

1
2
3
4
5
6
7
import gcix

gcix.Image(
  name: str,
  entrypoint: typing.List[str] = None,
  tag: str = None
)
Name Type Description
name str No description.
entrypoint typing.List[str] No description.
tag str No description.

nameRequired
  • Type: str

entrypointOptional
  • Type: typing.List[str]

tagOptional
  • Type: str

Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.
with_entrypoint No description.
with_tag No description.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

with_entrypoint
1
2
3
def with_entrypoint(
  entrypoint: typing.List[str]
) -> Image
entrypointRequired
  • Type: typing.List[str]

with_tag
1
2
3
def with_tag(
  tag: str
) -> Image
tagRequired
  • Type: str

Properties

Name Type Description
name str No description.
entrypoint typing.List[str] No description.
tag str No description.

nameRequired
name: str
  • Type: str

entrypointOptional
entrypoint: typing.List[str]
  • Type: typing.List[str]

tagOptional
tag: str
  • Type: str

Include

This is just an abstract superclass.

Please use one of the subclasses:

  • IncludeLocal
  • IncludeFile
  • IncludeRemote
  • IncludeTemplate
  • IncludeArtifact

Initializers

1
2
3
import gcix

gcix.Include()
Name Type Description

Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
rendered typing.Any No description.

renderedRequired
rendered: typing.Any
  • Type: typing.Any

IncludeArtifact

Initializers

1
2
3
4
5
6
import gcix

gcix.IncludeArtifact(
  artifact: str,
  job: str
)
Name Type Description
artifact str Relative path to the artifact which is produced by job.
job str Job name to include the artifact from.

artifactRequired
  • Type: str

Relative path to the artifact which is produced by job.


jobRequired
  • Type: str

Job name to include the artifact from.


Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
rendered typing.Any No description.

renderedRequired
rendered: typing.Any
  • Type: typing.Any

IncludeFile

This module represents the Gitlab CI include:file keyword.

Initializers

1
2
3
4
5
6
7
import gcix

gcix.IncludeFile(
  file: str,
  project: str,
  ref: str = None
)
Name Type Description
file str Relative path to the file to include.
project str Project to include the file from.
ref str Project branch to include the file from.

fileRequired
  • Type: str

Relative path to the file to include.


projectRequired
  • Type: str

Project to include the file from.


refOptional
  • Type: str

Project branch to include the file from.


Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
rendered typing.Any No description.

renderedRequired
rendered: typing.Any
  • Type: typing.Any

IncludeLocal

This module represents the Gitlab CI include:local keyword.

Initializers

1
2
3
4
5
import gcix

gcix.IncludeLocal(
  local: str
)
Name Type Description
local str Relative path to the file within this repository to include.

localRequired
  • Type: str

Relative path to the file within this repository to include.


Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
rendered typing.Any No description.

renderedRequired
rendered: typing.Any
  • Type: typing.Any

IncludeRemote

Initializers

1
2
3
4
5
import gcix

gcix.IncludeRemote(
  remote: str
)
Name Type Description
remote str URL to include the file from.

remoteRequired
  • Type: str

URL to include the file from.


Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
rendered typing.Any No description.

renderedRequired
rendered: typing.Any
  • Type: typing.Any

IncludeTemplate

Initializers

1
2
3
4
5
import gcix

gcix.IncludeTemplate(
  template: str
)
Name Type Description
template str Gitlab template pipeline to include.

templateRequired
  • Type: str

Gitlab template pipeline to include.


Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
rendered typing.Any No description.

renderedRequired
rendered: typing.Any
  • Type: typing.Any

Job

This class represents the Gitlab CI Job.

Initializers

import gcix

gcix.Job(
  scripts: typing.List[str],
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]] = None,
  artifacts: Artifacts = None,
  cache: Cache = None,
  dependencies: typing.List[typing.Union[Job, JobCollection]] = None,
  image: typing.Union[str, Image] = None,
  name: str = None,
  needs: typing.List[typing.Union[Job, JobCollection, Need]] = None,
  rules: typing.List[Rule] = None,
  stage: str = None,
  tags: typing.List[str] = None,
  variables: typing.Mapping[str] = None
)
Name Type Description
scripts typing.List[str] No description.
allow_failure typing.Union[bool, typing.List[typing.Union[int, float]]] No description.
artifacts Artifacts No description.
cache Cache No description.
dependencies typing.List[typing.Union[Job, JobCollection]] No description.
image typing.Union[str, Image] No description.
name str No description.
needs typing.List[typing.Union[Job, JobCollection, Need]] No description.
rules typing.List[Rule] No description.
stage str No description.
tags typing.List[str] No description.
variables typing.Mapping[str] No description.

scriptsRequired
  • Type: typing.List[str]

allow_failureOptional
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

artifactsOptional

cacheOptional

dependenciesOptional

imageOptional
  • Type: typing.Union[str, Image]

nameOptional
  • Type: str

needsOptional

rulesOptional
  • Type: typing.List[Rule]

stageOptional
  • Type: str

tagsOptional
  • Type: typing.List[str]

variablesOptional
  • Type: typing.Mapping[str]

Methods

Name Description
add_dependencies No description.
add_needs No description.
add_parent This method is called by gcix.JobCollections when the job is added to that JobCollection.
add_tags No description.
add_variables No description.
append_rules No description.
append_scripts No description.
assign_allow_failure No description.
assign_artifacts No description.
assign_cache No description.
assign_dependencies No description.
assign_image Sets the image of this job.
assign_needs No description.
assign_tags No description.
copy Returns an independent, deep copy object of this job.
extend_name This method is used by gcix.JobCollections to populate the jobs name.
extend_stage This method is used by gcix.JobCollections to populate the jobs name and stage.
extend_stage_value This method is used by gcix.JobCollections to populate the jobs stage.
get_all_instance_names Return all instance names from the given child.
is_equal isEqual checks if this object is equal to given object.
prepend_rules No description.
prepend_scripts No description.
render Returns a representation of any object which implements IBase.

add_dependencies
1
2
3
def add_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
dependenciesRequired

add_needs
1
2
3
def add_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
needsRequired

add_parent
1
2
3
def add_parent(
  parent: typing.Union[Job, JobCollection]
) -> None

This method is called by gcix.JobCollections when the job is added to that JobCollection.

The job needs to know its parents when getAllInstanceNames() is called.

parentRequired

add_tags
1
2
3
def add_tags(
  tags: typing.List[str]
) -> Job
tagsRequired
  • Type: typing.List[str]

add_variables
1
2
3
def add_variables(
  variables: typing.Mapping[str]
) -> Job
variablesRequired
  • Type: typing.Mapping[str]

append_rules
1
2
3
def append_rules(
  rules: typing.List[Rule]
) -> Job
rulesRequired
  • Type: typing.List[Rule]

append_scripts
1
2
3
def append_scripts(
  scripts: typing.List[str]
) -> Job
scriptsRequired
  • Type: typing.List[str]

assign_allow_failure
1
2
3
def assign_allow_failure(
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
) -> Job
allow_failureRequired
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

assign_artifacts
1
2
3
def assign_artifacts(
  artifacts: Artifacts
) -> Job
artifactsRequired

assign_cache
1
2
3
def assign_cache(
  cache: Cache
) -> Job
cacheRequired

assign_dependencies
1
2
3
def assign_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
dependenciesRequired

assign_image
1
2
3
def assign_image(
  image: typing.Union[str, Image]
) -> Job

Sets the image of this job.

For a simple container image you can provide the origin of the image. If you want to set the entrypoint, you have to provide an Image object instead.

!! Any previous values will be overwritten.

imageRequired
  • Type: typing.Union[str, Image]

assign_needs
1
2
3
def assign_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
needsRequired

assign_tags
1
2
3
def assign_tags(
  tags: typing.List[str]
) -> Job
tagsRequired
  • Type: typing.List[str]

copy
def copy() -> Job

Returns an independent, deep copy object of this job.

extend_name
1
2
3
def extend_name(
  name: str
) -> None

This method is used by gcix.JobCollections to populate the jobs name.

nameRequired
  • Type: str

extend_stage
1
2
3
def extend_stage(
  stage: str
) -> None

This method is used by gcix.JobCollections to populate the jobs name and stage.

stageRequired
  • Type: str

extend_stage_value
1
2
3
def extend_stage_value(
  stage: str
) -> None

This method is used by gcix.JobCollections to populate the jobs stage.

stageRequired
  • Type: str

get_all_instance_names
1
2
3
def get_all_instance_names(
  child: typing.Union[Job, JobCollection] = None
) -> OrderedStringSet

Return all instance names from the given child.

That means all combinations of the childs name and stage within this sequence and all parent sequences.

childOptional

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

prepend_rules
1
2
3
def prepend_rules(
  rules: typing.List[Rule]
) -> Job
rulesRequired
  • Type: typing.List[Rule]

prepend_scripts
1
2
3
def prepend_scripts(
  scripts: typing.List[str]
) -> Job
scriptsRequired
  • Type: typing.List[str]

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
tags typing.List[str] Getter method to receive added tags.
allow_failure typing.Union[str, bool, typing.List[typing.Union[int, float]]] No description.
name str No description.
ordered_tags OrderedStringSet No description.
parents typing.List[typing.Union[Job, JobCollection]] No description.
scripts typing.List[str] No description.
stage str No description.
artifacts Artifacts No description.
cache Cache No description.
dependencies typing.List[typing.Union[Job, JobCollection, Need]] No description.
image Image No description.
needs typing.List[typing.Union[Job, JobCollection, Need]] No description.
original Job No description.
rules typing.List[Rule] No description.
variables typing.Mapping[str] No description.

tagsRequired
tags: typing.List[str]
  • Type: typing.List[str]

Getter method to receive added tags.


allow_failureRequired
allow_failure: typing.Union[str, bool, typing.List[typing.Union[int, float]]]
  • Type: typing.Union[str, bool, typing.List[typing.Union[int, float]]]

nameRequired
name: str
  • Type: str

ordered_tagsRequired
ordered_tags: OrderedStringSet

parentsRequired
parents: typing.List[typing.Union[Job, JobCollection]]

scriptsRequired
scripts: typing.List[str]
  • Type: typing.List[str]

stageRequired
stage: str
  • Type: str

artifactsOptional
artifacts: Artifacts

cacheOptional
cache: Cache

dependenciesOptional
dependencies: typing.List[typing.Union[Job, JobCollection, Need]]

imageOptional
image: Image

needsOptional
needs: typing.List[typing.Union[Job, JobCollection, Need]]

originalOptional
original: Job

rulesOptional
rules: typing.List[Rule]
  • Type: typing.List[Rule]

variablesOptional
variables: typing.Mapping[str]
  • Type: typing.Mapping[str]

JobCollection

A JobCollection collects multiple gcix.Jobs and/or other gcix.JobCollections into a group.

Initializers

1
2
3
import gcix

gcix.JobCollection()
Name Type Description

Methods

Name Description
add_children Add gcix.Jobs or other gcix.JobCollections to this JobCollection.
add_dependencies No description.
add_needs No description.
add_parent No description.
add_tags No description.
add_variables No description.
append_rules No description.
append_scripts No description.
assign_artifacts No description.
assign_cache No description.
get_all_instance_names Return all instance names from the given child.
initialize_allow_failure Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection that haven't been set the allowFailure before.
initialize_artifacts Sets gcix.Job.artifacts to all jobs within this JobCollection that haven't been set the artifacs before.
initialize_cache Calling gcix.Job.assigneCache() to all jobs within this JobCollection that haven't been set the cache before.
initialize_dependencies Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection that haven't been added dependencies before.
initialize_image Calling gcix.Job.assignImage() to all jobs within this JobCollection.
initialize_needs Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection that haven't been added needs before.
initialize_rules Calling gcix.Job.append_rules() to all jobs within this JobCollection that haven't been added rules before.
initialize_tags Calling gcix.Job.addTags([...]) to all jobs within this JobCollection that haven't been added tags before.
initialize_variables Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection that haven't been added variables before.
is_equal isEqual checks if this object is equal to given object.
override_allow_failure Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection overriding any previous set value.
override_dependencies Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection and overriding any previously added dependencies to that jobs.
override_image Calling gcix.Job.assignImage() to all jobs within this JobCollection overriding any previous set value.
override_needs Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection and overriding any previously added needs to that jobs.
override_rules Calling gcix.Job.overrideRules() to all jobs within this JobCollection and overriding any previously added rules to that jobs.
override_tags Calling gcix.Job.addTags([...]) to all jobs within this JobCollection and overriding any previously added tags to that jobs.
override_variables Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection and overriding any previously added variables to that jobs.
prepend_rules No description.
prepend_scripts No description.
render Returns a representation of any object which implements IBase.

add_children
1
2
3
4
5
def add_children(
  jobs_or_job_collections: typing.List[typing.Union[Job, JobCollection]],
  name: str = None,
  stage: str = None
) -> JobCollection

Add gcix.Jobs or other gcix.JobCollections to this JobCollection.

Adding a child creates a copy of that child. You should provide a name or stage when adding children, to make them different from other places where they will be used.

jobs_or_job_collectionsRequired

nameOptional
  • Type: str

stageOptional
  • Type: str

add_dependencies
1
2
3
def add_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection
dependenciesRequired

add_needs
1
2
3
def add_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection
needsRequired

add_parent
1
2
3
def add_parent(
  parent: JobCollection
) -> None
parentRequired

add_tags
1
2
3
def add_tags(
  tags: typing.List[str]
) -> JobCollection
tagsRequired
  • Type: typing.List[str]

add_variables
1
2
3
def add_variables(
  variables: typing.Mapping[str]
) -> JobCollection
variablesRequired
  • Type: typing.Mapping[str]

append_rules
1
2
3
def append_rules(
  rules: typing.List[Rule]
) -> JobCollection
rulesRequired
  • Type: typing.List[Rule]

append_scripts
1
2
3
def append_scripts(
  scripts: typing.List[str]
) -> JobCollection
scriptsRequired
  • Type: typing.List[str]

assign_artifacts
1
2
3
def assign_artifacts(
  artifacts: Artifacts
) -> JobCollection
artifactsRequired

assign_cache
1
2
3
def assign_cache(
  cache: Cache
) -> JobCollection
cacheRequired

get_all_instance_names
1
2
3
def get_all_instance_names(
  child: typing.Union[Job, JobCollection] = None
) -> OrderedStringSet

Return all instance names from the given child.

That means all combinations of the childs name and stage within this JobCollection and all parent JobCollection's.

childOptional

initialize_allow_failure
1
2
3
def initialize_allow_failure(
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
) -> JobCollection

Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection that haven't been set the allowFailure before.

allow_failureRequired
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

initialize_artifacts
1
2
3
def initialize_artifacts(
  artifacts: Artifacts
) -> JobCollection

Sets gcix.Job.artifacts to all jobs within this JobCollection that haven't been set the artifacs before.

artifactsRequired

initialize_cache
1
2
3
def initialize_cache(
  cache: Cache
) -> JobCollection

Calling gcix.Job.assigneCache() to all jobs within this JobCollection that haven't been set the cache before.

cacheRequired

initialize_dependencies
1
2
3
def initialize_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection that haven't been added dependencies before.

An empty parameter list means that jobs will get an empty dependency list and thus does not download artifacts by default.

dependenciesRequired

initialize_image
1
2
3
def initialize_image(
  image: typing.Union[str, Image]
) -> JobCollection

Calling gcix.Job.assignImage() to all jobs within this JobCollection.

imageRequired
  • Type: typing.Union[str, Image]

initialize_needs
1
2
3
def initialize_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection that haven't been added needs before.

An empty parameter list means that jobs will get an empty dependency list and thus does not depend on other jobs by default.

needsRequired

initialize_rules
1
2
3
def initialize_rules(
  rules: typing.List[Rule]
) -> JobCollection

Calling gcix.Job.append_rules() to all jobs within this JobCollection that haven't been added rules before.

rulesRequired
  • Type: typing.List[Rule]

initialize_tags
1
2
3
def initialize_tags(
  tags: typing.List[str]
) -> JobCollection

Calling gcix.Job.addTags([...]) to all jobs within this JobCollection that haven't been added tags before.

tagsRequired
  • Type: typing.List[str]

initialize_variables
1
2
3
def initialize_variables(
  variables: typing.Mapping[str]
) -> JobCollection

Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection that haven't been added variables before.

variablesRequired
  • Type: typing.Mapping[str]

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

override_allow_failure
1
2
3
def override_allow_failure(
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
) -> JobCollection

Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection overriding any previous set value.

allow_failureRequired
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

override_dependencies
1
2
3
def override_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection and overriding any previously added dependencies to that jobs.

An empty parameter list means that jobs will get an empty dependency list and thus does not download artifacts.

dependenciesRequired

override_image
1
2
3
def override_image(
  image: typing.Union[str, Image]
) -> JobCollection

Calling gcix.Job.assignImage() to all jobs within this JobCollection overriding any previous set value.

imageRequired
  • Type: typing.Union[str, Image]

override_needs
1
2
3
def override_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection and overriding any previously added needs to that jobs.

An empty parameter list means that jobs will get an empty dependency list and thus does not depend on other jobs.

needsRequired

override_rules
1
2
3
def override_rules(
  rules: typing.List[Rule]
) -> JobCollection

Calling gcix.Job.overrideRules() to all jobs within this JobCollection and overriding any previously added rules to that jobs.

rulesRequired
  • Type: typing.List[Rule]

override_tags
1
2
3
def override_tags(
  tags: typing.List[str]
) -> JobCollection

Calling gcix.Job.addTags([...]) to all jobs within this JobCollection and overriding any previously added tags to that jobs.

tagsRequired
  • Type: typing.List[str]

override_variables
1
2
3
def override_variables(
  variables: typing.Mapping[str]
) -> JobCollection

Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection and overriding any previously added variables to that jobs.

variablesRequired
  • Type: typing.Mapping[str]

prepend_rules
1
2
3
def prepend_rules(
  rules: typing.List[Rule]
) -> JobCollection
rulesRequired
  • Type: typing.List[Rule]

prepend_scripts
1
2
3
def prepend_scripts(
  scripts: typing.List[str]
) -> JobCollection
scriptsRequired
  • Type: typing.List[str]

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
last_jobs_executed typing.List[Job] This property returns all Jobs from the last stage of this JobCollection.
nested_jobs typing.List[Job] No description.
populated_jobs typing.List[Job] Returns a list with populated copies of all nested jobs of this JobCollection.
children typing.List[ChildDict] No description.
ordered_tags OrderedStringSet No description.
ordered_tags_for_initialization OrderedStringSet No description.
ordered_tags_for_replacement OrderedStringSet No description.
parents typing.List[typing.Union[Job, JobCollection]] No description.
allow_failure_for_initialization typing.Union[str, bool, typing.List[typing.Union[int, float]]] No description.
allow_failure_for_replacement typing.Union[str, bool, typing.List[typing.Union[int, float]]] No description.
artifacts Artifacts No description.
artifacts_for_initialization Artifacts No description.
artifacts_for_replacement Artifacts No description.
cache Cache No description.
cache_for_initialization Cache No description.
dependencies typing.List[typing.Union[Job, JobCollection, Need]] No description.
dependencies_for_initialization typing.List[typing.Union[Job, JobCollection, Need]] No description.
dependencies_for_replacement typing.List[typing.Union[Job, JobCollection, Need]] No description.
image_for_initialization typing.Union[str, Image] No description.
image_for_replacement typing.Union[str, Image] No description.
needs typing.List[typing.Union[Job, JobCollection, Need]] No description.
needs_for_initialization typing.List[typing.Union[Job, JobCollection, Need]] No description.
needs_for_replacement typing.List[typing.Union[Job, JobCollection, Need]] No description.
rules_for_initialization typing.List[Rule] No description.
rules_for_replacement typing.List[Rule] No description.
rules_to_append typing.List[Rule] No description.
rules_to_prepend typing.List[Rule] No description.
scripts_to_append typing.List[str] No description.
scripts_to_prepend typing.List[str] No description.
variables typing.Mapping[str] No description.
variables_for_initialization typing.Mapping[str] No description.
variables_for_replacement typing.Mapping[str] No description.

last_jobs_executedRequired
last_jobs_executed: typing.List[Job]
  • Type: typing.List[Job]

This property returns all Jobs from the last stage of this JobCollection.

This is typically be requested from a job which has setup this JobCollection as need, to determine all actual jobs of this JobCollection as need.


nested_jobsRequired
nested_jobs: typing.List[Job]
  • Type: typing.List[Job]

populated_jobsRequired
populated_jobs: typing.List[Job]
  • Type: typing.List[Job]

Returns a list with populated copies of all nested jobs of this JobCollection.

Populated means, that all attributes of a Job which depends on its context are resolved to their final values. The context is primarily the JobCollection within the jobs resides but also dependencies to other jobs and JobCollection's. Thus this JobCollection will apply its own configuration, like variables to add, tags to set, etc., to all its jobs and JobCollection's.

Copies means what it says, that the returned job are not the same job objects, originally added to this JobCollection, but copies of them.

Nested means, that also jobs from JobCollection's within this JobCollection, are returned, as well as jobs from JobCollection's within JobCollection's within this JobCollection and so on.


childrenRequired
children: typing.List[ChildDict]

ordered_tagsRequired
ordered_tags: OrderedStringSet

ordered_tags_for_initializationRequired
ordered_tags_for_initialization: OrderedStringSet

ordered_tags_for_replacementRequired
ordered_tags_for_replacement: OrderedStringSet

parentsRequired
parents: typing.List[typing.Union[Job, JobCollection]]

allow_failure_for_initializationOptional
allow_failure_for_initialization: typing.Union[str, bool, typing.List[typing.Union[int, float]]]
  • Type: typing.Union[str, bool, typing.List[typing.Union[int, float]]]

allow_failure_for_replacementOptional
allow_failure_for_replacement: typing.Union[str, bool, typing.List[typing.Union[int, float]]]
  • Type: typing.Union[str, bool, typing.List[typing.Union[int, float]]]

artifactsOptional
artifacts: Artifacts

artifacts_for_initializationOptional
artifacts_for_initialization: Artifacts

artifacts_for_replacementOptional
artifacts_for_replacement: Artifacts

cacheOptional
cache: Cache

cache_for_initializationOptional
cache_for_initialization: Cache

dependenciesOptional
dependencies: typing.List[typing.Union[Job, JobCollection, Need]]

dependencies_for_initializationOptional
dependencies_for_initialization: typing.List[typing.Union[Job, JobCollection, Need]]

dependencies_for_replacementOptional
dependencies_for_replacement: typing.List[typing.Union[Job, JobCollection, Need]]

image_for_initializationOptional
image_for_initialization: typing.Union[str, Image]
  • Type: typing.Union[str, Image]

image_for_replacementOptional
image_for_replacement: typing.Union[str, Image]
  • Type: typing.Union[str, Image]

needsOptional
needs: typing.List[typing.Union[Job, JobCollection, Need]]

needs_for_initializationOptional
needs_for_initialization: typing.List[typing.Union[Job, JobCollection, Need]]

needs_for_replacementOptional
needs_for_replacement: typing.List[typing.Union[Job, JobCollection, Need]]

rules_for_initializationOptional
rules_for_initialization: typing.List[Rule]
  • Type: typing.List[Rule]

rules_for_replacementOptional
rules_for_replacement: typing.List[Rule]
  • Type: typing.List[Rule]

rules_to_appendOptional
rules_to_append: typing.List[Rule]
  • Type: typing.List[Rule]

rules_to_prependOptional
rules_to_prepend: typing.List[Rule]
  • Type: typing.List[Rule]

scripts_to_appendOptional
scripts_to_append: typing.List[str]
  • Type: typing.List[str]

scripts_to_prependOptional
scripts_to_prepend: typing.List[str]
  • Type: typing.List[str]

variablesOptional
variables: typing.Mapping[str]
  • Type: typing.Mapping[str]

variables_for_initializationOptional
variables_for_initialization: typing.Mapping[str]
  • Type: typing.Mapping[str]

variables_for_replacementOptional
variables_for_replacement: typing.Mapping[str]
  • Type: typing.Mapping[str]

Need

This class represents the Gitlab CI needs keyword. The needs key-word adds a possibility to allow out-of-order Gitlab CI jobs. A job which needed another job runs directly after the other job as finished successfully.

Initializers

1
2
3
4
5
6
7
8
9
import gcix

gcix.Need(
  artifacts: bool = None,
  job: str = None,
  pipeline: str = None,
  project: str = None,
  ref: str = None
)
Name Type Description
artifacts bool No description.
job str No description.
pipeline str No description.
project str No description.
ref str No description.

artifactsOptional
  • Type: bool
  • Default: true

jobOptional
  • Type: str
  • Default: undefined but requires pipeline to be set.

pipelineOptional
  • Type: str
  • Default: undefined which requires job to be set.

projectOptional
  • Type: str
  • Default: undefined

refOptional
  • Type: str
  • Default: undefined

Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
artifacts bool No description.
job str No description.
pipeline str No description.
project str No description.
ref str No description.

artifactsOptional
artifacts: bool
  • Type: bool

jobOptional
job: str
  • Type: str

pipelineOptional
pipeline: str
  • Type: str

projectOptional
project: str
  • Type: str

refOptional
ref: str
  • Type: str

OrderedStringSet

Represents an ordered set of strings.

Initializers

1
2
3
4
5
import gcix

gcix.OrderedStringSet(
  values: typing.List[str] = None
)
Name Type Description
values typing.List[str] An optional array of values to initialize the set.

valuesOptional
  • Type: typing.List[str]

An optional array of values to initialize the set.


Methods

Name Description
add Adds a value or an array of values to the set.
clear Clears the set, removing all values.
delete Deletes a value from the set.
has Checks if the set contains a specific value.

add
1
2
3
def add(
  value: typing.Union[str, typing.List[str]]
) -> None

Adds a value or an array of values to the set.

valueRequired
  • Type: typing.Union[str, typing.List[str]]

The value(s) to add.


clear
def clear() -> None

Clears the set, removing all values.

delete
1
2
3
def delete(
  value: str
) -> None

Deletes a value from the set.

valueRequired
  • Type: str

The value to delete.


has
1
2
3
def has(
  value: str
) -> bool

Checks if the set contains a specific value.

valueRequired
  • Type: str

The value to check.


Properties

Name Type Description
size typing.Union[int, float] Returns the number of values in the set.
values typing.List[str] Returns an array of values in the set.

sizeRequired
size: typing.Union[int, float]
  • Type: typing.Union[int, float]

Returns the number of values in the set.


valuesRequired
values: typing.List[str]
  • Type: typing.List[str]

Returns an array of values in the set.


PagesJob

This is a special kind of jobs which deploys Gitlab Pages.

This job has the static name pages and the static artifacts path ./public. Both preconfigurations can't be altered and are required for deploying Gitlab Pages properly. All methods which would typically alter the name, stage and artifacts of a job are overwritten with an empty implementation.

This job is only for deploying Gitlab Pages artifacts within the ./public artifacts path. To create the artifacts you have to run jobs, that generate those artifacts within the same ./public artifacts path, before this PagesJob in the pipeline.

Because the name of the job can't be altered, this job may only exist once in the generated pipeline output. Typically you should add the PagesJob to the gcix.Pipeline.

The PagesJob is also preconfigured with the stage pages and the image alpine:latest. To change the stage of this job, use the assignStage() method. Please mention to run this job in a stage after all jobs, that fill the public artifacts path with content.

Here a simple example how to use the GitlabPages job:

1
2
3
4
5
6
# Example automatically generated from non-compiling source. May contain errors.
pipeline = Pipeline()
pipeline.add_children(
    new=Job(stage="deploy", scripts=["./create-html.sh"]).assing_artifacts(Artifacts(paths=["public"]))
) ,
PagesJob() ,

Initializers

1
2
3
import gcix

gcix.PagesJob()
Name Type Description

Methods

Name Description
add_dependencies No description.
add_needs No description.
add_parent This method is called by gcix.JobCollections when the job is added to that JobCollection.
add_tags No description.
add_variables No description.
append_rules No description.
append_scripts No description.
assign_allow_failure No description.
assign_artifacts No description.
assign_cache No description.
assign_dependencies No description.
assign_image Sets the image of this job.
assign_needs No description.
assign_tags No description.
copy Returns an independent, deep copy object of this job.
extend_name This method is used by gcix.JobCollections to populate the jobs name.
extend_stage This method is used by gcix.JobCollections to populate the jobs name and stage.
extend_stage_value This method is used by gcix.JobCollections to populate the jobs stage.
get_all_instance_names Return all instance names from the given child.
is_equal isEqual checks if this object is equal to given object.
prepend_rules No description.
prepend_scripts No description.
render Returns a representation of any object which implements IBase.
assign_stage Set the name of this jobs stage to a value other than pages.

add_dependencies
1
2
3
def add_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
dependenciesRequired

add_needs
1
2
3
def add_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
needsRequired

add_parent
1
2
3
def add_parent(
  parent: typing.Union[Job, JobCollection]
) -> None

This method is called by gcix.JobCollections when the job is added to that JobCollection.

The job needs to know its parents when getAllInstanceNames() is called.

parentRequired

add_tags
1
2
3
def add_tags(
  tags: typing.List[str]
) -> Job
tagsRequired
  • Type: typing.List[str]

add_variables
1
2
3
def add_variables(
  variables: typing.Mapping[str]
) -> Job
variablesRequired
  • Type: typing.Mapping[str]

append_rules
1
2
3
def append_rules(
  rules: typing.List[Rule]
) -> Job
rulesRequired
  • Type: typing.List[Rule]

append_scripts
1
2
3
def append_scripts(
  scripts: typing.List[str]
) -> Job
scriptsRequired
  • Type: typing.List[str]

assign_allow_failure
1
2
3
def assign_allow_failure(
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
) -> Job
allow_failureRequired
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

assign_artifacts
1
2
3
def assign_artifacts(
  artifacts: Artifacts
) -> Job
artifactsRequired

assign_cache
1
2
3
def assign_cache(
  cache: Cache
) -> Job
cacheRequired

assign_dependencies
1
2
3
def assign_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
dependenciesRequired

assign_image
1
2
3
def assign_image(
  image: typing.Union[str, Image]
) -> Job

Sets the image of this job.

For a simple container image you can provide the origin of the image. If you want to set the entrypoint, you have to provide an Image object instead.

!! Any previous values will be overwritten.

imageRequired
  • Type: typing.Union[str, Image]

assign_needs
1
2
3
def assign_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
needsRequired

assign_tags
1
2
3
def assign_tags(
  tags: typing.List[str]
) -> Job
tagsRequired
  • Type: typing.List[str]

copy
def copy() -> Job

Returns an independent, deep copy object of this job.

extend_name
1
2
3
def extend_name(
  name: str
) -> None

This method is used by gcix.JobCollections to populate the jobs name.

nameRequired
  • Type: str

extend_stage
1
2
3
def extend_stage(
  name: str
) -> None

This method is used by gcix.JobCollections to populate the jobs name and stage.

nameRequired
  • Type: str

extend_stage_value
1
2
3
def extend_stage_value(
  name: str
) -> None

This method is used by gcix.JobCollections to populate the jobs stage.

nameRequired
  • Type: str

get_all_instance_names
1
2
3
def get_all_instance_names(
  child: typing.Union[Job, JobCollection] = None
) -> OrderedStringSet

Return all instance names from the given child.

That means all combinations of the childs name and stage within this sequence and all parent sequences.

childOptional

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

prepend_rules
1
2
3
def prepend_rules(
  rules: typing.List[Rule]
) -> Job
rulesRequired
  • Type: typing.List[Rule]

prepend_scripts
1
2
3
def prepend_scripts(
  scripts: typing.List[str]
) -> Job
scriptsRequired
  • Type: typing.List[str]

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

assign_stage
1
2
3
def assign_stage(
  stage: str
) -> PagesJob

Set the name of this jobs stage to a value other than pages.

stageRequired
  • Type: str

Properties

Name Type Description
tags typing.List[str] Getter method to receive added tags.
allow_failure typing.Union[str, bool, typing.List[typing.Union[int, float]]] No description.
name str No description.
ordered_tags OrderedStringSet No description.
parents typing.List[typing.Union[Job, JobCollection]] No description.
scripts typing.List[str] No description.
stage str No description.
artifacts Artifacts No description.
cache Cache No description.
dependencies typing.List[typing.Union[Job, JobCollection, Need]] No description.
image Image No description.
needs typing.List[typing.Union[Job, JobCollection, Need]] No description.
original Job No description.
rules typing.List[Rule] No description.
variables typing.Mapping[str] No description.

tagsRequired
tags: typing.List[str]
  • Type: typing.List[str]

Getter method to receive added tags.


allow_failureRequired
allow_failure: typing.Union[str, bool, typing.List[typing.Union[int, float]]]
  • Type: typing.Union[str, bool, typing.List[typing.Union[int, float]]]

nameRequired
name: str
  • Type: str

ordered_tagsRequired
ordered_tags: OrderedStringSet

parentsRequired
parents: typing.List[typing.Union[Job, JobCollection]]

scriptsRequired
scripts: typing.List[str]
  • Type: typing.List[str]

stageRequired
stage: str
  • Type: str

artifactsOptional
artifacts: Artifacts

cacheOptional
cache: Cache

dependenciesOptional
dependencies: typing.List[typing.Union[Job, JobCollection, Need]]

imageOptional
image: Image

needsOptional
needs: typing.List[typing.Union[Job, JobCollection, Need]]

originalOptional
original: Job

rulesOptional
rules: typing.List[Rule]
  • Type: typing.List[Rule]

variablesOptional
variables: typing.Mapping[str]
  • Type: typing.Mapping[str]

Pipeline

Initializers

1
2
3
4
5
import gcix

gcix.Pipeline(
  includes: typing.List[Include] = None
)
Name Type Description
includes typing.List[Include] You can add global gcix.Includes to the pipeline. Gitlab CI Documentation: "Use include to include external YAML files in your CI/CD configuration.".

includesOptional

You can add global gcix.Includes to the pipeline. Gitlab CI Documentation: "Use include to include external YAML files in your CI/CD configuration.".


Methods

Name Description
add_children Add gcix.Jobs or other gcix.JobCollections to this JobCollection.
add_dependencies No description.
add_needs No description.
add_parent No description.
add_tags No description.
add_variables No description.
append_rules No description.
append_scripts No description.
assign_artifacts No description.
assign_cache No description.
get_all_instance_names Return all instance names from the given child.
initialize_allow_failure Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection that haven't been set the allowFailure before.
initialize_artifacts Sets gcix.Job.artifacts to all jobs within this JobCollection that haven't been set the artifacs before.
initialize_cache Calling gcix.Job.assigneCache() to all jobs within this JobCollection that haven't been set the cache before.
initialize_dependencies Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection that haven't been added dependencies before.
initialize_image Calling gcix.Job.assignImage() to all jobs within this JobCollection.
initialize_needs Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection that haven't been added needs before.
initialize_rules Calling gcix.Job.append_rules() to all jobs within this JobCollection that haven't been added rules before.
initialize_tags Calling gcix.Job.addTags([...]) to all jobs within this JobCollection that haven't been added tags before.
initialize_variables Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection that haven't been added variables before.
is_equal isEqual checks if this object is equal to given object.
override_allow_failure Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection overriding any previous set value.
override_dependencies Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection and overriding any previously added dependencies to that jobs.
override_image Calling gcix.Job.assignImage() to all jobs within this JobCollection overriding any previous set value.
override_needs Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection and overriding any previously added needs to that jobs.
override_rules Calling gcix.Job.overrideRules() to all jobs within this JobCollection and overriding any previously added rules to that jobs.
override_tags Calling gcix.Job.addTags([...]) to all jobs within this JobCollection and overriding any previously added tags to that jobs.
override_variables Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection and overriding any previously added variables to that jobs.
prepend_rules No description.
prepend_scripts No description.
render Returns a representation of any object which implements IBase.
add_include Let you add global gcix.Includes to the pipeline. Gitlab CI Documentation: "Use include to include external YAML files in your CI/CD configuration.".
add_services Add one or more gcix.Services to the pipeline.
write_yaml Create the Gitlab CI YAML file from this pipeline object.

add_children
1
2
3
4
5
def add_children(
  jobs_or_job_collections: typing.List[typing.Union[Job, JobCollection]],
  name: str = None,
  stage: str = None
) -> JobCollection

Add gcix.Jobs or other gcix.JobCollections to this JobCollection.

Adding a child creates a copy of that child. You should provide a name or stage when adding children, to make them different from other places where they will be used.

jobs_or_job_collectionsRequired

nameOptional
  • Type: str

stageOptional
  • Type: str

add_dependencies
1
2
3
def add_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection
dependenciesRequired

add_needs
1
2
3
def add_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection
needsRequired

add_parent
1
2
3
def add_parent(
  parent: JobCollection
) -> None
parentRequired

add_tags
1
2
3
def add_tags(
  tags: typing.List[str]
) -> JobCollection
tagsRequired
  • Type: typing.List[str]

add_variables
1
2
3
def add_variables(
  variables: typing.Mapping[str]
) -> JobCollection
variablesRequired
  • Type: typing.Mapping[str]

append_rules
1
2
3
def append_rules(
  rules: typing.List[Rule]
) -> JobCollection
rulesRequired
  • Type: typing.List[Rule]

append_scripts
1
2
3
def append_scripts(
  scripts: typing.List[str]
) -> JobCollection
scriptsRequired
  • Type: typing.List[str]

assign_artifacts
1
2
3
def assign_artifacts(
  artifacts: Artifacts
) -> JobCollection
artifactsRequired

assign_cache
1
2
3
def assign_cache(
  cache: Cache
) -> JobCollection
cacheRequired

get_all_instance_names
1
2
3
def get_all_instance_names(
  child: typing.Union[Job, JobCollection] = None
) -> OrderedStringSet

Return all instance names from the given child.

That means all combinations of the childs name and stage within this JobCollection and all parent JobCollection's.

childOptional

initialize_allow_failure
1
2
3
def initialize_allow_failure(
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
) -> JobCollection

Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection that haven't been set the allowFailure before.

allow_failureRequired
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

initialize_artifacts
1
2
3
def initialize_artifacts(
  artifacts: Artifacts
) -> JobCollection

Sets gcix.Job.artifacts to all jobs within this JobCollection that haven't been set the artifacs before.

artifactsRequired

initialize_cache
1
2
3
def initialize_cache(
  cache: Cache
) -> JobCollection

Calling gcix.Job.assigneCache() to all jobs within this JobCollection that haven't been set the cache before.

cacheRequired

initialize_dependencies
1
2
3
def initialize_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection that haven't been added dependencies before.

An empty parameter list means that jobs will get an empty dependency list and thus does not download artifacts by default.

dependenciesRequired

initialize_image
1
2
3
def initialize_image(
  image: typing.Union[str, Image]
) -> JobCollection

Calling gcix.Job.assignImage() to all jobs within this JobCollection.

imageRequired
  • Type: typing.Union[str, Image]

initialize_needs
1
2
3
def initialize_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection that haven't been added needs before.

An empty parameter list means that jobs will get an empty dependency list and thus does not depend on other jobs by default.

needsRequired

initialize_rules
1
2
3
def initialize_rules(
  rules: typing.List[Rule]
) -> JobCollection

Calling gcix.Job.append_rules() to all jobs within this JobCollection that haven't been added rules before.

rulesRequired
  • Type: typing.List[Rule]

initialize_tags
1
2
3
def initialize_tags(
  tags: typing.List[str]
) -> JobCollection

Calling gcix.Job.addTags([...]) to all jobs within this JobCollection that haven't been added tags before.

tagsRequired
  • Type: typing.List[str]

initialize_variables
1
2
3
def initialize_variables(
  variables: typing.Mapping[str]
) -> JobCollection

Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection that haven't been added variables before.

variablesRequired
  • Type: typing.Mapping[str]

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

override_allow_failure
1
2
3
def override_allow_failure(
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
) -> JobCollection

Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection overriding any previous set value.

allow_failureRequired
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

override_dependencies
1
2
3
def override_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection and overriding any previously added dependencies to that jobs.

An empty parameter list means that jobs will get an empty dependency list and thus does not download artifacts.

dependenciesRequired

override_image
1
2
3
def override_image(
  image: typing.Union[str, Image]
) -> JobCollection

Calling gcix.Job.assignImage() to all jobs within this JobCollection overriding any previous set value.

imageRequired
  • Type: typing.Union[str, Image]

override_needs
1
2
3
def override_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection and overriding any previously added needs to that jobs.

An empty parameter list means that jobs will get an empty dependency list and thus does not depend on other jobs.

needsRequired

override_rules
1
2
3
def override_rules(
  rules: typing.List[Rule]
) -> JobCollection

Calling gcix.Job.overrideRules() to all jobs within this JobCollection and overriding any previously added rules to that jobs.

rulesRequired
  • Type: typing.List[Rule]

override_tags
1
2
3
def override_tags(
  tags: typing.List[str]
) -> JobCollection

Calling gcix.Job.addTags([...]) to all jobs within this JobCollection and overriding any previously added tags to that jobs.

tagsRequired
  • Type: typing.List[str]

override_variables
1
2
3
def override_variables(
  variables: typing.Mapping[str]
) -> JobCollection

Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection and overriding any previously added variables to that jobs.

variablesRequired
  • Type: typing.Mapping[str]

prepend_rules
1
2
3
def prepend_rules(
  rules: typing.List[Rule]
) -> JobCollection
rulesRequired
  • Type: typing.List[Rule]

prepend_scripts
1
2
3
def prepend_scripts(
  scripts: typing.List[str]
) -> JobCollection
scriptsRequired
  • Type: typing.List[str]

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

add_include
1
2
3
def add_include(
  include: Include
) -> Pipeline

Let you add global gcix.Includes to the pipeline. Gitlab CI Documentation: "Use include to include external YAML files in your CI/CD configuration.".

includeRequired

add_services
1
2
3
def add_services(
  services: typing.List[Service]
) -> Pipeline

Add one or more gcix.Services to the pipeline.

Gitlab CI Documentation: "The services keyword defines a Docker image that runs during a job linked to the Docker image that the image keyword defines."

servicesRequired

write_yaml
1
2
3
def write_yaml(
  filename: str = None
) -> None

Create the Gitlab CI YAML file from this pipeline object.

Use that YAML file to trigger a child pipeline.

filenameOptional
  • Type: str

Properties

Name Type Description
last_jobs_executed typing.List[Job] This property returns all Jobs from the last stage of this JobCollection.
nested_jobs typing.List[Job] No description.
populated_jobs typing.List[Job] Returns a list with populated copies of all nested jobs of this JobCollection.
children typing.List[ChildDict] No description.
ordered_tags OrderedStringSet No description.
ordered_tags_for_initialization OrderedStringSet No description.
ordered_tags_for_replacement OrderedStringSet No description.
parents typing.List[typing.Union[Job, JobCollection]] No description.
allow_failure_for_initialization typing.Union[str, bool, typing.List[typing.Union[int, float]]] No description.
allow_failure_for_replacement typing.Union[str, bool, typing.List[typing.Union[int, float]]] No description.
artifacts Artifacts No description.
artifacts_for_initialization Artifacts No description.
artifacts_for_replacement Artifacts No description.
cache Cache No description.
cache_for_initialization Cache No description.
dependencies typing.List[typing.Union[Job, JobCollection, Need]] No description.
dependencies_for_initialization typing.List[typing.Union[Job, JobCollection, Need]] No description.
dependencies_for_replacement typing.List[typing.Union[Job, JobCollection, Need]] No description.
image_for_initialization typing.Union[str, Image] No description.
image_for_replacement typing.Union[str, Image] No description.
needs typing.List[typing.Union[Job, JobCollection, Need]] No description.
needs_for_initialization typing.List[typing.Union[Job, JobCollection, Need]] No description.
needs_for_replacement typing.List[typing.Union[Job, JobCollection, Need]] No description.
rules_for_initialization typing.List[Rule] No description.
rules_for_replacement typing.List[Rule] No description.
rules_to_append typing.List[Rule] No description.
rules_to_prepend typing.List[Rule] No description.
scripts_to_append typing.List[str] No description.
scripts_to_prepend typing.List[str] No description.
variables typing.Mapping[str] No description.
variables_for_initialization typing.Mapping[str] No description.
variables_for_replacement typing.Mapping[str] No description.
includes typing.List[Include] No description.
service typing.List[Service] No description.

last_jobs_executedRequired
last_jobs_executed: typing.List[Job]
  • Type: typing.List[Job]

This property returns all Jobs from the last stage of this JobCollection.

This is typically be requested from a job which has setup this JobCollection as need, to determine all actual jobs of this JobCollection as need.


nested_jobsRequired
nested_jobs: typing.List[Job]
  • Type: typing.List[Job]

populated_jobsRequired
populated_jobs: typing.List[Job]
  • Type: typing.List[Job]

Returns a list with populated copies of all nested jobs of this JobCollection.

Populated means, that all attributes of a Job which depends on its context are resolved to their final values. The context is primarily the JobCollection within the jobs resides but also dependencies to other jobs and JobCollection's. Thus this JobCollection will apply its own configuration, like variables to add, tags to set, etc., to all its jobs and JobCollection's.

Copies means what it says, that the returned job are not the same job objects, originally added to this JobCollection, but copies of them.

Nested means, that also jobs from JobCollection's within this JobCollection, are returned, as well as jobs from JobCollection's within JobCollection's within this JobCollection and so on.


childrenRequired
children: typing.List[ChildDict]

ordered_tagsRequired
ordered_tags: OrderedStringSet

ordered_tags_for_initializationRequired
ordered_tags_for_initialization: OrderedStringSet

ordered_tags_for_replacementRequired
ordered_tags_for_replacement: OrderedStringSet

parentsRequired
parents: typing.List[typing.Union[Job, JobCollection]]

allow_failure_for_initializationOptional
allow_failure_for_initialization: typing.Union[str, bool, typing.List[typing.Union[int, float]]]
  • Type: typing.Union[str, bool, typing.List[typing.Union[int, float]]]

allow_failure_for_replacementOptional
allow_failure_for_replacement: typing.Union[str, bool, typing.List[typing.Union[int, float]]]
  • Type: typing.Union[str, bool, typing.List[typing.Union[int, float]]]

artifactsOptional
artifacts: Artifacts

artifacts_for_initializationOptional
artifacts_for_initialization: Artifacts

artifacts_for_replacementOptional
artifacts_for_replacement: Artifacts

cacheOptional
cache: Cache

cache_for_initializationOptional
cache_for_initialization: Cache

dependenciesOptional
dependencies: typing.List[typing.Union[Job, JobCollection, Need]]

dependencies_for_initializationOptional
dependencies_for_initialization: typing.List[typing.Union[Job, JobCollection, Need]]

dependencies_for_replacementOptional
dependencies_for_replacement: typing.List[typing.Union[Job, JobCollection, Need]]

image_for_initializationOptional
image_for_initialization: typing.Union[str, Image]
  • Type: typing.Union[str, Image]

image_for_replacementOptional
image_for_replacement: typing.Union[str, Image]
  • Type: typing.Union[str, Image]

needsOptional
needs: typing.List[typing.Union[Job, JobCollection, Need]]

needs_for_initializationOptional
needs_for_initialization: typing.List[typing.Union[Job, JobCollection, Need]]

needs_for_replacementOptional
needs_for_replacement: typing.List[typing.Union[Job, JobCollection, Need]]

rules_for_initializationOptional
rules_for_initialization: typing.List[Rule]
  • Type: typing.List[Rule]

rules_for_replacementOptional
rules_for_replacement: typing.List[Rule]
  • Type: typing.List[Rule]

rules_to_appendOptional
rules_to_append: typing.List[Rule]
  • Type: typing.List[Rule]

rules_to_prependOptional
rules_to_prepend: typing.List[Rule]
  • Type: typing.List[Rule]

scripts_to_appendOptional
scripts_to_append: typing.List[str]
  • Type: typing.List[str]

scripts_to_prependOptional
scripts_to_prepend: typing.List[str]
  • Type: typing.List[str]

variablesOptional
variables: typing.Mapping[str]
  • Type: typing.Mapping[str]

variables_for_initializationOptional
variables_for_initialization: typing.Mapping[str]
  • Type: typing.Mapping[str]

variables_for_replacementOptional
variables_for_replacement: typing.Mapping[str]
  • Type: typing.Mapping[str]

includesRequired
includes: typing.List[Include]

serviceRequired
service: typing.List[Service]

PredefinedVariables

This class contains constants for Gitlab CI predefined variables.

Initializers

1
2
3
import gcix

gcix.PredefinedVariables()
Name Type Description

Properties

Name Type Description
chat_channel str Source chat channel which triggered the ChatOps command.
chat_input str Additional arguments passed in the ChatOps command.
ci str Mark that job is executed in CI environment.
ci_api_v4_url str The GitLab API v4 root URL.
ci_builds_dir str Top-level directory where builds are executed.
ci_commit_before_sha str The previous latest commit present on a branch. Is always 0000000000000000000000000000000000000000 in pipelines for merge requests.
ci_commit_description str The description of the commit the message without first line, if the title is shorter than 100 characters;
ci_commit_message str The full commit message.
ci_commit_ref_name str The branch or tag name for which project is built.
ci_commit_ref_protected str true if the job is running on a protected reference, false if not.
ci_commit_ref_slug str $CI_COMMIT_REF_NAME in lowercase, shortened to 63 bytes, and with everything except 0-9 and a-z replaced with -.
ci_commit_sha str The commit revision for which project is built.
ci_commit_short_sha str The first eight characters of CI_COMMIT_SHA.
ci_commit_timestamp str The timestamp of the commit in the ISO 8601 format.
ci_commit_title str The title of the commit - the full first line of the message.
ci_concurrent_id str Unique ID of build execution in a single executor.
ci_concurrent_project_id str Unique ID of build execution in a single executor and project.
ci_config_path str The path to CI configuration file. Defaults to .gitlab-ci.yml.
ci_debug_trace str Whether debug logging (tracing) is enabled.
ci_default_branch str The name of the default branch for the project.
ci_dependency_proxy_group_image_prefix str The image prefix for pulling images through the Dependency Proxy.
ci_dependency_proxy_password str The password to use to pull images through the Dependency Proxy.
ci_dependency_proxy_server str The server for logging in to the Dependency Proxy. This is equivalent to $CI_SERVER_HOST:$CI_SERVER_PORT.
ci_dependency_proxy_user str The username to use to pull images through the Dependency Proxy.
ci_deploy_password str Authentication password of the GitLab Deploy Token, only present if the Project has one related.
ci_deploy_user str Authentication username of the GitLab Deploy Token, only present if the Project has one related.
ci_job_id str The unique ID of the current job that GitLab CI/CD uses internally.
ci_job_image str The name of the image running the CI job.
ci_job_jwt str RS256 JSON web token that can be used for authenticating with third party systems that support JWT authentication, for example HashiCorp’s Vault.
ci_job_manual str The flag to indicate that job was manually started.
ci_job_name str The name of the job as defined in .gitlab-ci.yml.
ci_job_stage str The name of the stage as defined in .gitlab-ci.yml.
ci_job_status str The state of the job as each runner stage is executed.
ci_job_token str Token used for authenticating with a few API endpoints and downloading dependent repositories.
ci_job_url str Job details URL.
ci_merge_request_target_branch_name str The target branch name of the merge request if the pipelines are for merge requests.
ci_merge_request_target_branch_sha str The HEAD SHA of the target branch of the merge request if the pipelines are for merge requests.
ci_node_total str Total number of instances of this job running in parallel.
ci_pages_domain str The configured domain that hosts GitLab Pages.
ci_pages_url str URL to GitLab Pages-built pages. Always belongs to a subdomain of CI_PAGES_DOMAIN.
ci_pipeline_id str The instance-level ID of the current pipeline. This is a unique ID across all projects on GitLab.
ci_pipeline_iid str The project-level IID (internal ID) of the current pipeline. This ID is unique for the current project.
ci_pipeline_source str Indicates how the pipeline was triggered.
ci_pipeline_triggered str The flag to indicate that job was triggered.
ci_pipeline_url str Pipeline details URL.
ci_project_config_path str The CI configuration path for the project.
ci_project_dir str The full path where the repository is cloned and where the job is run.
ci_project_id str The unique ID of the current project that GitLab CI/CD uses internally.
ci_project_name str The name of the directory for the project that is being built.
ci_project_namespace str The project stage (username or group name) that is being built.
ci_project_path str The stage with project name.
ci_project_path_slug str $CI_PROJECT_PATH in lowercase and with everything except 0-9 and a-z replaced with -. Use in URLs and domain names.
ci_project_repository_languages str Comma-separated, lowercase list of the languages used in the repository (for example ruby,javascript,html,css).
ci_project_root_namespace str The root project stage (username or group name) that is being built.
ci_project_title str The human-readable project name as displayed in the GitLab web interface.
ci_project_url str The HTTP(S) address to access project.
ci_project_visibility str The project visibility (internal, private, public).
ci_registry_password str The password to use to push containers to the GitLab Container Registry, for the current project.
ci_repository_url str The URL to clone the Git repository.
ci_runner_description str The description of the runner as saved in GitLab.
ci_runner_executable_arch str The OS/architecture of the GitLab Runner executable (note that this is not necessarily the same as the environment of the executor).
ci_runner_id str The unique ID of runner being used.
ci_runner_revision str GitLab Runner revision that is executing the current job.
ci_runner_short_token str First eight characters of the runner’s token used to authenticate new job requests. Used as the runner’s unique ID.
ci_runner_tags str The defined runner tags.
ci_runner_version str GitLab Runner version that is executing the current job.
ci_server str Mark that job is executed in CI environment.
ci_server_host str Host component of the GitLab instance URL, without protocol and port (like gitlab.example.com).
ci_server_name str The name of CI server that is used to coordinate jobs.
ci_server_port str Port component of the GitLab instance URL, without host and protocol (like 3000).
ci_server_protocol str Protocol component of the GitLab instance URL, without host and port (like https).
ci_server_revision str GitLab revision that is used to schedule jobs.
ci_server_url str The base URL of the GitLab instance, including protocol and port (like https://gitlab.example.com:8080).
ci_server_version str GitLab version that is used to schedule jobs.
ci_server_version_major str GitLab version major component.
ci_server_version_minor str GitLab version minor component.
ci_server_version_patch str GitLab version patch component.
gitlab_ci str Mark that job is executed in GitLab CI/CD environment.
gitlab_features str The comma separated list of licensed features available for your instance and plan.
gitlab_user_email str The email of the user who started the job.
gitlab_user_id str The ID of the user who started the job.
gitlab_user_login str The login username of the user who started the job.
gitlab_user_name str The real name of the user who started the job.
ci_commit_branch str The commit branch name.
ci_commit_tag str The commit tag name. Present only when building tags.
ci_deploy_freeze str Included with the value true if the pipeline runs during a deploy freeze window.
ci_disposable_environment str Marks that the job is executed in a disposable environment (something that is created only for this job and disposed of/destroyed after the execution - all executors except shell and ssh).
ci_environment_name str The name of the environment for this job. Only present if environment:name is set.
ci_environment_slug str A simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, and so on.
ci_environment_url str The URL of the environment for this job. Only present if environment:url is set.
ci_external_pull_request_iid str Pull Request ID from GitHub if the pipelines are for external pull requests.
ci_external_pull_request_source_branch_name str The source branch name of the pull request if the pipelines are for external pull requests.
ci_external_pull_request_source_branch_sha str The HEAD SHA of the source branch of the pull request if the pipelines are for external pull requests.
ci_external_pull_request_source_repository str The source repository name of the pull request if the pipelines are for external pull requests.
ci_external_pull_request_target_branch_name str The target branch name of the pull request if the pipelines are for external pull requests.
ci_external_pull_request_target_branch_sha str The HEAD SHA of the target branch of the pull request if the pipelines are for external pull requests.
ci_external_pull_request_target_repository str The target repository name of the pull request if the pipelines are for external pull requests.
ci_has_open_requirements str Included with the value true only if the pipeline’s project has any open requirements.
ci_kubernetes_active str Included with the value true only if the pipeline has a Kubernetes cluster available for deployments.
ci_merge_request_assignees str Comma-separated list of username(s) of assignee(s) for the merge request if the pipelines are for merge requests.
ci_merge_request_diff_base_sha str The base SHA of the merge request diff, if the pipelines are for merge requests.
ci_merge_request_diff_id str The version of the merge request diff, if the pipelines are for merge requests.
ci_merge_request_event_type str The event type of the merge request, if the pipelines are for merge requests. Can be detached, merged_result or merge_train.
ci_merge_request_id str The instance-level ID of the merge request.
ci_merge_request_iid str The project-level IID (internal ID) of the merge request.
ci_merge_request_labels str Comma-separated label names of the merge request if the pipelines are for merge requests.
ci_merge_request_milestone str The milestone title of the merge request if the pipelines are for merge requests.
ci_merge_request_project_id str The ID of the project of the merge request if the pipelines are for merge requests.
ci_merge_request_project_path str The path of the project of the merge request if the pipelines are for merge requests (for example stage/awesome-project).
ci_merge_request_project_url str The URL of the project of the merge request if the pipelines are for merge requests (for example http://192.168.10.15:3000/stage/awesome-project). Available only if only [merge_requests] or rules syntax is used and the merge request is created. * Added in GitLab 11.6 Available in GitLab Runner all.
ci_merge_request_ref_path str The ref path of the merge request if the pipelines are for merge requests.
ci_merge_request_source_branch_name str The source branch name of the merge request if the pipelines are for merge requests.
ci_merge_request_source_branch_sha str The HEAD SHA of the source branch of the merge request if the pipelines are for merge requests.
ci_merge_request_source_project_id str The ID of the source project of the merge request if the pipelines are for merge requests.
ci_merge_request_source_project_path str The path of the source project of the merge request if the pipelines are for merge requests.
ci_merge_request_source_project_url str The URL of the source project of the merge request if the pipelines are for merge requests.
ci_merge_request_title str The title of the merge request if the pipelines are for merge requests.
ci_node_index str Index of the job in the job set. If the job is not parallelized, this variable is not set.
ci_open_merge_requests str Available in branch and merge request pipelines.
ci_registry str GitLab Container Registry. This variable includes a :port value if one has been specified in the registry configuration.
ci_registry_image str the address of the registry tied to the specific project.
ci_registry_user str The username to use to push containers to the GitLab Container Registry, for the current project.
ci_shared_environment str Marks that the job is executed in a shared environment (something that is persisted across CI invocations like shell or ssh executor).
trigger_payload str This variable is available when a pipeline is triggered with a webhook.

chat_channelRequired
chat_channel: str
  • Type: str

Source chat channel which triggered the ChatOps command.

Added in GitLab 10.6 Available in GitLab Runner all


chat_inputRequired
chat_input: str
  • Type: str

Additional arguments passed in the ChatOps command.

Added in GitLab 10.6 Available in GitLab Runner all


ciRequired
ci: str
  • Type: str

Mark that job is executed in CI environment.

Added in GitLab all Available in GitLab Runner 0.4


ci_api_v4_urlRequired
ci_api_v4_url: str
  • Type: str

The GitLab API v4 root URL.

Added in GitLab 11.7 Available in GitLab Runner all


ci_builds_dirRequired
ci_builds_dir: str
  • Type: str

Top-level directory where builds are executed.

Added in GitLab all Available in GitLab Runner 11.10


ci_commit_before_shaRequired
ci_commit_before_sha: str
  • Type: str

The previous latest commit present on a branch. Is always 0000000000000000000000000000000000000000 in pipelines for merge requests.

Added in GitLab 11.2 Available in GitLab Runner all


ci_commit_descriptionRequired
ci_commit_description: str
  • Type: str

The description of the commit the message without first line, if the title is shorter than 100 characters;

full message in other case.

Added in GitLab 10.8 Available in GitLab Runner all


ci_commit_messageRequired
ci_commit_message: str
  • Type: str

The full commit message.

Added in GitLab 10.8 Available in GitLab Runner all


ci_commit_ref_nameRequired
ci_commit_ref_name: str
  • Type: str

The branch or tag name for which project is built.

Added in GitLab 9.0 Available in GitLab Runner all


ci_commit_ref_protectedRequired
ci_commit_ref_protected: str
  • Type: str

true if the job is running on a protected reference, false if not.

Added in GitLab 11.11 Available in GitLab Runner all


ci_commit_ref_slugRequired
ci_commit_ref_slug: str
  • Type: str

$CI_COMMIT_REF_NAME in lowercase, shortened to 63 bytes, and with everything except 0-9 and a-z replaced with -.

No leading / trailing -. Use in URLs, host names and domain names.

Added in GitLab 9.0 Available in GitLab Runner all


ci_commit_shaRequired
ci_commit_sha: str
  • Type: str

The commit revision for which project is built.

Added in GitLab 9.0 Available in GitLab Runner all


ci_commit_short_shaRequired
ci_commit_short_sha: str
  • Type: str

The first eight characters of CI_COMMIT_SHA.

Added in GitLab 11.7 Available in GitLab Runner all


ci_commit_timestampRequired
ci_commit_timestamp: str
  • Type: str

The timestamp of the commit in the ISO 8601 format.

Added in GitLab 13.4 Available in GitLab Runner all


ci_commit_titleRequired
ci_commit_title: str
  • Type: str

The title of the commit - the full first line of the message.

Added in GitLab 10.8 Available in GitLab Runner all


ci_concurrent_idRequired
ci_concurrent_id: str
  • Type: str

Unique ID of build execution in a single executor.

Added in GitLab all Available in GitLab Runner 11.10


ci_concurrent_project_idRequired
ci_concurrent_project_id: str
  • Type: str

Unique ID of build execution in a single executor and project.

Added in GitLab all Available in GitLab Runner 11.10


ci_config_pathRequired
ci_config_path: str
  • Type: str

The path to CI configuration file. Defaults to .gitlab-ci.yml.

Added in GitLab 9.4 Available in GitLab Runner 0.5


ci_debug_traceRequired
ci_debug_trace: str
  • Type: str

Whether debug logging (tracing) is enabled.

Added in GitLab all Available in GitLab Runner 1.7


ci_default_branchRequired
ci_default_branch: str
  • Type: str

The name of the default branch for the project.

Added in GitLab 12.4 Available in GitLab Runner all


ci_dependency_proxy_group_image_prefixRequired
ci_dependency_proxy_group_image_prefix: str
  • Type: str

The image prefix for pulling images through the Dependency Proxy.

Added in GitLab 13.7 Available in GitLab Runner all


ci_dependency_proxy_passwordRequired
ci_dependency_proxy_password: str
  • Type: str

The password to use to pull images through the Dependency Proxy.

ATTENTION: Contrary to most other variables in this class, this variable is not resolved at rendering time. Instead the variable string is returned, which is then resolved during pipeline execution. This is because the value contains sensitive information.

Added in GitLab 13.7 Available in GitLab Runner all


ci_dependency_proxy_serverRequired
ci_dependency_proxy_server: str
  • Type: str

The server for logging in to the Dependency Proxy. This is equivalent to $CI_SERVER_HOST:$CI_SERVER_PORT.

Added in GitLab 13.7 Available in GitLab Runner all


ci_dependency_proxy_userRequired
ci_dependency_proxy_user: str
  • Type: str

The username to use to pull images through the Dependency Proxy.

Added in GitLab 13.7 Available in GitLab Runner all


ci_deploy_passwordRequired
ci_deploy_password: str
  • Type: str

Authentication password of the GitLab Deploy Token, only present if the Project has one related.

ATTENTION: Contrary to most other variables in this class, this variable is not resolved at rendering time. Instead the variable string is returned, which is then resolved during pipeline execution. This is because the value contains sensitive information.

Added in GitLab 10.8 Available in GitLab Runner all


ci_deploy_userRequired
ci_deploy_user: str
  • Type: str

Authentication username of the GitLab Deploy Token, only present if the Project has one related.

Added in GitLab 10.8 Available in GitLab Runner all


ci_job_idRequired
ci_job_id: str
  • Type: str

The unique ID of the current job that GitLab CI/CD uses internally.

Added in GitLab 9.0 Available in GitLab Runner all


ci_job_imageRequired
ci_job_image: str
  • Type: str

The name of the image running the CI job.

Added in GitLab 12.9 Available in GitLab Runner 12.9


ci_job_jwtRequired
ci_job_jwt: str
  • Type: str

RS256 JSON web token that can be used for authenticating with third party systems that support JWT authentication, for example HashiCorp’s Vault.

ATTENTION: Contrary to most other variables in this class, this variable is not resolved at rendering time. Instead the variable string is returned, which is then resolved during pipeline execution. This is because the value contains sensitive information.

Added in GitLab 12.10 Available in GitLab Runner all


ci_job_manualRequired
ci_job_manual: str
  • Type: str

The flag to indicate that job was manually started.

Added in GitLab 8.12 Available in GitLab Runner all


ci_job_nameRequired
ci_job_name: str
  • Type: str

The name of the job as defined in .gitlab-ci.yml.

Added in GitLab 9.0 Available in GitLab Runner 0.5


ci_job_stageRequired
ci_job_stage: str
  • Type: str

The name of the stage as defined in .gitlab-ci.yml.

Added in GitLab 9.0 Available in GitLab Runner 0.5


ci_job_statusRequired
ci_job_status: str
  • Type: str

The state of the job as each runner stage is executed.

Use with after_script where CI_JOB_STATUS can be either success, failed or canceled.

Added in GitLab all Available in GitLab Runner 13.5


ci_job_tokenRequired
ci_job_token: str
  • Type: str

Token used for authenticating with a few API endpoints and downloading dependent repositories.

The token is valid as long as the job is running.

ATTENTION: Contrary to most other variables in this class, this variable is not resolved at rendering time. Instead the variable string is returned, which is then resolved during pipeline execution. This is because the value contains sensitive information.

Added in GitLab 9.0 Available in GitLab Runner 1.2


ci_job_urlRequired
ci_job_url: str
  • Type: str

Job details URL.

Added in GitLab 11.1 Available in GitLab Runner 0.5


ci_merge_request_target_branch_nameRequired
ci_merge_request_target_branch_name: str
  • Type: str

The target branch name of the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.6 Available in GitLab Runner all


ci_merge_request_target_branch_shaRequired
ci_merge_request_target_branch_sha: str
  • Type: str

The HEAD SHA of the target branch of the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used, the merge request is created, and the pipeline is a merged result pipeline.

Added in GitLab 11.9 Available in GitLab Runner all


ci_node_totalRequired
ci_node_total: str
  • Type: str

Total number of instances of this job running in parallel.

If the job is not parallelized, this variable is set to 1.

Added in GitLab 11.5 Available in GitLab Runner all


ci_pages_domainRequired
ci_pages_domain: str
  • Type: str

The configured domain that hosts GitLab Pages.

Added in GitLab 11.8 Available in GitLab Runner all


ci_pages_urlRequired
ci_pages_url: str
  • Type: str

URL to GitLab Pages-built pages. Always belongs to a subdomain of CI_PAGES_DOMAIN.

Added in GitLab 11.8 Available in GitLab Runner all


ci_pipeline_idRequired
ci_pipeline_id: str
  • Type: str

The instance-level ID of the current pipeline. This is a unique ID across all projects on GitLab.

Added in GitLab 8.10 Available in GitLab Runner all


ci_pipeline_iidRequired
ci_pipeline_iid: str
  • Type: str

The project-level IID (internal ID) of the current pipeline. This ID is unique for the current project.

Added in GitLab 11.0 Available in GitLab Runner all


ci_pipeline_sourceRequired
ci_pipeline_source: str
  • Type: str

Indicates how the pipeline was triggered.

Possible options are push, web, schedule, api, external, chat, webide, merge_request_event, external_pull_request_event, parent_pipeline, trigger, or pipeline. For pipelines created before GitLab 9.5, this is displayed as unknown.

Added in GitLab 10.0 Available in GitLab Runner all


ci_pipeline_triggeredRequired
ci_pipeline_triggered: str
  • Type: str

The flag to indicate that job was triggered.

Added in GitLab all Available in GitLab Runner all


ci_pipeline_urlRequired
ci_pipeline_url: str
  • Type: str

Pipeline details URL.

Added in GitLab 11.1 Available in GitLab Runner 0.5


ci_project_config_pathRequired
ci_project_config_path: str
  • Type: str

The CI configuration path for the project.

Added in GitLab 13.8 Available in GitLab Runner all


ci_project_dirRequired
ci_project_dir: str
  • Type: str

The full path where the repository is cloned and where the job is run.

If the GitLab Runner builds_dir parameter is set, this variable is set relative to the value of builds_dir. For more information, see Advanced configuration for GitLab Runner.

Added in GitLab all Available in GitLab Runner all


ci_project_idRequired
ci_project_id: str
  • Type: str

The unique ID of the current project that GitLab CI/CD uses internally.

Added in GitLab all Available in GitLab Runner all


ci_project_nameRequired
ci_project_name: str
  • Type: str

The name of the directory for the project that is being built.

For example, if the project URL is gitlab.example.com/group-name/project-1, the CI_PROJECT_NAME would be project-1.

Added in GitLab 8.10 Available in GitLab Runner 0.5


ci_project_namespaceRequired
ci_project_namespace: str
  • Type: str

The project stage (username or group name) that is being built.

Added in GitLab 8.10 Available in GitLab Runner 0.5


ci_project_pathRequired
ci_project_path: str
  • Type: str

The stage with project name.

Added in GitLab 8.10 Available in GitLab Runner 0.5


ci_project_path_slugRequired
ci_project_path_slug: str
  • Type: str

$CI_PROJECT_PATH in lowercase and with everything except 0-9 and a-z replaced with -. Use in URLs and domain names.

Added in GitLab 9.3 Available in GitLab Runner all


ci_project_repository_languagesRequired
ci_project_repository_languages: str
  • Type: str

Comma-separated, lowercase list of the languages used in the repository (for example ruby,javascript,html,css).

Added in GitLab 12.3 Available in GitLab Runner all


ci_project_root_namespaceRequired
ci_project_root_namespace: str
  • Type: str

The root project stage (username or group name) that is being built.

For example, if CI_PROJECT_NAMESPACE is root-group/child-group/grandchild-group, CI_PROJECT_ROOT_NAMESPACE would be root-group.

Added in GitLab 13.2 Available in GitLab Runner 0.5


ci_project_titleRequired
ci_project_title: str
  • Type: str

The human-readable project name as displayed in the GitLab web interface.

Added in GitLab 12.4 Available in GitLab Runner all


ci_project_urlRequired
ci_project_url: str
  • Type: str

The HTTP(S) address to access project.

Added in GitLab 8.10 Available in GitLab Runner 0.5


ci_project_visibilityRequired
ci_project_visibility: str
  • Type: str

The project visibility (internal, private, public).

Added in GitLab 10.3 Available in GitLab Runner all


ci_registry_passwordRequired
ci_registry_password: str
  • Type: str

The password to use to push containers to the GitLab Container Registry, for the current project.

ATTENTION: Contrary to most other variables in this class, this variable is not resolved at rendering time. Instead the variable string is returned, which is then resolved during pipeline execution. This is because the value contains sensitive information.

Added in GitLab 9.0 Available in GitLab Runner all


ci_repository_urlRequired
ci_repository_url: str
  • Type: str

The URL to clone the Git repository.

ATTENTION: Contrary to most other variables in this class, this variable is not resolved at rendering time. Instead the variable string is returned, which is then resolved during pipeline execution. This is because the value contains sensitive information.

Added in GitLab 9.0 Available in GitLab Runner all


ci_runner_descriptionRequired
ci_runner_description: str
  • Type: str

The description of the runner as saved in GitLab.

Added in GitLab 8.10 Available in GitLab Runner 0.5


ci_runner_executable_archRequired
ci_runner_executable_arch: str
  • Type: str

The OS/architecture of the GitLab Runner executable (note that this is not necessarily the same as the environment of the executor).

Added in GitLab all Available in GitLab Runner 10.6


ci_runner_idRequired
ci_runner_id: str
  • Type: str

The unique ID of runner being used.

Added in GitLab 8.10 Available in GitLab Runner 0.5


ci_runner_revisionRequired
ci_runner_revision: str
  • Type: str

GitLab Runner revision that is executing the current job.

Added in GitLab all Available in GitLab Runner 10.6


ci_runner_short_tokenRequired
ci_runner_short_token: str
  • Type: str

First eight characters of the runner’s token used to authenticate new job requests. Used as the runner’s unique ID.

ATTENTION: Contrary to most other variables in this class, this variable is not resolved at rendering time. Instead the variable string is returned, which is then resolved during pipeline execution. This is because the value contains sensitive information.

Added in GitLab all Available in GitLab Runner 12.3


ci_runner_tagsRequired
ci_runner_tags: str
  • Type: str

The defined runner tags.

Added in GitLab 8.10 Available in GitLab Runner 0.5


ci_runner_versionRequired
ci_runner_version: str
  • Type: str

GitLab Runner version that is executing the current job.

Added in GitLab all Available in GitLab Runner 10.6


ci_serverRequired
ci_server: str
  • Type: str

Mark that job is executed in CI environment.

Added in GitLab all Available in GitLab Runner all


ci_server_hostRequired
ci_server_host: str
  • Type: str

Host component of the GitLab instance URL, without protocol and port (like gitlab.example.com).

Added in GitLab 12.1 Available in GitLab Runner all


ci_server_nameRequired
ci_server_name: str
  • Type: str

The name of CI server that is used to coordinate jobs.

Added in GitLab all Available in GitLab Runner all


ci_server_portRequired
ci_server_port: str
  • Type: str

Port component of the GitLab instance URL, without host and protocol (like 3000).

Added in GitLab 12.8 Available in GitLab Runner all


ci_server_protocolRequired
ci_server_protocol: str
  • Type: str

Protocol component of the GitLab instance URL, without host and port (like https).

Added in GitLab 12.8 Available in GitLab Runner all


ci_server_revisionRequired
ci_server_revision: str
  • Type: str

GitLab revision that is used to schedule jobs.

Added in GitLab all Available in GitLab Runner all


ci_server_urlRequired
ci_server_url: str
  • Type: str

The base URL of the GitLab instance, including protocol and port (like https://gitlab.example.com:8080).

Added in GitLab 12.7 Available in GitLab Runner all


ci_server_versionRequired
ci_server_version: str
  • Type: str

GitLab version that is used to schedule jobs.

Added in GitLab all Available in GitLab Runner all


ci_server_version_majorRequired
ci_server_version_major: str
  • Type: str

GitLab version major component.

Added in GitLab 11.4 Available in GitLab Runner all


ci_server_version_minorRequired
ci_server_version_minor: str
  • Type: str

GitLab version minor component.

Added in GitLab 11.4 Available in GitLab Runner all


ci_server_version_patchRequired
ci_server_version_patch: str
  • Type: str

GitLab version patch component.

Added in GitLab 11.4 Available in GitLab Runner all


gitlab_ciRequired
gitlab_ci: str
  • Type: str

Mark that job is executed in GitLab CI/CD environment.

Added in GitLab all Available in GitLab Runner all


gitlab_featuresRequired
gitlab_features: str
  • Type: str

The comma separated list of licensed features available for your instance and plan.

Added in GitLab 10.6 Available in GitLab Runner all


gitlab_user_emailRequired
gitlab_user_email: str
  • Type: str

The email of the user who started the job.

Added in GitLab 8.12 Available in GitLab Runner all


gitlab_user_idRequired
gitlab_user_id: str
  • Type: str

The ID of the user who started the job.

Added in GitLab 8.12 Available in GitLab Runner all


gitlab_user_loginRequired
gitlab_user_login: str
  • Type: str

The login username of the user who started the job.

Added in GitLab 10.0 Available in GitLab Runner all


gitlab_user_nameRequired
gitlab_user_name: str
  • Type: str

The real name of the user who started the job.

Added in GitLab 10.0 Available in GitLab Runner all


ci_commit_branchOptional
ci_commit_branch: str
  • Type: str

The commit branch name.

Present in branch pipelines, including pipelines for the default branch. Not present in merge request pipelines or tag pipelines.

Added in GitLab 12.6 Available in GitLab Runner 0.5


ci_commit_tagOptional
ci_commit_tag: str
  • Type: str

The commit tag name. Present only when building tags.

Added in GitLab 9.0 Available in GitLab Runner 0.5


ci_deploy_freezeOptional
ci_deploy_freeze: str
  • Type: str

Included with the value true if the pipeline runs during a deploy freeze window.

Added in GitLab 13.2 Available in GitLab Runner all


ci_disposable_environmentOptional
ci_disposable_environment: str
  • Type: str

Marks that the job is executed in a disposable environment (something that is created only for this job and disposed of/destroyed after the execution - all executors except shell and ssh).

If the environment is disposable, it is set to true, otherwise it is not defined at all.

Added in GitLab all Available in GitLab Runner 10.1


ci_environment_nameOptional
ci_environment_name: str
  • Type: str

The name of the environment for this job. Only present if environment:name is set.

Added in GitLab 8.15 Available in GitLab Runner all


ci_environment_slugOptional
ci_environment_slug: str
  • Type: str

A simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, and so on.

Only present if environment:name is set.

Added in GitLab 8.15 Available in GitLab Runner all


ci_environment_urlOptional
ci_environment_url: str
  • Type: str

The URL of the environment for this job. Only present if environment:url is set.

Added in GitLab 9.3 Available in GitLab Runner all


ci_external_pull_request_iidOptional
ci_external_pull_request_iid: str
  • Type: str

Pull Request ID from GitHub if the pipelines are for external pull requests.

Available only if only [external_pull_requests] or rules syntax is used and the pull request is open.

Added in GitLab 12.3 Available in GitLab Runner all


ci_external_pull_request_source_branch_nameOptional
ci_external_pull_request_source_branch_name: str
  • Type: str

The source branch name of the pull request if the pipelines are for external pull requests.

Available only if only [external_pull_requests] or rules syntax is used and the pull request is open.

Added in GitLab 12.3 Available in GitLab Runner all


ci_external_pull_request_source_branch_shaOptional
ci_external_pull_request_source_branch_sha: str
  • Type: str

The HEAD SHA of the source branch of the pull request if the pipelines are for external pull requests.

Available only if only [external_pull_requests] or rules syntax is used and the pull request is open.

Added in GitLab 12.3 Available in GitLab Runner all


ci_external_pull_request_source_repositoryOptional
ci_external_pull_request_source_repository: str
  • Type: str

The source repository name of the pull request if the pipelines are for external pull requests.

Available only if only [external_pull_requests] or rules syntax is used and the pull request is open.

Added in GitLab 13.3 Available in GitLab Runner all


ci_external_pull_request_target_branch_nameOptional
ci_external_pull_request_target_branch_name: str
  • Type: str

The target branch name of the pull request if the pipelines are for external pull requests.

Available only if only [external_pull_requests] or rules syntax is used and the pull request is open. * Added in GitLab 12.3 Available in GitLab Runner all


ci_external_pull_request_target_branch_shaOptional
ci_external_pull_request_target_branch_sha: str
  • Type: str

The HEAD SHA of the target branch of the pull request if the pipelines are for external pull requests.

Available only if only [external_pull_requests] or rules syntax is used and the pull request is open.

Added in GitLab 12.3 Available in GitLab Runner all


ci_external_pull_request_target_repositoryOptional
ci_external_pull_request_target_repository: str
  • Type: str

The target repository name of the pull request if the pipelines are for external pull requests.

Available only if only [external_pull_requests] or rules syntax is used and the pull request is open.

Added in GitLab 13.3 Available in GitLab Runner all


ci_has_open_requirementsOptional
ci_has_open_requirements: str
  • Type: str

Included with the value true only if the pipeline’s project has any open requirements.

Not included if there are no open requirements for the pipeline’s project.

Added in GitLab 13.1 Available in GitLab Runner all


ci_kubernetes_activeOptional
ci_kubernetes_active: str
  • Type: str

Included with the value true only if the pipeline has a Kubernetes cluster available for deployments.

Not included if no cluster is available. Can be used as an alternative to only:kubernetes/except:kubernetes with rules:if.

Added in GitLab 13.0 Available in GitLab Runner all


ci_merge_request_assigneesOptional
ci_merge_request_assignees: str
  • Type: str

Comma-separated list of username(s) of assignee(s) for the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.9 Available in GitLab Runner all


ci_merge_request_diff_base_shaOptional
ci_merge_request_diff_base_sha: str
  • Type: str

The base SHA of the merge request diff, if the pipelines are for merge requests.

Added in GitLab 13.7 Available in GitLab Runner all


ci_merge_request_diff_idOptional
ci_merge_request_diff_id: str
  • Type: str

The version of the merge request diff, if the pipelines are for merge requests.

Added in GitLab 13.7 Available in GitLab Runner all


ci_merge_request_event_typeOptional
ci_merge_request_event_type: str
  • Type: str

The event type of the merge request, if the pipelines are for merge requests. Can be detached, merged_result or merge_train.

Added in GitLab 12.3 Available in GitLab Runner all


ci_merge_request_idOptional
ci_merge_request_id: str
  • Type: str

The instance-level ID of the merge request.

Only available if the pipelines are for merge requests and the merge request is created. This is a unique ID across all projects on GitLab.

Added in GitLab 11.6 Available in GitLab Runner all


ci_merge_request_iidOptional
ci_merge_request_iid: str
  • Type: str

The project-level IID (internal ID) of the merge request.

Only available If the pipelines are for merge requests and the merge request is created. This ID is unique for the current project.

Added in GitLab 11.6 Available in GitLab Runner all


ci_merge_request_labelsOptional
ci_merge_request_labels: str
  • Type: str

Comma-separated label names of the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.9 Available in GitLab Runner all


ci_merge_request_milestoneOptional
ci_merge_request_milestone: str
  • Type: str

The milestone title of the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.9 Available in GitLab Runner all


ci_merge_request_project_idOptional
ci_merge_request_project_id: str
  • Type: str

The ID of the project of the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.6 Available in GitLab Runner all


ci_merge_request_project_pathOptional
ci_merge_request_project_path: str
  • Type: str

The path of the project of the merge request if the pipelines are for merge requests (for example stage/awesome-project).

Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.6 Available in GitLab Runner all


ci_merge_request_project_urlOptional
ci_merge_request_project_url: str
  • Type: str

The URL of the project of the merge request if the pipelines are for merge requests (for example http://192.168.10.15:3000/stage/awesome-project). Available only if only [merge_requests] or rules syntax is used and the merge request is created. * Added in GitLab 11.6 Available in GitLab Runner all.


ci_merge_request_ref_pathOptional
ci_merge_request_ref_path: str
  • Type: str

The ref path of the merge request if the pipelines are for merge requests.

(for example refs/merge-requests/1/head). Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.6 Available in GitLab Runner all


ci_merge_request_source_branch_nameOptional
ci_merge_request_source_branch_name: str
  • Type: str

The source branch name of the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.6 Available in GitLab Runner all


ci_merge_request_source_branch_shaOptional
ci_merge_request_source_branch_sha: str
  • Type: str

The HEAD SHA of the source branch of the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used, the merge request is created, and the pipeline is a merged result pipeline.

Added in GitLab 11.9 Available in GitLab Runner all


ci_merge_request_source_project_idOptional
ci_merge_request_source_project_id: str
  • Type: str

The ID of the source project of the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.6 Available in GitLab Runner all


ci_merge_request_source_project_pathOptional
ci_merge_request_source_project_path: str
  • Type: str

The path of the source project of the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.6 Available in GitLab Runner all


ci_merge_request_source_project_urlOptional
ci_merge_request_source_project_url: str
  • Type: str

The URL of the source project of the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.6 Available in GitLab Runner all


ci_merge_request_titleOptional
ci_merge_request_title: str
  • Type: str

The title of the merge request if the pipelines are for merge requests.

Available only if only [merge_requests] or rules syntax is used and the merge request is created.

Added in GitLab 11.9 Available in GitLab Runner all


ci_node_indexOptional
ci_node_index: str
  • Type: str

Index of the job in the job set. If the job is not parallelized, this variable is not set.

Added in GitLab 11.5 Available in GitLab Runner all


ci_open_merge_requestsOptional
ci_open_merge_requests: str
  • Type: str

Available in branch and merge request pipelines.

Contains a comma-separated list of up to four merge requests that use the current branch and project as the merge request source. For example gitlab-org/gitlab!333,gitlab-org/gitlab-foss!11.

Added in GitLab 13.8 Available in GitLab Runner all


ci_registryOptional
ci_registry: str
  • Type: str

GitLab Container Registry. This variable includes a :port value if one has been specified in the registry configuration.

Added in GitLab 8.10 Available in GitLab Runner 0.5


ci_registry_imageOptional
ci_registry_image: str
  • Type: str

the address of the registry tied to the specific project.

Added in GitLab 8.10 Available in GitLab Runner 0.5


ci_registry_userOptional
ci_registry_user: str
  • Type: str

The username to use to push containers to the GitLab Container Registry, for the current project.

Added in GitLab 9.0 Available in GitLab Runner all


ci_shared_environmentOptional
ci_shared_environment: str
  • Type: str

Marks that the job is executed in a shared environment (something that is persisted across CI invocations like shell or ssh executor).

If the environment is shared, it is set to true, otherwise it is not defined at all.

Added in GitLab all Available in GitLab Runner 10.1


trigger_payloadOptional
trigger_payload: str
  • Type: str

This variable is available when a pipeline is triggered with a webhook.

Added in GitLab 13.9 Available in GitLab Runner all


Rule

Initializers

import gcix

gcix.Rule(
  allow_failure: bool = None,
  changes: typing.List[str] = None,
  exists: typing.List[str] = None,
  if_statement: str = None,
  variables: typing.Mapping[str] = None,
  when: WhenStatement = None
)
Name Type Description
allow_failure bool No description.
changes typing.List[str] No description.
exists typing.List[str] No description.
if_statement str No description.
variables typing.Mapping[str] No description.
when WhenStatement No description.

allow_failureOptional
  • Type: bool
  • Default: false

changesOptional
  • Type: typing.List[str]

existsOptional
  • Type: typing.List[str]

if_statementOptional
  • Type: str

variablesOptional
  • Type: typing.Mapping[str]

whenOptional

Methods

Name Description
add_variables Adds one or more variables, each as keyword argument, to the rule.
is_equal isEqual checks if this object is equal to given object.
never This method is intended to be used for predefined rules.
render Returns a representation of any object which implements IBase.

add_variables
1
2
3
def add_variables(
  variables: typing.Mapping[str]
) -> Rule

Adds one or more variables, each as keyword argument, to the rule.

rule.addVariables({GREETING: "hello", LANGUAGE: "typescript"})
variablesRequired
  • Type: typing.Mapping[str]

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

never
def never() -> Rule

This method is intended to be used for predefined rules.

For instance you have defined an often used rule on_master whose if statement checks if the pipeline is executed on branch master. Then you can either run a job, if on master...

myJob.appendRules(onMaster)

... or do not run a job if on master...

myJob.appendRules(onMaster.never())
render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
variables typing.Mapping[str] No description.
allow_failure bool No description.
changes typing.List[str] No description.
exists typing.List[str] No description.
if_statement str No description.
when WhenStatement No description.

variablesRequired
variables: typing.Mapping[str]
  • Type: typing.Mapping[str]

allow_failureOptional
allow_failure: bool
  • Type: bool

changesOptional
changes: typing.List[str]
  • Type: typing.List[str]

existsOptional
exists: typing.List[str]
  • Type: typing.List[str]

if_statementOptional
if_statement: str
  • Type: str

whenOptional
when: WhenStatement

RuleLib

Represents a library of static methods to create rules for GitLab CI/CD pipeline conditions.

Static Functions

Name Description
not_on_branch Creates a rule that evaluates to true if the CI/CD pipeline is NOT running on the specified branch.
not_on_main Creates a rule that evaluates to true if the CI/CD pipeline is NOT running on the "main" branch.
not_on_master Creates a rule that evaluates to true if the CI/CD pipeline is NOT running on the "master" branch.
on_branch Creates a rule that evaluates to true if the CI/CD pipeline is running on the specified branch.
on_main Creates a rule that evaluates to true if the CI/CD pipeline is running on the "main" branch.
on_master Creates a rule that evaluates to true if the CI/CD pipeline is running on the "master" branch.
on_merge_request_events Creates a rule that evaluates to true for merge request events in the CI/CD pipeline.
on_pipeline_trigger Creates a rule that evaluates to true for pipelines triggered by API or the trigger keyword.
on_success Creates a rule that always evaluates to true (success).
on_tags Creates a rule that evaluates to true for CI/CD pipelines triggered by tags.

not_on_branch
1
2
3
4
5
import gcix

gcix.RuleLib.not_on_branch(
  branch_name: str
)

Creates a rule that evaluates to true if the CI/CD pipeline is NOT running on the specified branch.

branch_nameRequired
  • Type: str

The name of the branch to check.


not_on_main
1
2
3
import gcix

gcix.RuleLib.not_on_main()

Creates a rule that evaluates to true if the CI/CD pipeline is NOT running on the "main" branch.

not_on_master
1
2
3
import gcix

gcix.RuleLib.not_on_master()

Creates a rule that evaluates to true if the CI/CD pipeline is NOT running on the "master" branch.

on_branch
1
2
3
4
5
import gcix

gcix.RuleLib.on_branch(
  branch_name: str
)

Creates a rule that evaluates to true if the CI/CD pipeline is running on the specified branch.

branch_nameRequired
  • Type: str

The name of the branch to check.


on_main
1
2
3
import gcix

gcix.RuleLib.on_main()

Creates a rule that evaluates to true if the CI/CD pipeline is running on the "main" branch.

on_master
1
2
3
import gcix

gcix.RuleLib.on_master()

Creates a rule that evaluates to true if the CI/CD pipeline is running on the "master" branch.

on_merge_request_events
1
2
3
import gcix

gcix.RuleLib.on_merge_request_events()

Creates a rule that evaluates to true for merge request events in the CI/CD pipeline.

on_pipeline_trigger
1
2
3
import gcix

gcix.RuleLib.on_pipeline_trigger()

Creates a rule that evaluates to true for pipelines triggered by API or the trigger keyword.

on_success
1
2
3
import gcix

gcix.RuleLib.on_success()

Creates a rule that always evaluates to true (success).

on_tags
1
2
3
import gcix

gcix.RuleLib.on_tags()

Creates a rule that evaluates to true for CI/CD pipelines triggered by tags.

Service

Initializers

1
2
3
4
5
import gcix

gcix.Service(
  name: str
)
Name Type Description
name str No description.

nameRequired
  • Type: str

Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
name str No description.

nameRequired
name: str
  • Type: str

TriggerJob

This class represents the trigger job.

Jobs with trigger can only use a limited set of keywords. For example, you can’t run commands with script.

Simple example:

1
2
3
4
5
6
7
8
# Example automatically generated from non-compiling source. May contain errors.
trigger_job = TriggerJob(
    stage="trigger-other-job",
    project="myteam/other-project",
    branch="main",
    strategy="depend"
)
trigger_job.append_rules(rules.on_tags().never(), rules.on_main())

Initializers

import gcix

gcix.TriggerJob(
  branch: str = None,
  includes: typing.List[typing.Union[IncludeLocal, IncludeFile, IncludeRemote, IncludeTemplate, IncludeArtifact]] = None,
  name: str = None,
  project: str = None,
  stage: str = None,
  strategy: str = None
)
Name Type Description
branch str No description.
includes typing.List[typing.Union[IncludeLocal, IncludeFile, IncludeRemote, IncludeTemplate, IncludeArtifact]] No description.
name str No description.
project str No description.
stage str No description.
strategy str No description.

branchOptional
  • Type: str

includesOptional

nameOptional
  • Type: str

projectOptional
  • Type: str

stageOptional
  • Type: str

strategyOptional
  • Type: str

Methods

Name Description
add_dependencies No description.
add_needs No description.
add_parent This method is called by gcix.JobCollections when the job is added to that JobCollection.
add_tags No description.
add_variables No description.
append_rules No description.
append_scripts No description.
assign_allow_failure No description.
assign_artifacts No description.
assign_cache No description.
assign_dependencies No description.
assign_image Sets the image of this job.
assign_needs No description.
assign_tags No description.
copy Returns an independent, deep copy object of this job.
extend_name This method is used by gcix.JobCollections to populate the jobs name.
extend_stage This method is used by gcix.JobCollections to populate the jobs name and stage.
extend_stage_value This method is used by gcix.JobCollections to populate the jobs stage.
get_all_instance_names Return all instance names from the given child.
is_equal isEqual checks if this object is equal to given object.
prepend_rules No description.
prepend_scripts No description.
render Returns a representation of any object which implements IBase.

add_dependencies
1
2
3
def add_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
dependenciesRequired

add_needs
1
2
3
def add_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
needsRequired

add_parent
1
2
3
def add_parent(
  parent: typing.Union[Job, JobCollection]
) -> None

This method is called by gcix.JobCollections when the job is added to that JobCollection.

The job needs to know its parents when getAllInstanceNames() is called.

parentRequired

add_tags
1
2
3
def add_tags(
  tags: typing.List[str]
) -> Job
tagsRequired
  • Type: typing.List[str]

add_variables
1
2
3
def add_variables(
  variables: typing.Mapping[str]
) -> Job
variablesRequired
  • Type: typing.Mapping[str]

append_rules
1
2
3
def append_rules(
  rules: typing.List[Rule]
) -> Job
rulesRequired
  • Type: typing.List[Rule]

append_scripts
1
2
3
def append_scripts(
  scripts: typing.List[str]
) -> Job
scriptsRequired
  • Type: typing.List[str]

assign_allow_failure
1
2
3
def assign_allow_failure(
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
) -> Job
allow_failureRequired
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

assign_artifacts
1
2
3
def assign_artifacts(
  artifacts: Artifacts
) -> Job
artifactsRequired

assign_cache
1
2
3
def assign_cache(
  cache: Cache
) -> Job
cacheRequired

assign_dependencies
1
2
3
def assign_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
dependenciesRequired

assign_image
1
2
3
def assign_image(
  image: typing.Union[str, Image]
) -> Job

Sets the image of this job.

For a simple container image you can provide the origin of the image. If you want to set the entrypoint, you have to provide an Image object instead.

!! Any previous values will be overwritten.

imageRequired
  • Type: typing.Union[str, Image]

assign_needs
1
2
3
def assign_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
needsRequired

assign_tags
1
2
3
def assign_tags(
  tags: typing.List[str]
) -> Job
tagsRequired
  • Type: typing.List[str]

copy
def copy() -> Job

Returns an independent, deep copy object of this job.

extend_name
1
2
3
def extend_name(
  name: str
) -> None

This method is used by gcix.JobCollections to populate the jobs name.

nameRequired
  • Type: str

extend_stage
1
2
3
def extend_stage(
  stage: str
) -> None

This method is used by gcix.JobCollections to populate the jobs name and stage.

stageRequired
  • Type: str

extend_stage_value
1
2
3
def extend_stage_value(
  stage: str
) -> None

This method is used by gcix.JobCollections to populate the jobs stage.

stageRequired
  • Type: str

get_all_instance_names
1
2
3
def get_all_instance_names(
  child: typing.Union[Job, JobCollection] = None
) -> OrderedStringSet

Return all instance names from the given child.

That means all combinations of the childs name and stage within this sequence and all parent sequences.

childOptional

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

prepend_rules
1
2
3
def prepend_rules(
  rules: typing.List[Rule]
) -> Job
rulesRequired
  • Type: typing.List[Rule]

prepend_scripts
1
2
3
def prepend_scripts(
  scripts: typing.List[str]
) -> Job
scriptsRequired
  • Type: typing.List[str]

render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

Properties

Name Type Description
tags typing.List[str] Getter method to receive added tags.
allow_failure typing.Union[str, bool, typing.List[typing.Union[int, float]]] No description.
name str No description.
ordered_tags OrderedStringSet No description.
parents typing.List[typing.Union[Job, JobCollection]] No description.
scripts typing.List[str] No description.
stage str No description.
artifacts Artifacts No description.
cache Cache No description.
dependencies typing.List[typing.Union[Job, JobCollection, Need]] No description.
image Image No description.
needs typing.List[typing.Union[Job, JobCollection, Need]] No description.
original Job No description.
rules typing.List[Rule] No description.
variables typing.Mapping[str] No description.
branch str The branch of project the pipeline should be triggered of.
includes typing.List[typing.Union[IncludeLocal, IncludeFile, IncludeRemote, IncludeTemplate, IncludeArtifact]] Include a pipeline to trigger (Parent-child pipeline trigger) Mutually exclusiv with project.
project str The full name of another Gitlab project to trigger (multi-project pipeline trigger).
strategy str Determines if the result of this pipeline depends on the triggered downstream pipeline (use TriggerStrategy.DEPEND) or if just "fire and forget" the downstream pipeline (use None).

tagsRequired
tags: typing.List[str]
  • Type: typing.List[str]

Getter method to receive added tags.


allow_failureRequired
allow_failure: typing.Union[str, bool, typing.List[typing.Union[int, float]]]
  • Type: typing.Union[str, bool, typing.List[typing.Union[int, float]]]

nameRequired
name: str
  • Type: str

ordered_tagsRequired
ordered_tags: OrderedStringSet

parentsRequired
parents: typing.List[typing.Union[Job, JobCollection]]

scriptsRequired
scripts: typing.List[str]
  • Type: typing.List[str]

stageRequired
stage: str
  • Type: str

artifactsOptional
artifacts: Artifacts

cacheOptional
cache: Cache

dependenciesOptional
dependencies: typing.List[typing.Union[Job, JobCollection, Need]]

imageOptional
image: Image

needsOptional
needs: typing.List[typing.Union[Job, JobCollection, Need]]

originalOptional
original: Job

rulesOptional
rules: typing.List[Rule]
  • Type: typing.List[Rule]

variablesOptional
variables: typing.Mapping[str]
  • Type: typing.Mapping[str]

branchOptional
branch: str
  • Type: str

The branch of project the pipeline should be triggered of.


includesOptional
includes: typing.List[typing.Union[IncludeLocal, IncludeFile, IncludeRemote, IncludeTemplate, IncludeArtifact]]

Include a pipeline to trigger (Parent-child pipeline trigger) Mutually exclusiv with project.


projectOptional
project: str
  • Type: str

The full name of another Gitlab project to trigger (multi-project pipeline trigger).

Mutually exclusive with includes.


strategyOptional
strategy: str
  • Type: str

Determines if the result of this pipeline depends on the triggered downstream pipeline (use TriggerStrategy.DEPEND) or if just "fire and forget" the downstream pipeline (use None).


Protocols

IArtifacts

Methods

Name Description
add_excludes No description.
add_paths No description.

add_excludes
1
2
3
def add_excludes(
  excludes: typing.List[str]
) -> None
excludesRequired
  • Type: typing.List[str]

add_paths
1
2
3
def add_paths(
  paths: typing.List[str]
) -> None
pathsRequired
  • Type: typing.List[str]

Properties

Name Type Description
excludes typing.List[str] No description.
paths typing.List[str] No description.
expire_in str No description.
expose_as str No description.
name str No description.
public bool No description.
reports typing.List[ArtifactsReport] No description.
untracked bool No description.
when WhenStatement No description.

excludesRequired
excludes: typing.List[str]
  • Type: typing.List[str]

pathsRequired
paths: typing.List[str]
  • Type: typing.List[str]

expire_inOptional
expire_in: str
  • Type: str

expose_asOptional
expose_as: str
  • Type: str

nameOptional
name: str
  • Type: str

publicOptional
public: bool
  • Type: bool

reportsOptional
reports: typing.List[ArtifactsReport]

untrackedOptional
untracked: bool
  • Type: bool

whenOptional
when: WhenStatement

IBase

Methods

Name Description
is_equal isEqual checks if this object is equal to given object.
render Returns a representation of any object which implements IBase.

is_equal
1
2
3
def is_equal(
  comparable: IBase
) -> bool

isEqual checks if this object is equal to given object.

comparableRequired

An arbitrary object to compare to.


render
def render() -> typing.Any

Returns a representation of any object which implements IBase.

The rendered representation is used by the gcix to dump it in YAML format as part of the .gitlab-ci.yml pipeline.

ICache

ICacheKey

IImage

Methods

Name Description
with_entrypoint No description.
with_tag No description.

with_entrypoint
1
2
3
def with_entrypoint(
  entrypoint: typing.List[str]
) -> Image
entrypointRequired
  • Type: typing.List[str]

with_tag
1
2
3
def with_tag(
  tag: str
) -> Image
tagRequired
  • Type: str

IInclude

This module represents the Gitlab CI Include keyword.

Use include to include external YAML files in your CI/CD configuration.

include:local example:

pipeline.addInclude(new IncludeLocal({local: "/templates/.gitlab-ci-template.yml"}))

include:file example:

1
2
3
4
5
pipeline.addInclude(new IncludeFile({
        project="my-group/my-project",
        ref="master",
        file="/templates/.gitlab-ci-template.yml"
    }))

include:remote example:

1
2
3
pipeline.addInclude(new IncludeRemote({
         remote: "https://gitlab.com/example-project/-/raw/master/.gitlab-ci.yml"
     }))

include:template example:

pipeline.addInclude(new IncludeTemplate({template: "Auto-DevOps.gitlab-ci.yml"}))

Special type of include: Use a gcix.TriggerJob with IncludeArtifact to run a child pipeline with a generated configuration file from a previous job:

new TriggerJob({includes=[IncludeArtifact(job="generate-config", artifact="generated-config.yml")]})

IIncludeArtifact

IIncludeFile

IIncludeLocal

IIncludeRemote

IIncludeTemplate

IJob

  • Extends: IJobBase

  • Implemented By: gcix.aws.CdkBootstrap, gcix.aws.CdkDeploy, gcix.aws.CdkDiff, gcix.aws.CdkMirrorToCodecommit, gcix.container.CraneCopy, gcix.container.CranePull, gcix.container.CranePush, gcix.container.DiveScan, gcix.container.DockerBuild, gcix.container.DockerPush, gcix.container.KanikoExecute, gcix.container.TrivyIgnoreFileCheck, gcix.container.TrivyScanLocalImage, gcix.git.GitMirror, gcix.gitlab.PagesAsciiDoctor, gcix.python.PagesPdoc3, gcix.python.PagesSphinx, gcix.python.PythonBuildBdistWheel, gcix.python.PythonDeployTwineUpload, gcix.python.PythonLintFlake8, gcix.python.PythonLintIsort, gcix.python.PythonLintMyPy, gcix.python.PythonTestEvaluateGitTagPep440Conformity, gcix.python.PythonTestPytest, Job, PagesJob, TriggerJob, IJob

Methods

Name Description
add_parent This method is called by gcix.JobCollections when the job is added to that JobCollection.
assign_allow_failure No description.
assign_dependencies No description.
assign_image Sets the image of this job.
assign_needs No description.
assign_tags No description.
copy Returns an independent, deep copy object of this job.
extend_name This method is used by gcix.JobCollections to populate the jobs name.
extend_stage This method is used by gcix.JobCollections to populate the jobs name and stage.
extend_stage_value This method is used by gcix.JobCollections to populate the jobs stage.

add_parent
1
2
3
def add_parent(
  parent: typing.Union[Job, JobCollection]
) -> None

This method is called by gcix.JobCollections when the job is added to that JobCollection.

The job needs to know its parents when getAllInstanceNames() is called.

parentRequired

any type of Job or JobCollection.


assign_allow_failure
1
2
3
def assign_allow_failure(
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
) -> Job
allow_failureRequired
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

assign_dependencies
1
2
3
def assign_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
dependenciesRequired

assign_image
1
2
3
def assign_image(
  image: typing.Union[str, Image]
) -> Job

Sets the image of this job.

For a simple container image you can provide the origin of the image. If you want to set the entrypoint, you have to provide an Image object instead.

!! Any previous values will be overwritten.

imageRequired
  • Type: typing.Union[str, Image]

assign_needs
1
2
3
def assign_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
needsRequired

assign_tags
1
2
3
def assign_tags(
  tags: typing.List[str]
) -> Job
tagsRequired
  • Type: typing.List[str]

copy
def copy() -> Job

Returns an independent, deep copy object of this job.

extend_name
1
2
3
def extend_name(
  name: str
) -> None

This method is used by gcix.JobCollections to populate the jobs name.

nameRequired
  • Type: str

to append to the current name.


extend_stage
1
2
3
def extend_stage(
  stage: str
) -> None

This method is used by gcix.JobCollections to populate the jobs name and stage.

stageRequired
  • Type: str

name to extend the stage and the name.


extend_stage_value
1
2
3
def extend_stage_value(
  stage: str
) -> None

This method is used by gcix.JobCollections to populate the jobs stage.

stageRequired
  • Type: str

name to extend the stage.


Properties

Name Type Description
tags typing.List[str] Getter method to receive added tags.
original Job No description.

tagsRequired
tags: typing.List[str]
  • Type: typing.List[str]

Getter method to receive added tags.


originalOptional
original: Job

IJobBase

  • Extends: IBase

  • Implemented By: gcix.aws.CdkBootstrap, gcix.aws.CdkDeploy, gcix.aws.CdkDiff, gcix.aws.CdkMirrorToCodecommit, gcix.container.CraneCopy, gcix.container.CranePull, gcix.container.CranePush, gcix.container.DiveScan, gcix.container.DockerBuild, gcix.container.DockerPush, gcix.container.KanikoExecute, gcix.container.TrivyIgnoreFileCheck, gcix.container.TrivyScanLocalImage, gcix.git.GitMirror, gcix.gitlab.PagesAsciiDoctor, gcix.python.PagesPdoc3, gcix.python.PagesSphinx, gcix.python.PythonBuildBdistWheel, gcix.python.PythonDeployTwineUpload, gcix.python.PythonLintFlake8, gcix.python.PythonLintIsort, gcix.python.PythonLintMyPy, gcix.python.PythonTestEvaluateGitTagPep440Conformity, gcix.python.PythonTestPytest, Job, PagesJob, TriggerJob, IJob, IJobBase

Methods

Name Description
add_dependencies No description.
add_needs No description.
add_tags No description.
add_variables No description.
append_rules No description.
append_scripts No description.
assign_artifacts No description.
assign_cache No description.
get_all_instance_names Return all instance names from the given child.
prepend_rules No description.
prepend_scripts No description.

add_dependencies
1
2
3
def add_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
dependenciesRequired

add_needs
1
2
3
def add_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> Job
needsRequired

add_tags
1
2
3
def add_tags(
  tags: typing.List[str]
) -> Job
tagsRequired
  • Type: typing.List[str]

add_variables
1
2
3
def add_variables(
  variables: typing.Mapping[str]
) -> Job
variablesRequired
  • Type: typing.Mapping[str]

append_rules
1
2
3
def append_rules(
  rules: typing.List[Rule]
) -> Job
rulesRequired
  • Type: typing.List[Rule]

append_scripts
1
2
3
def append_scripts(
  scripts: typing.List[str]
) -> Job
scriptsRequired
  • Type: typing.List[str]

assign_artifacts
1
2
3
def assign_artifacts(
  artifacts: Artifacts
) -> Job
artifactsRequired

assign_cache
1
2
3
def assign_cache(
  cache: Cache
) -> Job
cacheRequired

get_all_instance_names
1
2
3
def get_all_instance_names(
  child: typing.Union[Job, JobCollection] = None
) -> OrderedStringSet

Return all instance names from the given child.

That means all combinations of the childs name and stage within this sequence and all parent sequences.

childOptional

prepend_rules
1
2
3
def prepend_rules(
  rules: typing.List[Rule]
) -> Job
rulesRequired
  • Type: typing.List[Rule]

prepend_scripts
1
2
3
def prepend_scripts(
  scripts: typing.List[str]
) -> Job
scriptsRequired
  • Type: typing.List[str]

Properties

Name Type Description
tags typing.List[str] Getter method to receive added tags.

tagsRequired
tags: typing.List[str]
  • Type: typing.List[str]

Getter method to receive added tags.


IJobCollection

  • Extends: IJobCollectionBase

  • Implemented By: gcix.aws.CdkDiffDeploy, gcix.container.BuildContainerCollection, gcix.container.BuildGitlabContainerCollection, gcix.container.CopyContainerCollection, gcix.python.PythonFullStack, JobCollection, Pipeline, IJobCollection

Methods

Name Description
add_children Add gcix.Jobs or other gcix.JobCollections to this JobCollection.
add_parent No description.
initialize_allow_failure Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection that haven't been set the allowFailure before.
initialize_artifacts Sets gcix.Job.artifacts to all jobs within this JobCollection that haven't been set the artifacs before.
initialize_cache Calling gcix.Job.assigneCache() to all jobs within this JobCollection that haven't been set the cache before.
initialize_dependencies Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection that haven't been added dependencies before.
initialize_image Calling gcix.Job.assignImage() to all jobs within this JobCollection.
initialize_needs Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection that haven't been added needs before.
initialize_rules Calling gcix.Job.append_rules() to all jobs within this JobCollection that haven't been added rules before.
initialize_tags Calling gcix.Job.addTags([...]) to all jobs within this JobCollection that haven't been added tags before.
initialize_variables Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection that haven't been added variables before.
override_allow_failure Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection overriding any previous set value.
override_dependencies Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection and overriding any previously added dependencies to that jobs.
override_image Calling gcix.Job.assignImage() to all jobs within this JobCollection overriding any previous set value.
override_needs Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection and overriding any previously added needs to that jobs.
override_rules Calling gcix.Job.overrideRules() to all jobs within this JobCollection and overriding any previously added rules to that jobs.
override_tags Calling gcix.Job.addTags([...]) to all jobs within this JobCollection and overriding any previously added tags to that jobs.
override_variables Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection and overriding any previously added variables to that jobs.

add_children
1
2
3
4
5
def add_children(
  jobs_or_job_collections: typing.List[typing.Union[Job, JobCollection]],
  name: str = None,
  stage: str = None
) -> JobCollection

Add gcix.Jobs or other gcix.JobCollections to this JobCollection.

Adding a child creates a copy of that child. You should provide a name or stage when adding children, to make them different from other places where they will be used.

jobs_or_job_collectionsRequired

nameOptional
  • Type: str

stageOptional
  • Type: str

add_parent
1
2
3
def add_parent(
  parent: JobCollection
) -> None
parentRequired

initialize_allow_failure
1
2
3
def initialize_allow_failure(
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
) -> JobCollection

Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection that haven't been set the allowFailure before.

allow_failureRequired
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

???


initialize_artifacts
1
2
3
def initialize_artifacts(
  artifacts: Artifacts
) -> JobCollection

Sets gcix.Job.artifacts to all jobs within this JobCollection that haven't been set the artifacs before.

artifactsRequired

???


initialize_cache
1
2
3
def initialize_cache(
  cache: Cache
) -> JobCollection

Calling gcix.Job.assigneCache() to all jobs within this JobCollection that haven't been set the cache before.

cacheRequired

???


initialize_dependencies
1
2
3
def initialize_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection that haven't been added dependencies before.

An empty parameter list means that jobs will get an empty dependency list and thus does not download artifacts by default.

dependenciesRequired

???


initialize_image
1
2
3
def initialize_image(
  image: typing.Union[str, Image]
) -> JobCollection

Calling gcix.Job.assignImage() to all jobs within this JobCollection.

imageRequired
  • Type: typing.Union[str, Image]

???


initialize_needs
1
2
3
def initialize_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection that haven't been added needs before.

An empty parameter list means that jobs will get an empty dependency list and thus does not depend on other jobs by default.

needsRequired

???


initialize_rules
1
2
3
def initialize_rules(
  rules: typing.List[Rule]
) -> JobCollection

Calling gcix.Job.append_rules() to all jobs within this JobCollection that haven't been added rules before.

rulesRequired
  • Type: typing.List[Rule]

???


initialize_tags
1
2
3
def initialize_tags(
  tags: typing.List[str]
) -> JobCollection

Calling gcix.Job.addTags([...]) to all jobs within this JobCollection that haven't been added tags before.

tagsRequired
  • Type: typing.List[str]

???


initialize_variables
1
2
3
def initialize_variables(
  variables: typing.Mapping[str]
) -> JobCollection

Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection that haven't been added variables before.

variablesRequired
  • Type: typing.Mapping[str]

???


override_allow_failure
1
2
3
def override_allow_failure(
  allow_failure: typing.Union[bool, typing.List[typing.Union[int, float]]]
) -> JobCollection

Calling gcix.Job.assignAllowFailure() to all jobs within this JobCollection overriding any previous set value.

allow_failureRequired
  • Type: typing.Union[bool, typing.List[typing.Union[int, float]]]

???


override_dependencies
1
2
3
def override_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignDependencies() to all jobs within the first stage of this JobCollection and overriding any previously added dependencies to that jobs.

An empty parameter list means that jobs will get an empty dependency list and thus does not download artifacts.

dependenciesRequired

???


override_image
1
2
3
def override_image(
  image: typing.Union[str, Image]
) -> JobCollection

Calling gcix.Job.assignImage() to all jobs within this JobCollection overriding any previous set value.

imageRequired
  • Type: typing.Union[str, Image]

???


override_needs
1
2
3
def override_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection

Calling gcix.Job.assignNeeds() to all jobs within the first stage of this JobCollection and overriding any previously added needs to that jobs.

An empty parameter list means that jobs will get an empty dependency list and thus does not depend on other jobs.

needsRequired

???


override_rules
1
2
3
def override_rules(
  rules: typing.List[Rule]
) -> JobCollection

Calling gcix.Job.overrideRules() to all jobs within this JobCollection and overriding any previously added rules to that jobs.

rulesRequired
  • Type: typing.List[Rule]

???


override_tags
1
2
3
def override_tags(
  tags: typing.List[str]
) -> JobCollection

Calling gcix.Job.addTags([...]) to all jobs within this JobCollection and overriding any previously added tags to that jobs.

tagsRequired
  • Type: typing.List[str]

???


override_variables
1
2
3
def override_variables(
  variables: typing.Mapping[str]
) -> JobCollection

Calling gcix.Job.addVariables({...}) to all jobs within this JobCollection and overriding any previously added variables to that jobs.

variablesRequired
  • Type: typing.Mapping[str]

???


Properties

Name Type Description
last_jobs_executed typing.List[Job] This property returns all Jobs from the last stage of this JobCollection.
nested_jobs typing.List[Job] No description.
populated_jobs typing.List[Job] Returns a list with populated copies of all nested jobs of this JobCollection.
children typing.List[ChildDict] No description.
ordered_tags OrderedStringSet No description.
ordered_tags_for_initialization OrderedStringSet No description.
ordered_tags_for_replacement OrderedStringSet No description.
parents typing.List[typing.Union[Job, JobCollection]] No description.
allow_failure_for_initialization typing.Union[str, bool, typing.List[typing.Union[int, float]]] No description.
allow_failure_for_replacement typing.Union[str, bool, typing.List[typing.Union[int, float]]] No description.
artifacts Artifacts No description.
artifacts_for_initialization Artifacts No description.
artifacts_for_replacement Artifacts No description.
cache Cache No description.
cache_for_initialization Cache No description.
dependencies typing.List[typing.Union[Job, JobCollection, Need]] No description.
dependencies_for_initialization typing.List[typing.Union[Job, JobCollection, Need]] No description.
dependencies_for_replacement typing.List[typing.Union[Job, JobCollection, Need]] No description.
image_for_initialization typing.Union[str, Image] No description.
image_for_replacement typing.Union[str, Image] No description.
needs typing.List[typing.Union[Job, JobCollection, Need]] No description.
needs_for_initialization typing.List[typing.Union[Job, JobCollection, Need]] No description.
needs_for_replacement typing.List[typing.Union[Job, JobCollection, Need]] No description.
rules_for_initialization typing.List[Rule] No description.
rules_for_replacement typing.List[Rule] No description.
rules_to_append typing.List[Rule] No description.
rules_to_prepend typing.List[Rule] No description.
scripts_to_append typing.List[str] No description.
scripts_to_prepend typing.List[str] No description.
variables typing.Mapping[str] No description.
variables_for_initialization typing.Mapping[str] No description.
variables_for_replacement typing.Mapping[str] No description.

last_jobs_executedRequired
last_jobs_executed: typing.List[Job]
  • Type: typing.List[Job]

This property returns all Jobs from the last stage of this JobCollection.

This is typically be requested from a job which has setup this JobCollection as need, to determine all actual jobs of this JobCollection as need.


nested_jobsRequired
nested_jobs: typing.List[Job]
  • Type: typing.List[Job]

populated_jobsRequired
populated_jobs: typing.List[Job]
  • Type: typing.List[Job]

Returns a list with populated copies of all nested jobs of this JobCollection.

Populated means, that all attributes of a Job which depends on its context are resolved to their final values. The context is primarily the JobCollection within the jobs resides but also dependencies to other jobs and JobCollection's. Thus this JobCollection will apply its own configuration, like variables to add, tags to set, etc., to all its jobs and JobCollection's.

Copies means what it says, that the returned job are not the same job objects, originally added to this JobCollection, but copies of them.

Nested means, that also jobs from JobCollection's within this JobCollection, are returned, as well as jobs from JobCollection's within JobCollection's within this JobCollection and so on.


childrenRequired
children: typing.List[ChildDict]

ordered_tagsRequired
ordered_tags: OrderedStringSet

ordered_tags_for_initializationRequired
ordered_tags_for_initialization: OrderedStringSet

ordered_tags_for_replacementRequired
ordered_tags_for_replacement: OrderedStringSet

parentsRequired
parents: typing.List[typing.Union[Job, JobCollection]]

allow_failure_for_initializationOptional
allow_failure_for_initialization: typing.Union[str, bool, typing.List[typing.Union[int, float]]]
  • Type: typing.Union[str, bool, typing.List[typing.Union[int, float]]]

allow_failure_for_replacementOptional
allow_failure_for_replacement: typing.Union[str, bool, typing.List[typing.Union[int, float]]]
  • Type: typing.Union[str, bool, typing.List[typing.Union[int, float]]]

artifactsOptional
artifacts: Artifacts

artifacts_for_initializationOptional
artifacts_for_initialization: Artifacts

artifacts_for_replacementOptional
artifacts_for_replacement: Artifacts

cacheOptional
cache: Cache

cache_for_initializationOptional
cache_for_initialization: Cache

dependenciesOptional
dependencies: typing.List[typing.Union[Job, JobCollection, Need]]

dependencies_for_initializationOptional
dependencies_for_initialization: typing.List[typing.Union[Job, JobCollection, Need]]

dependencies_for_replacementOptional
dependencies_for_replacement: typing.List[typing.Union[Job, JobCollection, Need]]

image_for_initializationOptional
image_for_initialization: typing.Union[str, Image]
  • Type: typing.Union[str, Image]

image_for_replacementOptional
image_for_replacement: typing.Union[str, Image]
  • Type: typing.Union[str, Image]

needsOptional
needs: typing.List[typing.Union[Job, JobCollection, Need]]

needs_for_initializationOptional
needs_for_initialization: typing.List[typing.Union[Job, JobCollection, Need]]

needs_for_replacementOptional
needs_for_replacement: typing.List[typing.Union[Job, JobCollection, Need]]

rules_for_initializationOptional
rules_for_initialization: typing.List[Rule]
  • Type: typing.List[Rule]

rules_for_replacementOptional
rules_for_replacement: typing.List[Rule]
  • Type: typing.List[Rule]

rules_to_appendOptional
rules_to_append: typing.List[Rule]
  • Type: typing.List[Rule]

rules_to_prependOptional
rules_to_prepend: typing.List[Rule]
  • Type: typing.List[Rule]

scripts_to_appendOptional
scripts_to_append: typing.List[str]
  • Type: typing.List[str]

scripts_to_prependOptional
scripts_to_prepend: typing.List[str]
  • Type: typing.List[str]

variablesOptional
variables: typing.Mapping[str]
  • Type: typing.Mapping[str]

variables_for_initializationOptional
variables_for_initialization: typing.Mapping[str]
  • Type: typing.Mapping[str]

variables_for_replacementOptional
variables_for_replacement: typing.Mapping[str]
  • Type: typing.Mapping[str]

IJobCollectionBase

Methods

Name Description
add_dependencies No description.
add_needs No description.
add_tags No description.
add_variables No description.
append_rules No description.
append_scripts No description.
assign_artifacts No description.
assign_cache No description.
get_all_instance_names Return all instance names from the given child.
prepend_rules No description.
prepend_scripts No description.

add_dependencies
1
2
3
def add_dependencies(
  dependencies: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection
dependenciesRequired

add_needs
1
2
3
def add_needs(
  needs: typing.List[typing.Union[Job, JobCollection, Need]]
) -> JobCollection
needsRequired

add_tags
1
2
3
def add_tags(
  tags: typing.List[str]
) -> JobCollection
tagsRequired
  • Type: typing.List[str]

add_variables
1
2
3
def add_variables(
  variables: typing.Mapping[str]
) -> JobCollection
variablesRequired
  • Type: typing.Mapping[str]

append_rules
1
2
3
def append_rules(
  rules: typing.List[Rule]
) -> JobCollection
rulesRequired
  • Type: typing.List[Rule]

append_scripts
1
2
3
def append_scripts(
  scripts: typing.List[str]
) -> JobCollection
scriptsRequired
  • Type: typing.List[str]

assign_artifacts
1
2
3
def assign_artifacts(
  artifacts: Artifacts
) -> JobCollection
artifactsRequired

assign_cache
1
2
3
def assign_cache(
  cache: Cache
) -> JobCollection
cacheRequired

get_all_instance_names
1
2
3
def get_all_instance_names(
  child: typing.Union[Job, JobCollection] = None
) -> OrderedStringSet

Return all instance names from the given child.

That means all combinations of the childs name and stage within this JobCollection and all parent JobCollection's.

childOptional

prepend_rules
1
2
3
def prepend_rules(
  rules: typing.List[Rule]
) -> JobCollection
rulesRequired
  • Type: typing.List[Rule]

prepend_scripts
1
2
3
def prepend_scripts(
  scripts: typing.List[str]
) -> JobCollection
scriptsRequired
  • Type: typing.List[str]

INeed

IPagesJob

Methods

Name Description
assign_stage Set the name of this jobs stage to a value other than pages.
copy There should be only one instance of this job, that is why this method does not return a copy of this job but the job itself.
extend_name The jobs name pages is fixed and can't be altered.
extend_stage The stage name can't be altered from parent sequences.
extend_stage_value Extending the name of the stage is not allowed on this Job.

assign_stage
1
2
3
def assign_stage(
  stage: str
) -> PagesJob

Set the name of this jobs stage to a value other than pages.

stageRequired
  • Type: str

A valid Gitlab CI Job stage name.


copy
def copy() -> Job

There should be only one instance of this job, that is why this method does not return a copy of this job but the job itself.

extend_name
1
2
3
def extend_name(
  name: str
) -> None

The jobs name pages is fixed and can't be altered.

nameRequired
  • Type: str

extend_stage
1
2
3
def extend_stage(
  name: str
) -> None

The stage name can't be altered from parent sequences.

nameRequired
  • Type: str

extend_stage_value
1
2
3
def extend_stage_value(
  name: str
) -> None

Extending the name of the stage is not allowed on this Job.

nameRequired
  • Type: str

IPipeline

Methods

Name Description
add_include Let you add global gcix.Includes to the pipeline. Gitlab CI Documentation: "Use include to include external YAML files in your CI/CD configuration.".
add_services Add one or more gcix.Services to the pipeline.
write_yaml Create the Gitlab CI YAML file from this pipeline object.

add_include
1
2
3
def add_include(
  include: Include
) -> Pipeline

Let you add global gcix.Includes to the pipeline. Gitlab CI Documentation: "Use include to include external YAML files in your CI/CD configuration.".

includeRequired

add_services
1
2
3
def add_services(
  services: typing.List[Service]
) -> Pipeline

Add one or more gcix.Services to the pipeline.

Gitlab CI Documentation: "The services keyword defines a Docker image that runs during a job linked to the Docker image that the image keyword defines."

servicesRequired

simply use strings to name the services to link to the pipeline.

Use objects of the gcix.Service class for more complex service configurations.


write_yaml
1
2
3
def write_yaml(
  filename: str = None
) -> None

Create the Gitlab CI YAML file from this pipeline object.

Use that YAML file to trigger a child pipeline.

filenameOptional
  • Type: str

the file name of the created yaml file.


Properties

Name Type Description
includes typing.List[Include] No description.
service typing.List[Service] No description.

includesRequired
includes: typing.List[Include]

serviceRequired
service: typing.List[Service]

IRule

Methods

Name Description
add_variables Adds one or more variables, each as keyword argument, to the rule.
never This method is intended to be used for predefined rules.

add_variables
1
2
3
def add_variables(
  variables: typing.Mapping[str]
) -> Rule

Adds one or more variables, each as keyword argument, to the rule.

rule.addVariables({GREETING: "hello", LANGUAGE: "typescript"})
variablesRequired
  • Type: typing.Mapping[str]

Each variable would be provided as keyword argument:.


never
def never() -> Rule

This method is intended to be used for predefined rules.

For instance you have defined an often used rule on_master whose if statement checks if the pipeline is executed on branch master. Then you can either run a job, if on master...

myJob.appendRules(onMaster)

... or do not run a job if on master...

myJob.appendRules(onMaster.never())

IService

Properties

Name Type Description
name str No description.

nameRequired
name: str
  • Type: str

ITriggerJob

Properties

Name Type Description
branch str The branch of project the pipeline should be triggered of.
includes typing.List[typing.Union[IncludeLocal, IncludeFile, IncludeRemote, IncludeTemplate, IncludeArtifact]] Include a pipeline to trigger (Parent-child pipeline trigger) Mutually exclusiv with project.
project str The full name of another Gitlab project to trigger (multi-project pipeline trigger).
strategy str Determines if the result of this pipeline depends on the triggered downstream pipeline (use TriggerStrategy.DEPEND) or if just "fire and forget" the downstream pipeline (use None).

branchOptional
branch: str
  • Type: str

The branch of project the pipeline should be triggered of.


includesOptional
includes: typing.List[typing.Union[IncludeLocal, IncludeFile, IncludeRemote, IncludeTemplate, IncludeArtifact]]

Include a pipeline to trigger (Parent-child pipeline trigger) Mutually exclusiv with project.


projectOptional
project: str
  • Type: str

The full name of another Gitlab project to trigger (multi-project pipeline trigger).

Mutually exclusive with includes.


strategyOptional
strategy: str
  • Type: str

Determines if the result of this pipeline depends on the triggered downstream pipeline (use TriggerStrategy.DEPEND) or if just "fire and forget" the downstream pipeline (use None).


Enums

CachePolicy

This enum represents the cache:policy keyword. The policy determines if a Job can modify the cache or read him only.

Members

Name Description
PULLPUSH The default behavior of a caching job is to download the files at the start of execution and re-upload them at the end.
PULL If you are certain that the job does not modify the cached files, you can specify this policy to skip the upload step.

PULLPUSH

The default behavior of a caching job is to download the files at the start of execution and re-upload them at the end.

This behavior ensures that any changes made by the job are persisted for future runs.


PULL

If you are certain that the job does not modify the cached files, you can specify this policy to skip the upload step.

By setting this policy, the job will only download the cached files at the start of execution without re-uploading them at the end.


WhenStatement

This enum holds different when statements for Rules.

Members

Name Description
ALWAYS No description.
DELAYED No description.
MANUAL No description.
NEVER No description.
ONFAILURE No description.
ONSUCCESS No description.

ALWAYS

DELAYED

MANUAL

NEVER

ONFAILURE

ONSUCCESS