Skip to main content

gitlab Submodule

Constructs

CiConfiguration

CI for GitLab.

A CI is a configurable automated process made up of one or more stages/jobs.

https://docs.gitlab.com/ee/ci/yaml/

Initializers

import { gitlab } from 'projen'

new gitlab.CiConfiguration(project: Project, name: string, options?: CiConfigurationOptions)
NameTypeDescription
project
projen.ProjectNo description.
name
stringNo description.
options
CiConfigurationOptions
No description.

projectRequired
  • Type: projen.Project

nameRequired
  • Type: string

optionsOptional

Methods

NameDescription
toString
Returns a string representation of this construct.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.
addDefaultCaches
Adds up to 4 default caches configuration to the CI configuration.
addGlobalVariables
Add a globally defined variable to the CI configuration.
addIncludes
Add additional yml/yaml files to the CI includes.
addJobs
Add jobs and their stages to the CI configuration.
addServices
Add additional services.
addStages
Add stages to the CI configuration if not already present.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

addDefaultCaches
public addDefaultCaches(caches: Cache[]): void

Adds up to 4 default caches configuration to the CI configuration.

cachesRequired

Caches to add.


addGlobalVariables
public addGlobalVariables(variables: {[ key: string ]: any}): void

Add a globally defined variable to the CI configuration.

variablesRequired
  • Type: {[ key: string ]: any}

The variables to add.


addIncludes
public addIncludes(includes: Include): void

Add additional yml/yaml files to the CI includes.

includesRequired

The includes to add.


addJobs
public addJobs(jobs: {[ key: string ]: Job}): void

Add jobs and their stages to the CI configuration.

jobsRequired
  • Type: {[ key: string ]: Job}

Jobs to add.


addServices
public addServices(services: Service): void

Add additional services.

servicesRequired

The services to add.


addStages
public addStages(stages: string): void

Add stages to the CI configuration if not already present.

stagesRequired
  • Type: string

stages to add.


Static Functions

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct
import { gitlab } from 'projen'

gitlab.CiConfiguration.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { gitlab } from 'projen'

gitlab.CiConfiguration.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
defaultAfterScript
string[]Defines default scripts that should run after all jobs.
defaultBeforeScript
string[]Defines default scripts that should run before all jobs.
defaultTags
string[]Used to select a specific runner from the list of all runners that are available for the project.
file
projen.YamlFileThe workflow YAML file.
jobs
{[ key: string ]: Job}
The jobs in the CI configuration.
name
stringThe name of the configuration.
path
stringPath to CI file generated by the configuration.
stages
string[]Groups jobs into stages.
variables
{[ key: string ]: string | number | VariableConfig}
Global variables that are passed to jobs.
defaultArtifacts
Artifacts
Default list of files and directories that should be attached to the job if it succeeds.
defaultCache
Cache[]
No description.
defaultImage
Image
Specifies the default docker image to use globally for all jobs.
defaultInterruptible
booleanThe default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false).
defaultRetry
Retry
How many times a job is retried if it fails.
defaultTimeout
stringA default timeout job written in natural language (Ex.
pages
Job
A special job used to upload static sites to Gitlab pages.
workflow
Workflow
Used to control pipeline behavior.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

defaultAfterScriptRequired
public readonly defaultAfterScript: string[];
  • Type: string[]

Defines default scripts that should run after all jobs.

Can be overriden by the job level afterScript.


defaultBeforeScriptRequired
public readonly defaultBeforeScript: string[];
  • Type: string[]

Defines default scripts that should run before all jobs.

Can be overriden by the job level afterScript.


defaultTagsRequired
public readonly defaultTags: string[];
  • Type: string[]

Used to select a specific runner from the list of all runners that are available for the project.


fileRequired
public readonly file: YamlFile;
  • Type: projen.YamlFile

The workflow YAML file.


jobsRequired
public readonly jobs: {[ key: string ]: Job};
  • Type: {[ key: string ]: Job}

The jobs in the CI configuration.


nameRequired
public readonly name: string;
  • Type: string

The name of the configuration.


pathRequired
public readonly path: string;
  • Type: string

Path to CI file generated by the configuration.


stagesRequired
public readonly stages: string[];
  • Type: string[]

Groups jobs into stages.

All jobs in one stage must complete before next stage is executed. Defaults to ['build', 'test', 'deploy'].


variablesRequired
public readonly variables: {[ key: string ]: string | number | VariableConfig};

Global variables that are passed to jobs.

If the job already has that variable defined, the job-level variable takes precedence.


defaultArtifactsOptional
public readonly defaultArtifacts: Artifacts;

Default list of files and directories that should be attached to the job if it succeeds.

Artifacts are sent to Gitlab where they can be downloaded.


defaultCacheOptional
public readonly defaultCache: Cache[];

defaultImageOptional
public readonly defaultImage: Image;

Specifies the default docker image to use globally for all jobs.


defaultInterruptibleOptional
public readonly defaultInterruptible: boolean;
  • Type: boolean

The default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false).


defaultRetryOptional
public readonly defaultRetry: Retry;

How many times a job is retried if it fails.

If not defined, defaults to 0 and jobs do not retry.


defaultTimeoutOptional
public readonly defaultTimeout: string;
  • Type: string

A default timeout job written in natural language (Ex.

one hour, 3600 seconds, 60 minutes).


pagesOptional
public readonly pages: Job;

A special job used to upload static sites to Gitlab pages.

Requires a public/ directory with artifacts.path pointing to it.


workflowOptional
public readonly workflow: Workflow;

Used to control pipeline behavior.


GitlabConfiguration

A GitLab CI for the main .gitlab-ci.yml file.

Initializers

import { gitlab } from 'projen'

new gitlab.GitlabConfiguration(project: Project, options?: CiConfigurationOptions)
NameTypeDescription
project
projen.ProjectNo description.
options
CiConfigurationOptions
No description.

projectRequired
  • Type: projen.Project

optionsOptional

Methods

NameDescription
toString
Returns a string representation of this construct.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.
addDefaultCaches
Adds up to 4 default caches configuration to the CI configuration.
addGlobalVariables
Add a globally defined variable to the CI configuration.
addIncludes
Add additional yml/yaml files to the CI includes.
addJobs
Add jobs and their stages to the CI configuration.
addServices
Add additional services.
addStages
Add stages to the CI configuration if not already present.
createNestedTemplates
Creates and adds nested templates to the includes of the main CI.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

addDefaultCaches
public addDefaultCaches(caches: Cache[]): void

Adds up to 4 default caches configuration to the CI configuration.

cachesRequired

Caches to add.


addGlobalVariables
public addGlobalVariables(variables: {[ key: string ]: any}): void

Add a globally defined variable to the CI configuration.

variablesRequired
  • Type: {[ key: string ]: any}

The variables to add.


addIncludes
public addIncludes(includes: Include): void

Add additional yml/yaml files to the CI includes.

includesRequired

The includes to add.


addJobs
public addJobs(jobs: {[ key: string ]: Job}): void

Add jobs and their stages to the CI configuration.

jobsRequired
  • Type: {[ key: string ]: Job}

Jobs to add.


addServices
public addServices(services: Service): void

Add additional services.

servicesRequired

The services to add.


addStages
public addStages(stages: string): void

Add stages to the CI configuration if not already present.

stagesRequired
  • Type: string

stages to add.


createNestedTemplates
public createNestedTemplates(config: {[ key: string ]: CiConfigurationOptions}): void

Creates and adds nested templates to the includes of the main CI.

Additionally adds their stages to the main CI if they are not already present. You can futher customize nested templates through the nestedTemplates property. E.g. gitlabConfig.nestedTemplates['templateName']?.addStages('stageName')

configRequired

a record the names and configuraitons of the templates.


Static Functions

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct
import { gitlab } from 'projen'

gitlab.GitlabConfiguration.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { gitlab } from 'projen'

gitlab.GitlabConfiguration.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
defaultAfterScript
string[]Defines default scripts that should run after all jobs.
defaultBeforeScript
string[]Defines default scripts that should run before all jobs.
defaultTags
string[]Used to select a specific runner from the list of all runners that are available for the project.
file
projen.YamlFileThe workflow YAML file.
jobs
{[ key: string ]: Job}
The jobs in the CI configuration.
name
stringThe name of the configuration.
path
stringPath to CI file generated by the configuration.
stages
string[]Groups jobs into stages.
variables
{[ key: string ]: string | number | VariableConfig}
Global variables that are passed to jobs.
defaultArtifacts
Artifacts
Default list of files and directories that should be attached to the job if it succeeds.
defaultCache
Cache[]
No description.
defaultImage
Image
Specifies the default docker image to use globally for all jobs.
defaultInterruptible
booleanThe default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false).
defaultRetry
Retry
How many times a job is retried if it fails.
defaultTimeout
stringA default timeout job written in natural language (Ex.
pages
Job
A special job used to upload static sites to Gitlab pages.
workflow
Workflow
Used to control pipeline behavior.
nestedTemplates
{[ key: string ]: NestedConfiguration}
No description.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

defaultAfterScriptRequired
public readonly defaultAfterScript: string[];
  • Type: string[]

Defines default scripts that should run after all jobs.

Can be overriden by the job level afterScript.


defaultBeforeScriptRequired
public readonly defaultBeforeScript: string[];
  • Type: string[]

Defines default scripts that should run before all jobs.

Can be overriden by the job level afterScript.


defaultTagsRequired
public readonly defaultTags: string[];
  • Type: string[]

Used to select a specific runner from the list of all runners that are available for the project.


fileRequired
public readonly file: YamlFile;
  • Type: projen.YamlFile

The workflow YAML file.


jobsRequired
public readonly jobs: {[ key: string ]: Job};
  • Type: {[ key: string ]: Job}

The jobs in the CI configuration.


nameRequired
public readonly name: string;
  • Type: string

The name of the configuration.


pathRequired
public readonly path: string;
  • Type: string

Path to CI file generated by the configuration.


stagesRequired
public readonly stages: string[];
  • Type: string[]

Groups jobs into stages.

All jobs in one stage must complete before next stage is executed. Defaults to ['build', 'test', 'deploy'].


variablesRequired
public readonly variables: {[ key: string ]: string | number | VariableConfig};

Global variables that are passed to jobs.

If the job already has that variable defined, the job-level variable takes precedence.


defaultArtifactsOptional
public readonly defaultArtifacts: Artifacts;

Default list of files and directories that should be attached to the job if it succeeds.

Artifacts are sent to Gitlab where they can be downloaded.


defaultCacheOptional
public readonly defaultCache: Cache[];

defaultImageOptional
public readonly defaultImage: Image;

Specifies the default docker image to use globally for all jobs.


defaultInterruptibleOptional
public readonly defaultInterruptible: boolean;
  • Type: boolean

The default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false).


defaultRetryOptional
public readonly defaultRetry: Retry;

How many times a job is retried if it fails.

If not defined, defaults to 0 and jobs do not retry.


defaultTimeoutOptional
public readonly defaultTimeout: string;
  • Type: string

A default timeout job written in natural language (Ex.

one hour, 3600 seconds, 60 minutes).


pagesOptional
public readonly pages: Job;

A special job used to upload static sites to Gitlab pages.

Requires a public/ directory with artifacts.path pointing to it.


workflowOptional
public readonly workflow: Workflow;

Used to control pipeline behavior.


nestedTemplatesRequired
public readonly nestedTemplates: {[ key: string ]: NestedConfiguration};

NestedConfiguration

A GitLab CI for templates that are created and included in the .gitlab-ci.yml file.

Initializers

import { gitlab } from 'projen'

new gitlab.NestedConfiguration(project: Project, parent: GitlabConfiguration, name: string, options?: CiConfigurationOptions)
NameTypeDescription
project
projen.ProjectNo description.
parent
GitlabConfiguration
No description.
name
stringThe name of the configuration.
options
CiConfigurationOptions
No description.

projectRequired
  • Type: projen.Project

parentRequired

nameRequired
  • Type: string

The name of the configuration.


optionsOptional

Methods

NameDescription
toString
Returns a string representation of this construct.
postSynthesize
Called after synthesis.
preSynthesize
Called before synthesis.
synthesize
Synthesizes files to the project output directory.
addDefaultCaches
Adds up to 4 default caches configuration to the CI configuration.
addGlobalVariables
Add a globally defined variable to the CI configuration.
addIncludes
Add additional yml/yaml files to the CI includes.
addJobs
Add jobs and their stages to the CI configuration.
addServices
Add additional services.
addStages
Add stages to the CI configuration if not already present.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

addDefaultCaches
public addDefaultCaches(caches: Cache[]): void

Adds up to 4 default caches configuration to the CI configuration.

cachesRequired

Caches to add.


addGlobalVariables
public addGlobalVariables(variables: {[ key: string ]: any}): void

Add a globally defined variable to the CI configuration.

variablesRequired
  • Type: {[ key: string ]: any}

The variables to add.


addIncludes
public addIncludes(includes: Include): void

Add additional yml/yaml files to the CI includes.

includesRequired

The includes to add.


addJobs
public addJobs(jobs: {[ key: string ]: Job}): void

Add jobs and their stages to the CI configuration.

jobsRequired
  • Type: {[ key: string ]: Job}

Jobs to add.


addServices
public addServices(services: Service): void

Add additional services.

servicesRequired

The services to add.


addStages
public addStages(stages: string): void

Add stages to the CI configuration if not already present.

stagesRequired
  • Type: string

stages to add.


Static Functions

NameDescription
isConstruct
Checks if x is a construct.
isComponent
Test whether the given construct is a component.

isConstruct
import { gitlab } from 'projen'

gitlab.NestedConfiguration.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { gitlab } from 'projen'

gitlab.NestedConfiguration.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
project
projen.ProjectNo description.
defaultAfterScript
string[]Defines default scripts that should run after all jobs.
defaultBeforeScript
string[]Defines default scripts that should run before all jobs.
defaultTags
string[]Used to select a specific runner from the list of all runners that are available for the project.
file
projen.YamlFileThe workflow YAML file.
jobs
{[ key: string ]: Job}
The jobs in the CI configuration.
name
stringThe name of the configuration.
path
stringPath to CI file generated by the configuration.
stages
string[]Groups jobs into stages.
variables
{[ key: string ]: string | number | VariableConfig}
Global variables that are passed to jobs.
defaultArtifacts
Artifacts
Default list of files and directories that should be attached to the job if it succeeds.
defaultCache
Cache[]
No description.
defaultImage
Image
Specifies the default docker image to use globally for all jobs.
defaultInterruptible
booleanThe default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false).
defaultRetry
Retry
How many times a job is retried if it fails.
defaultTimeout
stringA default timeout job written in natural language (Ex.
pages
Job
A special job used to upload static sites to Gitlab pages.
workflow
Workflow
Used to control pipeline behavior.
parent
GitlabConfiguration
No description.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

defaultAfterScriptRequired
public readonly defaultAfterScript: string[];
  • Type: string[]

Defines default scripts that should run after all jobs.

Can be overriden by the job level afterScript.


defaultBeforeScriptRequired
public readonly defaultBeforeScript: string[];
  • Type: string[]

Defines default scripts that should run before all jobs.

Can be overriden by the job level afterScript.


defaultTagsRequired
public readonly defaultTags: string[];
  • Type: string[]

Used to select a specific runner from the list of all runners that are available for the project.


fileRequired
public readonly file: YamlFile;
  • Type: projen.YamlFile

The workflow YAML file.


jobsRequired
public readonly jobs: {[ key: string ]: Job};
  • Type: {[ key: string ]: Job}

The jobs in the CI configuration.


nameRequired
public readonly name: string;
  • Type: string

The name of the configuration.


pathRequired
public readonly path: string;
  • Type: string

Path to CI file generated by the configuration.


stagesRequired
public readonly stages: string[];
  • Type: string[]

Groups jobs into stages.

All jobs in one stage must complete before next stage is executed. Defaults to ['build', 'test', 'deploy'].


variablesRequired
public readonly variables: {[ key: string ]: string | number | VariableConfig};

Global variables that are passed to jobs.

If the job already has that variable defined, the job-level variable takes precedence.


defaultArtifactsOptional
public readonly defaultArtifacts: Artifacts;

Default list of files and directories that should be attached to the job if it succeeds.

Artifacts are sent to Gitlab where they can be downloaded.


defaultCacheOptional
public readonly defaultCache: Cache[];

defaultImageOptional
public readonly defaultImage: Image;

Specifies the default docker image to use globally for all jobs.


defaultInterruptibleOptional
public readonly defaultInterruptible: boolean;
  • Type: boolean

The default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false).


defaultRetryOptional
public readonly defaultRetry: Retry;

How many times a job is retried if it fails.

If not defined, defaults to 0 and jobs do not retry.


defaultTimeoutOptional
public readonly defaultTimeout: string;
  • Type: string

A default timeout job written in natural language (Ex.

one hour, 3600 seconds, 60 minutes).


pagesOptional
public readonly pages: Job;

A special job used to upload static sites to Gitlab pages.

Requires a public/ directory with artifacts.path pointing to it.


workflowOptional
public readonly workflow: Workflow;

Used to control pipeline behavior.


parentRequired
public readonly parent: GitlabConfiguration;

Structs

AllowFailure

Exit code that are not considered failure.

The job fails for any other exit code. You can list which exit codes are not considered failures. The job fails for any other exit code.

https://docs.gitlab.com/ee/ci/yaml/#allow_failure

Initializer

import { gitlab } from 'projen'

const allowFailure: gitlab.AllowFailure = { ... }

Properties

NameTypeDescription
exitCodes
number | number[]No description.

exitCodesRequired
public readonly exitCodes: number | number[];
  • Type: number | number[]

Artifacts

Used to specify a list of files and directories that should be attached to the job if it succeeds.

Artifacts are sent to Gitlab where they can be downloaded.

https://docs.gitlab.com/ee/ci/yaml/#artifacts

Initializer

import { gitlab } from 'projen'

const artifacts: gitlab.Artifacts = { ... }

Properties

NameTypeDescription
exclude
string[]A list of paths to files/folders that should be excluded in the artifact.
expireIn
stringHow long artifacts should be kept.
exposeAs
stringCan be used to expose job artifacts in the merge request UI.
name
stringName for the archive created on job success.
paths
string[]A list of paths to files/folders that should be included in the artifact.
reports
Reports
Reports will be uploaded as artifacts, and often displayed in the Gitlab UI, such as in Merge Requests.
untracked
booleanWhether to add all untracked files (along with 'artifacts.paths') to the artifact.
when
CacheWhen
Configure when artifacts are uploaded depended on job status.

excludeOptional
public readonly exclude: string[];
  • Type: string[]

A list of paths to files/folders that should be excluded in the artifact.


expireInOptional
public readonly expireIn: string;
  • Type: string

How long artifacts should be kept.

They are saved 30 days by default. Artifacts that have expired are removed periodically via cron job. Supports a wide variety of formats, e.g. '1 week', '3 mins 4 sec', '2 hrs 20 min', '2h20min', '6 mos 1 day', '47 yrs 6 mos and 4d', '3 weeks and 2 days'.


exposeAsOptional
public readonly exposeAs: string;
  • Type: string

Can be used to expose job artifacts in the merge request UI.

GitLab will add a link <expose_as> to the relevant merge request that points to the artifact.


nameOptional
public readonly name: string;
  • Type: string

Name for the archive created on job success.

Can use variables in the name, e.g. '$CI_JOB_NAME'


pathsOptional
public readonly paths: string[];
  • Type: string[]

A list of paths to files/folders that should be included in the artifact.


reportsOptional
public readonly reports: Reports;

Reports will be uploaded as artifacts, and often displayed in the Gitlab UI, such as in Merge Requests.


untrackedOptional
public readonly untracked: boolean;
  • Type: boolean

Whether to add all untracked files (along with 'artifacts.paths') to the artifact.


whenOptional
public readonly when: CacheWhen;

Configure when artifacts are uploaded depended on job status.


Assets

Asset configuration for a release.

Initializer

import { gitlab } from 'projen'

const assets: gitlab.Assets = { ... }

Properties

NameTypeDescription
links
Link[]
Include asset links in the release.

linksRequired
public readonly links: Link[];

Include asset links in the release.


Cache

Cache Definition.

https://docs.gitlab.com/ee/ci/yaml/#cache

Initializer

import { gitlab } from 'projen'

const cache: gitlab.Cache = { ... }

Properties

NameTypeDescription
fallbackKeys
string[]Use cache:fallback_keys to specify a list of keys to try to restore cache from if there is no cache found for the cache:key.
key
string | CacheKeyFiles
Used the to give each cache a unique identifying key.
paths
string[]Defines which files or directories to cache.
policy
CachePolicy
Defines the upload and download behaviour of the cache.
untracked
booleanIf set to true all files that are untracked in your Git repository will be cached.
when
CacheWhen
Defines when to save the cache, based on the status of the job (Default: Job Success).

fallbackKeysOptional
public readonly fallbackKeys: string[];
  • Type: string[]

Use cache:fallback_keys to specify a list of keys to try to restore cache from if there is no cache found for the cache:key.

Caches are retrieved in the order specified in the fallback_keys section.


keyOptional
public readonly key: string | CacheKeyFiles;

Used the to give each cache a unique identifying key.

All jobs that use the same cache key use the same cache.


pathsOptional
public readonly paths: string[];
  • Type: string[]

Defines which files or directories to cache.


policyOptional
public readonly policy: CachePolicy;

Defines the upload and download behaviour of the cache.


untrackedOptional
public readonly untracked: boolean;
  • Type: boolean

If set to true all files that are untracked in your Git repository will be cached.


whenOptional
public readonly when: CacheWhen;

Defines when to save the cache, based on the status of the job (Default: Job Success).


CacheKeyFiles

Use this construct to generate a new key when one or two specific files change.

https://docs.gitlab.com/ee/ci/yaml/#cachekeyfiles

Initializer

import { gitlab } from 'projen'

const cacheKeyFiles: gitlab.CacheKeyFiles = { ... }

Properties

NameTypeDescription
files
string[]The files that are checked against.
prefix
stringAdds a custom prefix to the checksums computed.

filesRequired
public readonly files: string[];
  • Type: string[]

The files that are checked against.

If the SHA checksum changes, the cache becomes invalid.


prefixOptional
public readonly prefix: string;
  • Type: string

Adds a custom prefix to the checksums computed.


CiConfigurationOptions

Options for CiConfiguration.

Initializer

import { gitlab } from 'projen'

const ciConfigurationOptions: gitlab.CiConfigurationOptions = { ... }

Properties

NameTypeDescription
default
Default
Default settings for the CI Configuration.
jobs
{[ key: string ]: Job}
An initial set of jobs to add to the configuration.
pages
Job
A special job used to upload static sites to Gitlab pages.
stages
string[]Groups jobs into stages.
variables
{[ key: string ]: any}Global variables that are passed to jobs.
workflow
Workflow
Used to control pipeline behavior.

defaultOptional
public readonly default: Default;

Default settings for the CI Configuration.

Jobs that do not define one or more of the listed keywords use the value defined in the default section.


jobsOptional
public readonly jobs: {[ key: string ]: Job};
  • Type: {[ key: string ]: Job}

An initial set of jobs to add to the configuration.


pagesOptional
public readonly pages: Job;

A special job used to upload static sites to Gitlab pages.

Requires a public/ directory with artifacts.path pointing to it.


stagesOptional
public readonly stages: string[];
  • Type: string[]

Groups jobs into stages.

All jobs in one stage must complete before next stage is executed. If no stages are specified. Defaults to ['build', 'test', 'deploy'].


variablesOptional
public readonly variables: {[ key: string ]: any};
  • Type: {[ key: string ]: any}

Global variables that are passed to jobs.

If the job already has that variable defined, the job-level variable takes precedence.


workflowOptional
public readonly workflow: Workflow;

Used to control pipeline behavior.


CoverageReport

Code coverage report interface.

https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportscoverage_report

Initializer

import { gitlab } from 'projen'

const coverageReport: gitlab.CoverageReport = { ... }

Properties

NameTypeDescription
coverageFormat
stringNo description.
path
stringNo description.

coverageFormatRequired
public readonly coverageFormat: string;
  • Type: string

pathRequired
public readonly path: string;
  • Type: string

Default

Default settings for the CI Configuration.

Jobs that do not define one or more of the listed keywords use the value defined in the default section.

https://docs.gitlab.com/ee/ci/yaml/#default

Initializer

import { gitlab } from 'projen'

const default: gitlab.Default = { ... }

Properties

NameTypeDescription
afterScript
string[]No description.
artifacts
Artifacts
No description.
beforeScript
string[]No description.
cache
Cache[]
No description.
image
Image
No description.
interruptible
booleanNo description.
retry
Retry
No description.
services
Service[]
No description.
tags
string[]No description.
timeout
stringNo description.

afterScriptOptional
public readonly afterScript: string[];
  • Type: string[]

artifactsOptional
public readonly artifacts: Artifacts;

beforeScriptOptional
public readonly beforeScript: string[];
  • Type: string[]

cacheOptional
public readonly cache: Cache[];

imageOptional
public readonly image: Image;

interruptibleOptional
public readonly interruptible: boolean;
  • Type: boolean

retryOptional
public readonly retry: Retry;

servicesOptional
public readonly services: Service[];

tagsOptional
public readonly tags: string[];
  • Type: string[]

timeoutOptional
public readonly timeout: string;
  • Type: string

Engine

The engine configuration for a secret.

Initializer

import { gitlab } from 'projen'

const engine: gitlab.Engine = { ... }

Properties

NameTypeDescription
name
stringName of the secrets engine.
path
stringPath to the secrets engine.

nameRequired
public readonly name: string;
  • Type: string

Name of the secrets engine.


pathRequired
public readonly path: string;
  • Type: string

Path to the secrets engine.


Environment

The environment that a job deploys to.

Initializer

import { gitlab } from 'projen'

const environment: gitlab.Environment = { ... }

Properties

NameTypeDescription
name
stringThe name of the environment, e.g. 'qa', 'staging', 'production'.
action
Action
Specifies what this job will do.
autoStopIn
stringThe amount of time it should take before Gitlab will automatically stop the environment.
deploymentTier
DeploymentTier
Explicitly specifies the tier of the deployment environment if non-standard environment name is used.
kubernetes
KubernetesConfig
Used to configure the kubernetes deployment for this environment.
onStop
stringThe name of a job to execute when the environment is about to be stopped.
url
stringWhen set, this will expose buttons in various places for the current environment in Gitlab, that will take you to the defined URL.

nameRequired
public readonly name: string;
  • Type: string

The name of the environment, e.g. 'qa', 'staging', 'production'.


actionOptional
public readonly action: Action;

Specifies what this job will do.

'start' (default) indicates the job will start the deployment. 'prepare' indicates this will not affect the deployment. 'stop' indicates this will stop the deployment.


autoStopInOptional
public readonly autoStopIn: string;
  • Type: string

The amount of time it should take before Gitlab will automatically stop the environment.

Supports a wide variety of formats, e.g. '1 week', '3 mins 4 sec', '2 hrs 20 min', '2h20min', '6 mos 1 day', '47 yrs 6 mos and 4d', '3 weeks and 2 days'.


deploymentTierOptional
public readonly deploymentTier: DeploymentTier;

Explicitly specifies the tier of the deployment environment if non-standard environment name is used.


kubernetesOptional
public readonly kubernetes: KubernetesConfig;

Used to configure the kubernetes deployment for this environment.

This is currently not supported for kubernetes clusters that are managed by Gitlab.


onStopOptional
public readonly onStop: string;
  • Type: string

The name of a job to execute when the environment is about to be stopped.


urlOptional
public readonly url: string;
  • Type: string

When set, this will expose buttons in various places for the current environment in Gitlab, that will take you to the defined URL.


Filter

Filtering options for when a job will run.

Initializer

import { gitlab } from 'projen'

const filter: gitlab.Filter = { ... }

Properties

NameTypeDescription
changes
string[]Filter job creation based on files that were modified in a git push.
kubernetes
KubernetesEnum
Filter job based on if Kubernetes integration is active.
refs
string[]Control when to add jobs to a pipeline based on branch names or pipeline types.
variables
string[]Filter job by checking comparing values of environment variables.

changesOptional
public readonly changes: string[];
  • Type: string[]

Filter job creation based on files that were modified in a git push.


kubernetesOptional
public readonly kubernetes: KubernetesEnum;

Filter job based on if Kubernetes integration is active.


refsOptional
public readonly refs: string[];
  • Type: string[]

Control when to add jobs to a pipeline based on branch names or pipeline types.


variablesOptional
public readonly variables: string[];
  • Type: string[]

Filter job by checking comparing values of environment variables.

Read more about variable expressions: https://docs.gitlab.com/ee/ci/variables/README.html#variables-expressions


Image

Specifies the docker image to use for the job or globally for all jobs.

Job configuration takes precedence over global setting. Requires a certain kind of Gitlab runner executor.

https://docs.gitlab.com/ee/ci/yaml/#image

Initializer

import { gitlab } from 'projen'

const image: gitlab.Image = { ... }

Properties

NameTypeDescription
name
stringFull name of the image that should be used.
entrypoint
any[]Command or script that should be executed as the container's entrypoint.

nameRequired
public readonly name: string;
  • Type: string

Full name of the image that should be used.

It should contain the Registry part if needed.


entrypointOptional
public readonly entrypoint: any[];
  • Type: any[]

Command or script that should be executed as the container's entrypoint.

It will be translated to Docker's --entrypoint option while creating the container. The syntax is similar to Dockerfile's ENTRYPOINT directive, where each shell token is a separate string in the array.


Include

An included YAML file.

https://docs.gitlab.com/ee/ci/yaml/#include

Initializer

import { gitlab } from 'projen'

const include: gitlab.Include = { ... }

Properties

NameTypeDescription
file
string[]Files from another private project on the same GitLab instance.
local
stringRelative path from local repository root (/) to the yaml/yml file template.
project
stringPath to the project, e.g. group/project, or group/sub-group/project.
ref
stringBranch/Tag/Commit-hash for the target project.
remote
stringURL to a yaml/yml template file using HTTP/HTTPS.
rules
IncludeRule[]
Rules allows for an array of individual rule objects to be evaluated in order, until one matches and dynamically provides attributes to the job.
template
stringUse a .gitlab-ci.yml template as a base, e.g. Nodejs.gitlab-ci.yml.

fileOptional
public readonly file: string[];
  • Type: string[]

Files from another private project on the same GitLab instance.

You can use file in combination with project only.


localOptional
public readonly local: string;
  • Type: string

Relative path from local repository root (/) to the yaml/yml file template.

The file must be on the same branch, and does not work across git submodules.


projectOptional
public readonly project: string;
  • Type: string

Path to the project, e.g. group/project, or group/sub-group/project.


refOptional
public readonly ref: string;
  • Type: string

Branch/Tag/Commit-hash for the target project.


remoteOptional
public readonly remote: string;
  • Type: string

URL to a yaml/yml template file using HTTP/HTTPS.


rulesOptional
public readonly rules: IncludeRule[];

Rules allows for an array of individual rule objects to be evaluated in order, until one matches and dynamically provides attributes to the job.


templateOptional
public readonly template: string;
  • Type: string

Use a .gitlab-ci.yml template as a base, e.g. Nodejs.gitlab-ci.yml.


IncludeRule

Rules allows for an array of individual rule objects to be evaluated in order, until one matches and dynamically provides attributes to the job.

https://docs.gitlab.com/ee/ci/yaml/includes.html#use-rules-with-include

Initializer

import { gitlab } from 'projen'

const includeRule: gitlab.IncludeRule = { ... }

Properties

NameTypeDescription
allowFailure
boolean | AllowFailure
No description.
changes
string[]No description.
exists
string[]No description.
if
stringNo description.
startIn
stringNo description.
variables
{[ key: string ]: string}No description.
when
JobWhen
No description.

allowFailureOptional
public readonly allowFailure: boolean | AllowFailure;

changesOptional
public readonly changes: string[];
  • Type: string[]

existsOptional
public readonly exists: string[];
  • Type: string[]

ifOptional
public readonly if: string;
  • Type: string

startInOptional
public readonly startIn: string;
  • Type: string

variablesOptional
public readonly variables: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

whenOptional
public readonly when: JobWhen;

Inherit

Controls inheritance of globally-defined defaults and variables.

Boolean values control inheritance of all default: or variables: keywords. To inherit only a subset of default: or variables: keywords, specify what you wish to inherit. Anything not listed is not inherited.

Initializer

import { gitlab } from 'projen'

const inherit: gitlab.Inherit = { ... }

Properties

NameTypeDescription
default
boolean | DefaultElement[]
Whether to inherit all globally-defined defaults or not.
variables
boolean | string[]Whether to inherit all globally-defined variables or not.

defaultOptional
public readonly default: boolean | DefaultElement[];

Whether to inherit all globally-defined defaults or not.

Or subset of inherited defaults


variablesOptional
public readonly variables: boolean | string[];
  • Type: boolean | string[]

Whether to inherit all globally-defined variables or not.

Or subset of inherited variables


Job

Jobs are the most fundamental element of a .gitlab-ci.yml file.

https://docs.gitlab.com/ee/ci/jobs/

Initializer

import { gitlab } from 'projen'

const job: gitlab.Job = { ... }

Properties

NameTypeDescription
afterScript
string[]No description.
allowFailure
boolean | AllowFailure
Whether to allow the pipeline to continue running on job failure (Default: false).
artifacts
Artifacts
No description.
beforeScript
string[]No description.
cache
Cache[]
No description.
coverage
stringMust be a regular expression, optionally but recommended to be quoted, and must be surrounded with '/'.
dependencies
string[]Specify a list of job names from earlier stages from which artifacts should be loaded.
environment
string | Environment
Used to associate environment metadata with a deploy.
except
string[] | Filter
Job will run except for when these filtering options match.
extends
string[]The name of one or more jobs to inherit configuration from.
idTokens
{[ key: string ]: IDToken}
Configurable ID tokens (JSON Web Tokens) that are used for CI/CD authentication.
image
Image
No description.
inherit
Inherit
Controls inheritance of globally-defined defaults and variables.
interruptible
booleanNo description.
needs
string | Need[]
The list of jobs in previous stages whose sole completion is needed to start the current job.
only
string[] | Filter
Job will run only when these filtering options match.
parallel
number | Parallel
Parallel will split up a single job into several, and provide CI_NODE_INDEX and CI_NODE_TOTAL environment variables for the running jobs.
release
Release
Indicates that the job creates a Release.
resourceGroup
stringLimit job concurrency.
retry
Retry
No description.
rules
IncludeRule[]
Rules allows for an array of individual rule objects to be evaluated in order, until one matches and dynamically provides attributes to the job.
script
string[]Shell scripts executed by the Runner.
secrets
{[ key: string ]: {[ key: string ]: Secret}}
CI/CD secrets.
services
Service[]
No description.
stage
stringDefine what stage the job will run in.
startIn
stringNo description.
tags
string[]No description.
timeout
stringNo description.
trigger
string | Trigger
Trigger allows you to define downstream pipeline trigger.
variables
{[ key: string ]: string}Configurable values that are passed to the Job.
when
JobWhen
Describes the conditions for when to run the job.

afterScriptOptional
public readonly afterScript: string[];
  • Type: string[]

allowFailureOptional
public readonly allowFailure: boolean | AllowFailure;

Whether to allow the pipeline to continue running on job failure (Default: false).


artifactsOptional
public readonly artifacts: Artifacts;

beforeScriptOptional
public readonly beforeScript: string[];
  • Type: string[]

cacheOptional
public readonly cache: Cache[];

coverageOptional
public readonly coverage: string;
  • Type: string

Must be a regular expression, optionally but recommended to be quoted, and must be surrounded with '/'.

Example: '/Code coverage: \d+.\d+/'


dependenciesOptional
public readonly dependencies: string[];
  • Type: string[]

Specify a list of job names from earlier stages from which artifacts should be loaded.

By default, all previous artifacts are passed. Use an empty array to skip downloading artifacts.


environmentOptional
public readonly environment: string | Environment;

Used to associate environment metadata with a deploy.

Environment can have a name and URL attached to it, and will be displayed under /environments under the project.


exceptOptional
public readonly except: string[] | Filter;

Job will run except for when these filtering options match.


extendsOptional
public readonly extends: string[];
  • Type: string[]

The name of one or more jobs to inherit configuration from.


idTokensOptional
public readonly idTokens: {[ key: string ]: IDToken};

Configurable ID tokens (JSON Web Tokens) that are used for CI/CD authentication.


imageOptional
public readonly image: Image;

inheritOptional
public readonly inherit: Inherit;

Controls inheritance of globally-defined defaults and variables.

Boolean values control inheritance of all default: or variables: keywords. To inherit only a subset of default: or variables: keywords, specify what you wish to inherit. Anything not listed is not inherited.


interruptibleOptional
public readonly interruptible: boolean;
  • Type: boolean

needsOptional
public readonly needs: string | Need[];
  • Type: string | Need[]

The list of jobs in previous stages whose sole completion is needed to start the current job.


onlyOptional
public readonly only: string[] | Filter;

Job will run only when these filtering options match.


parallelOptional
public readonly parallel: number | Parallel;

Parallel will split up a single job into several, and provide CI_NODE_INDEX and CI_NODE_TOTAL environment variables for the running jobs.


releaseOptional
public readonly release: Release;

Indicates that the job creates a Release.


resourceGroupOptional
public readonly resourceGroup: string;
  • Type: string

Limit job concurrency.

Can be used to ensure that the Runner will not run certain jobs simultaneously.


retryOptional
public readonly retry: Retry;

rulesOptional
public readonly rules: IncludeRule[];

Rules allows for an array of individual rule objects to be evaluated in order, until one matches and dynamically provides attributes to the job.


scriptOptional
public readonly script: string[];
  • Type: string[]

Shell scripts executed by the Runner.

The only required property of jobs. Be careful with special characters (e.g. :, {, }, &) and use single or double quotes to avoid issues.


secretsOptional
public readonly secrets: {[ key: string ]: {[ key: string ]: Secret}};
  • Type: {[ key: string ]: {[ key: string ]: Secret}}

CI/CD secrets.


servicesOptional
public readonly services: Service[];

stageOptional
public readonly stage: string;
  • Type: string

Define what stage the job will run in.


startInOptional
public readonly startIn: string;
  • Type: string

tagsOptional
public readonly tags: string[];
  • Type: string[]

timeoutOptional
public readonly timeout: string;
  • Type: string

triggerOptional
public readonly trigger: string | Trigger;

Trigger allows you to define downstream pipeline trigger.

When a job created from trigger definition is started by GitLab, a downstream pipeline gets created. Read more: https://docs.gitlab.com/ee/ci/yaml/README.html#trigger


variablesOptional
public readonly variables: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Configurable values that are passed to the Job.


whenOptional
public readonly when: JobWhen;

Describes the conditions for when to run the job.

Defaults to 'on_success'.


KubernetesConfig

Used to configure the kubernetes deployment for this environment.

This is currently not supported for kubernetes clusters that are managed by Gitlab.

Initializer

import { gitlab } from 'projen'

const kubernetesConfig: gitlab.KubernetesConfig = { ... }

Properties

NameTypeDescription
namespace
stringThe kubernetes namespace where this environment should be deployed to.

namespaceOptional
public readonly namespace: string;
  • Type: string

The kubernetes namespace where this environment should be deployed to.


Link configuration for an asset.

Initializer

import { gitlab } from 'projen'

const link: gitlab.Link = { ... }

Properties

NameTypeDescription
name
stringThe name of the link.
url
stringThe URL to download a file.
filepath
stringThe redirect link to the url.
linkType
LinkType
The content kind of what users can download via url.

nameRequired
public readonly name: string;
  • Type: string

The name of the link.


urlRequired
public readonly url: string;
  • Type: string

The URL to download a file.


filepathOptional
public readonly filepath: string;
  • Type: string

The redirect link to the url.


linkTypeOptional
public readonly linkType: LinkType;

The content kind of what users can download via url.


Need

A jobs in a previous stage whose sole completion is needed to start the current job.

Initializer

import { gitlab } from 'projen'

const need: gitlab.Need = { ... }

Properties

NameTypeDescription
job
stringNo description.
artifacts
booleanNo description.
optional
booleanNo description.
pipeline
stringNo description.
project
stringNo description.
ref
stringNo description.

jobRequired
public readonly job: string;
  • Type: string

artifactsOptional
public readonly artifacts: boolean;
  • Type: boolean

optionalOptional
public readonly optional: boolean;
  • Type: boolean

pipelineOptional
public readonly pipeline: string;
  • Type: string

projectOptional
public readonly project: string;
  • Type: string

refOptional
public readonly ref: string;
  • Type: string

Parallel

Used to run a job multiple times in parallel in a single pipeline.

Initializer

import { gitlab } from 'projen'

const parallel: gitlab.Parallel = { ... }

Properties

NameTypeDescription
matrix
{[ key: string ]: any[]}[]Defines different variables for jobs that are running in parallel.

matrixRequired
public readonly matrix: {[ key: string ]: any[]}[];
  • Type: {[ key: string ]: any[]}[]

Defines different variables for jobs that are running in parallel.


Release

Indicates that the job creates a Release.

Initializer

import { gitlab } from 'projen'

const release: gitlab.Release = { ... }

Properties

NameTypeDescription
description
stringSpecifies the longer description of the Release.
tagName
stringThe tag_name must be specified.
assets
Assets
No description.
milestones
string[]The title of each milestone the release is associated with.
name
stringThe Release name.
ref
stringIf the release: tag_name doesn’t exist yet, the release is created from ref.
releasedAt
stringThe date and time when the release is ready.

descriptionRequired
public readonly description: string;
  • Type: string

Specifies the longer description of the Release.


tagNameRequired
public readonly tagName: string;
  • Type: string

The tag_name must be specified.

It can refer to an existing Git tag or can be specified by the user.


assetsOptional
public readonly assets: Assets;

milestonesOptional
public readonly milestones: string[];
  • Type: string[]

The title of each milestone the release is associated with.


nameOptional
public readonly name: string;
  • Type: string

The Release name.

If omitted, it is populated with the value of release: tag_name.


refOptional
public readonly ref: string;
  • Type: string

If the release: tag_name doesn’t exist yet, the release is created from ref.

ref can be a commit SHA, another tag name, or a branch name.


releasedAtOptional
public readonly releasedAt: string;
  • Type: string

The date and time when the release is ready.

Defaults to the current date and time if not defined. Should be enclosed in quotes and expressed in ISO 8601 format.


Reports

Reports will be uploaded as artifacts, and often displayed in the Gitlab UI, such as in Merge Requests.

https://docs.gitlab.com/ee/ci/yaml/#artifactsreports

Initializer

import { gitlab } from 'projen'

const reports: gitlab.Reports = { ... }

Properties

NameTypeDescription
cobertura
string[]Path for file(s) that should be parsed as Cobertura XML coverage report.
codequality
string[]Path to file or list of files with code quality report(s) (such as Code Climate).
containerScanning
string[]Path to file or list of files with Container scanning vulnerabilities report(s).
coverageReport
CoverageReport
Code coverage report information.
dast
string[]Path to file or list of files with DAST vulnerabilities report(s).
dependencyScanning
string[]Path to file or list of files with Dependency scanning vulnerabilities report(s).
dotenv
string[]Path to file or list of files containing runtime-created variables for this job.
junit
string[]Path for file(s) that should be parsed as JUnit XML result.
licenseManagement
string[]Deprecated in 12.8: Path to file or list of files with license report(s).
licenseScanning
string[]Path to file or list of files with license report(s).
lsif
string[]Path to file or list of files containing code intelligence (Language Server Index Format).
metrics
string[]Path to file or list of files with custom metrics report(s).
performance
string[]Path to file or list of files with performance metrics report(s).
requirements
string[]Path to file or list of files with requirements report(s).
sast
string[]Path to file or list of files with SAST vulnerabilities report(s).
secretDetection
string[]Path to file or list of files with secret detection report(s).
terraform
string[]Path to file or list of files with terraform plan(s).

coberturaOptional
public readonly cobertura: string[];
  • Type: string[]

Path for file(s) that should be parsed as Cobertura XML coverage report.


codequalityOptional
public readonly codequality: string[];
  • Type: string[]

Path to file or list of files with code quality report(s) (such as Code Climate).


containerScanningOptional
public readonly containerScanning: string[];
  • Type: string[]

Path to file or list of files with Container scanning vulnerabilities report(s).


coverageReportOptional
public readonly coverageReport: CoverageReport;

Code coverage report information.


dastOptional
public readonly dast: string[];
  • Type: string[]

Path to file or list of files with DAST vulnerabilities report(s).


dependencyScanningOptional
public readonly dependencyScanning: string[];
  • Type: string[]

Path to file or list of files with Dependency scanning vulnerabilities report(s).


dotenvOptional
public readonly dotenv: string[];
  • Type: string[]

Path to file or list of files containing runtime-created variables for this job.


junitOptional
public readonly junit: string[];
  • Type: string[]

Path for file(s) that should be parsed as JUnit XML result.


licenseManagementOptional
public readonly licenseManagement: string[];
  • Type: string[]

Deprecated in 12.8: Path to file or list of files with license report(s).


licenseScanningOptional
public readonly licenseScanning: string[];
  • Type: string[]

Path to file or list of files with license report(s).


lsifOptional
public readonly lsif: string[];
  • Type: string[]

Path to file or list of files containing code intelligence (Language Server Index Format).


metricsOptional
public readonly metrics: string[];
  • Type: string[]

Path to file or list of files with custom metrics report(s).


performanceOptional
public readonly performance: string[];
  • Type: string[]

Path to file or list of files with performance metrics report(s).


requirementsOptional
public readonly requirements: string[];
  • Type: string[]

Path to file or list of files with requirements report(s).


sastOptional
public readonly sast: string[];
  • Type: string[]

Path to file or list of files with SAST vulnerabilities report(s).


secretDetectionOptional
public readonly secretDetection: string[];
  • Type: string[]

Path to file or list of files with secret detection report(s).


terraformOptional
public readonly terraform: string[];
  • Type: string[]

Path to file or list of files with terraform plan(s).


Retry

How many times a job is retried if it fails.

If not defined, defaults to 0 and jobs do not retry.

https://docs.gitlab.com/ee/ci/yaml/#retry

Initializer

import { gitlab } from 'projen'

const retry: gitlab.Retry = { ... }

Properties

NameTypeDescription
max
number0 (default), 1, or 2.
when
anyEither a single or array of error types to trigger job retry.

maxOptional
public readonly max: number;
  • Type: number

0 (default), 1, or 2.


whenOptional
public readonly when: any;
  • Type: any

Either a single or array of error types to trigger job retry.


Secret

A CI/CD secret.

Initializer

import { gitlab } from 'projen'

const secret: gitlab.Secret = { ... }

Properties

NameTypeDescription
vault
VaultConfig
No description.

vaultRequired
public readonly vault: VaultConfig;

Service

Used to specify an additional Docker image to run scripts in.

The service image is linked to the image specified in the

https://docs.gitlab.com/ee/ci/yaml/#services

Initializer

import { gitlab } from 'projen'

const service: gitlab.Service = { ... }

Properties

NameTypeDescription
name
stringFull name of the image that should be used.
alias
stringAdditional alias that can be used to access the service from the job's container.
command
string[]Command or script that should be used as the container's command.
entrypoint
string[]Command or script that should be executed as the container's entrypoint.
pullPolicy
PullPolicy[]
The pull policy that the runner uses to fetch the Docker image.
variables
{[ key: string ]: string}Additional environment variables that are passed exclusively to the service..

nameRequired
public readonly name: string;
  • Type: string

Full name of the image that should be used.

It should contain the Registry part if needed.


aliasOptional
public readonly alias: string;
  • Type: string

Additional alias that can be used to access the service from the job's container.

Read Accessing the services for more information.


commandOptional
public readonly command: string[];
  • Type: string[]

Command or script that should be used as the container's command.

It will be translated to arguments passed to Docker after the image's name. The syntax is similar to Dockerfile's CMD directive, where each shell token is a separate string in the array.


entrypointOptional
public readonly entrypoint: string[];
  • Type: string[]

Command or script that should be executed as the container's entrypoint.

It will be translated to Docker's --entrypoint option while creating the container. The syntax is similar to Dockerfile's ENTRYPOINT directive, where each shell token is a separate string in the array.


pullPolicyOptional
public readonly pullPolicy: PullPolicy[];

The pull policy that the runner uses to fetch the Docker image.


variablesOptional
public readonly variables: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Additional environment variables that are passed exclusively to the service..


Trigger

Trigger a multi-project or a child pipeline.

Read more:

https://docs.gitlab.com/ee/ci/yaml/README.html#trigger-syntax-for-child-pipeline

Initializer

import { gitlab } from 'projen'

const trigger: gitlab.Trigger = { ... }

Properties

NameTypeDescription
branch
stringThe branch name that a downstream pipeline will use.
include
TriggerInclude[]
A list of local files or artifacts from other jobs to define the pipeline.
project
stringPath to the project, e.g. group/project, or group/sub-group/project.
strategy
Strategy
You can mirror the pipeline status from the triggered pipeline to the source bridge job by using strategy: depend.

branchOptional
public readonly branch: string;
  • Type: string

The branch name that a downstream pipeline will use.


includeOptional
public readonly include: TriggerInclude[];

A list of local files or artifacts from other jobs to define the pipeline.


projectOptional
public readonly project: string;
  • Type: string

Path to the project, e.g. group/project, or group/sub-group/project.


strategyOptional
public readonly strategy: Strategy;

You can mirror the pipeline status from the triggered pipeline to the source bridge job by using strategy: depend.


TriggerInclude

References a local file or an artifact from another job to define the pipeline configuration.

https://docs.gitlab.com/ee/ci/yaml/#triggerinclude

Initializer

import { gitlab } from 'projen'

const triggerInclude: gitlab.TriggerInclude = { ... }

Properties

NameTypeDescription
artifact
stringRelative path to the generated YAML file which is extracted from the artifacts and used as the configuration for triggering the child pipeline.
file
stringRelative path from repository root (/) to the pipeline configuration YAML file.
job
stringJob name which generates the artifact.
local
stringRelative path from local repository root (/) to the local YAML file to define the pipeline configuration.
project
stringPath to another private project under the same GitLab instance, like group/project or group/sub-group/project.
ref
stringBranch/Tag/Commit hash for the target project.
template
stringName of the template YAML file to use in the pipeline configuration.

artifactOptional
public readonly artifact: string;
  • Type: string

Relative path to the generated YAML file which is extracted from the artifacts and used as the configuration for triggering the child pipeline.


fileOptional
public readonly file: string;
  • Type: string

Relative path from repository root (/) to the pipeline configuration YAML file.


jobOptional
public readonly job: string;
  • Type: string

Job name which generates the artifact.


localOptional
public readonly local: string;
  • Type: string

Relative path from local repository root (/) to the local YAML file to define the pipeline configuration.


projectOptional
public readonly project: string;
  • Type: string

Path to another private project under the same GitLab instance, like group/project or group/sub-group/project.


refOptional
public readonly ref: string;
  • Type: string

Branch/Tag/Commit hash for the target project.


templateOptional
public readonly template: string;
  • Type: string

Name of the template YAML file to use in the pipeline configuration.


VariableConfig

Explains what the global variable is used for, what the acceptable values are.

https://docs.gitlab.com/ee/ci/yaml/#variables

Initializer

import { gitlab } from 'projen'

const variableConfig: gitlab.VariableConfig = { ... }

Properties

NameTypeDescription
description
stringDefine a global variable that is prefilled when running a pipeline manually.
value
stringThe variable value.

descriptionOptional
public readonly description: string;
  • Type: string

Define a global variable that is prefilled when running a pipeline manually.

Must be used with value.


valueOptional
public readonly value: string;
  • Type: string

The variable value.


VaultConfig

Specification for a secret provided by a HashiCorp Vault.

https://www.vaultproject.io/

Initializer

import { gitlab } from 'projen'

const vaultConfig: gitlab.VaultConfig = { ... }

Properties

NameTypeDescription
engine
Engine
No description.
field
stringNo description.
path
stringPath to the secret.

engineRequired
public readonly engine: Engine;

fieldRequired
public readonly field: string;
  • Type: string

pathRequired
public readonly path: string;
  • Type: string

Path to the secret.


Workflow

Used to control pipeline behavior.

https://docs.gitlab.com/ee/ci/yaml/#workflow

Initializer

import { gitlab } from 'projen'

const workflow: gitlab.Workflow = { ... }

Properties

NameTypeDescription
rules
WorkflowRule[]
Used to control whether or not a whole pipeline is created.

rulesOptional
public readonly rules: WorkflowRule[];

Used to control whether or not a whole pipeline is created.


WorkflowRule

Used to control whether or not a whole pipeline is created.

https://docs.gitlab.com/ee/ci/yaml/#workflowrules

Initializer

import { gitlab } from 'projen'

const workflowRule: gitlab.WorkflowRule = { ... }

Properties

NameTypeDescription
changes
string[]No description.
exists
string[]No description.
if
stringNo description.
variables
{[ key: string ]: string | number}No description.
when
JobWhen
No description.

changesOptional
public readonly changes: string[];
  • Type: string[]

existsOptional
public readonly exists: string[];
  • Type: string[]

ifOptional
public readonly if: string;
  • Type: string

variablesOptional
public readonly variables: {[ key: string ]: string | number};
  • Type: {[ key: string ]: string | number}

whenOptional
public readonly when: JobWhen;

Protocols

IDToken

id_tokens Definition.

https://docs.gitlab.com/ee/ci/yaml/#id_tokens

Properties

NameTypeDescription
aud
string | string[]The required aud sub-keyword is used to configure the aud claim for the JWT.

audRequired
public readonly aud: string | string[];
  • Type: string | string[]

The required aud sub-keyword is used to configure the aud claim for the JWT.


Enums

Action

Specifies what this job will do.

'start' (default) indicates the job will start the deployment. 'prepare' indicates this will not affect the deployment. 'stop' indicates this will stop the deployment.

Members

NameDescription
PREPARE
No description.
START
No description.
STOP
No description.

PREPARE

START

STOP

CachePolicy

Configure the upload and download behaviour of a cache.

https://docs.gitlab.com/ee/ci/yaml/#cachepolicy

Members

NameDescription
PULL
Only download the cache when the job starts, but never upload changes when the job finishes.
PUSH
Only upload a cache when the job finishes, but never download the cache when the job starts.
PULL_PUSH
The job downloads the cache when the job starts, and uploads changes to the cache when the job ends.

PULL

Only download the cache when the job starts, but never upload changes when the job finishes.


PUSH

Only upload a cache when the job finishes, but never download the cache when the job starts.


PULL_PUSH

The job downloads the cache when the job starts, and uploads changes to the cache when the job ends.


CacheWhen

Configure when artifacts are uploaded depended on job status.

https://docs.gitlab.com/ee/ci/yaml/#cachewhen

Members

NameDescription
ALWAYS
Upload artifacts regardless of job status.
ON_FAILURE
Upload artifacts only when the job fails.
ON_SUCCESS
Upload artifacts only when the job succeeds (this is the default).

ALWAYS

Upload artifacts regardless of job status.


ON_FAILURE

Upload artifacts only when the job fails.


ON_SUCCESS

Upload artifacts only when the job succeeds (this is the default).


DefaultElement

Members

NameDescription
AFTER_SCRIPT
No description.
ARTIFACTS
No description.
BEFORE_SCRIPT
No description.
CACHE
No description.
IMAGE
No description.
INTERRUPTIBLE
No description.
RETRY
No description.
SERVICES
No description.
TAGS
No description.
TIMEOUT
No description.

AFTER_SCRIPT

ARTIFACTS

BEFORE_SCRIPT

CACHE

IMAGE

INTERRUPTIBLE

RETRY

SERVICES

TAGS

TIMEOUT

DeploymentTier

Explicitly specifies the tier of the deployment environment if non-standard environment name is used.

Members

NameDescription
DEVELOPMENT
No description.
OTHER
No description.
PRODUCTION
No description.
STAGING
No description.
TESTING
No description.

DEVELOPMENT

OTHER

PRODUCTION

STAGING

TESTING

JobWhen

Describes the conditions for when to run the job.

Defaults to 'on_success'.

https://docs.gitlab.com/ee/ci/yaml/#when

Members

NameDescription
ALWAYS
No description.
DELAYED
No description.
MANUAL
No description.
NEVER
No description.
ON_FAILURE
No description.
ON_SUCCESS
No description.

ALWAYS

DELAYED

MANUAL

NEVER

ON_FAILURE

ON_SUCCESS

KubernetesEnum

Filter job based on if Kubernetes integration is active.

Members

NameDescription
ACTIVE
No description.

ACTIVE

LinkType

The content kind of what users can download via url.

Members

NameDescription
IMAGE
No description.
OTHER
No description.
PACKAGE
No description.
RUNBOOK
No description.

IMAGE

OTHER

PACKAGE

RUNBOOK

PullPolicy

Describes the conditions for when to pull an image.

https://docs.gitlab.com/ee/ci/yaml/#servicepull_policy

Members

NameDescription
ALWAYS
No description.
NEVER
No description.
IF_NOT_PRESENT
No description.

ALWAYS

NEVER

IF_NOT_PRESENT

Strategy

You can mirror the pipeline status from the triggered pipeline to the source bridge job by using strategy: depend.

https://docs.gitlab.com/ee/ci/yaml/#triggerstrategy

Members

NameDescription
DEPEND
No description.

DEPEND

WorkflowWhen

Describes the conditions for when to run the job.

Defaults to 'on_success'. The value can only be 'always' or 'never' when used with workflow.

https://docs.gitlab.com/ee/ci/yaml/#workflowrules

Members

NameDescription
ALWAYS
No description.
NEVER
No description.

ALWAYS

NEVER