gitlab
Submodule
Constructs
CiConfiguration
CI for GitLab.
A CI is a configurable automated process made up of one or more stages/jobs.
Initializers
import { gitlab } from 'projen'
new gitlab.CiConfiguration(project: Project, name: string, options?: CiConfigurationOptions)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
| string | No description. |
|
| No description. |
project
Required
- Type: projen.Project
name
Required
- Type: string
options
Optional
- Type: CiConfigurationOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds up to 4 default caches configuration to the CI configuration. |
| Add a globally defined variable to the CI configuration. |
| Add additional yml/yaml files to the CI includes. |
| Add jobs and their stages to the CI configuration. |
| Add additional services. |
| 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.
caches
Required
- Type: Cache[]
Caches to add.
addGlobalVariables
public addGlobalVariables(variables: {[ key: string ]: any}): void
Add a globally defined variable to the CI configuration.
variables
Required
- Type: {[ key: string ]: any}
The variables to add.
addIncludes
public addIncludes(includes: ...Include[]): void
Add additional yml/yaml files to the CI includes.
includes
Required
- Type: ...Include[]
The includes to add.
addJobs
public addJobs(jobs: {[ key: string ]: Job}): void
Add jobs and their stages to the CI configuration.
jobs
Required
- Type: {[ key: string ]: Job}
Jobs to add.
addServices
public addServices(services: ...Service[]): void
Add additional services.
services
Required
- Type: ...Service[]
The services to add.
addStages
public addStages(stages: ...string[]): void
Add stages to the CI configuration if not already present.
stages
Required
- Type: ...string[]
stages to add.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| 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.
x
Required
- Type: any
Any object.
isComponent
import { gitlab } from 'projen'
gitlab.CiConfiguration.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string[] | Defines default scripts that should run after all jobs. |
| string[] | Defines default scripts that should run before all jobs. |
| string[] | Used to select a specific runner from the list of all runners that are available for the project. |
| projen.YamlFile | The workflow YAML file. |
|
| The jobs in the CI configuration. |
| string | The name of the configuration. |
| string | Path to CI file generated by the configuration. |
| string[] | Groups jobs into stages. |
|
| Global variables that are passed to jobs. |
|
| Default list of files and directories that should be attached to the job if it succeeds. |
|
| No description. |
|
| Default ID tokens (JSON Web Tokens) that are used for CI/CD authentication to use globally for all jobs. |
|
| Specifies the default docker image to use globally for all jobs. |
| boolean | The default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false). |
|
| How many times a job is retried if it fails. |
| string | A default timeout job written in natural language (Ex. |
|
| A special job used to upload static sites to Gitlab pages. |
|
| Used to control pipeline behavior. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
defaultAfterScript
Required
public readonly defaultAfterScript: string[];
- Type: string[]
Defines default scripts that should run after all jobs.
Can be overriden by the job level afterScript
.
defaultBeforeScript
Required
public readonly defaultBeforeScript: string[];
- Type: string[]
Defines default scripts that should run before all jobs.
Can be overriden by the job level afterScript
.
defaultTags
Required
public readonly defaultTags: string[];
- Type: string[]
Used to select a specific runner from the list of all runners that are available for the project.
file
Required
public readonly file: YamlFile;
- Type: projen.YamlFile
The workflow YAML file.
jobs
Required
public readonly jobs: {[ key: string ]: Job};
- Type: {[ key: string ]: Job}
The jobs in the CI configuration.
name
Required
public readonly name: string;
- Type: string
The name of the configuration.
path
Required
public readonly path: string;
- Type: string
Path to CI file generated by the configuration.
stages
Required
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'].
variables
Required
public readonly variables: {[ key: string ]: string | number | VariableConfig};
- Type: {[ 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.
defaultArtifacts
Optional
public readonly defaultArtifacts: Artifacts;
- Type: 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.
defaultCache
Optional
public readonly defaultCache: Cache[];
- Type: Cache[]
defaultIdTokens
Optional
public readonly defaultIdTokens: {[ key: string ]: IDToken};
- Type: {[ key: string ]: IDToken}
Default ID tokens (JSON Web Tokens) that are used for CI/CD authentication to use globally for all jobs.
defaultImage
Optional
public readonly defaultImage: Image;
- Type: Image
Specifies the default docker image to use globally for all jobs.
defaultInterruptible
Optional
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).
defaultRetry
Optional
public readonly defaultRetry: Retry;
- Type: Retry
How many times a job is retried if it fails.
If not defined, defaults to 0 and jobs do not retry.
defaultTimeout
Optional
public readonly defaultTimeout: string;
- Type: string
A default timeout job written in natural language (Ex.
one hour, 3600 seconds, 60 minutes).
pages
Optional
public readonly pages: Job;
- Type: Job
A special job used to upload static sites to Gitlab pages.
Requires a public/
directory
with artifacts.path
pointing to it.
workflow
Optional
public readonly workflow: Workflow;
- Type: 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)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
|
| No description. |
project
Required
- Type: projen.Project
options
Optional
- Type: CiConfigurationOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds up to 4 default caches configuration to the CI configuration. |
| Add a globally defined variable to the CI configuration. |
| Add additional yml/yaml files to the CI includes. |
| Add jobs and their stages to the CI configuration. |
| Add additional services. |
| Add stages to the CI configuration if not already present. |
| 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.
caches
Required
- Type: Cache[]
Caches to add.
addGlobalVariables
public addGlobalVariables(variables: {[ key: string ]: any}): void
Add a globally defined variable to the CI configuration.
variables
Required
- Type: {[ key: string ]: any}
The variables to add.
addIncludes
public addIncludes(includes: ...Include[]): void
Add additional yml/yaml files to the CI includes.
includes
Required
- Type: ...Include[]
The includes to add.
addJobs
public addJobs(jobs: {[ key: string ]: Job}): void
Add jobs and their stages to the CI configuration.
jobs
Required
- Type: {[ key: string ]: Job}
Jobs to add.
addServices
public addServices(services: ...Service[]): void
Add additional services.
services
Required
- Type: ...Service[]
The services to add.
addStages
public addStages(stages: ...string[]): void
Add stages to the CI configuration if not already present.
stages
Required
- 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')
config
Required
- Type: {[ key: string ]: CiConfigurationOptions}
a record the names and configuraitons of the templates.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| 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.
x
Required
- Type: any
Any object.
isComponent
import { gitlab } from 'projen'
gitlab.GitlabConfiguration.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string[] | Defines default scripts that should run after all jobs. |
| string[] | Defines default scripts that should run before all jobs. |
| string[] | Used to select a specific runner from the list of all runners that are available for the project. |
| projen.YamlFile | The workflow YAML file. |
|
| The jobs in the CI configuration. |
| string | The name of the configuration. |
| string | Path to CI file generated by the configuration. |
| string[] | Groups jobs into stages. |
|
| Global variables that are passed to jobs. |
|
| Default list of files and directories that should be attached to the job if it succeeds. |
|
| No description. |
|
| Default ID tokens (JSON Web Tokens) that are used for CI/CD authentication to use globally for all jobs. |
|
| Specifies the default docker image to use globally for all jobs. |
| boolean | The default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false). |
|
| How many times a job is retried if it fails. |
| string | A default timeout job written in natural language (Ex. |
|
| A special job used to upload static sites to Gitlab pages. |
|
| Used to control pipeline behavior. |
|
| No description. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
defaultAfterScript
Required
public readonly defaultAfterScript: string[];
- Type: string[]
Defines default scripts that should run after all jobs.
Can be overriden by the job level afterScript
.
defaultBeforeScript
Required
public readonly defaultBeforeScript: string[];
- Type: string[]
Defines default scripts that should run before all jobs.
Can be overriden by the job level afterScript
.
defaultTags
Required
public readonly defaultTags: string[];
- Type: string[]
Used to select a specific runner from the list of all runners that are available for the project.
file
Required
public readonly file: YamlFile;
- Type: projen.YamlFile
The workflow YAML file.
jobs
Required
public readonly jobs: {[ key: string ]: Job};
- Type: {[ key: string ]: Job}
The jobs in the CI configuration.
name
Required
public readonly name: string;
- Type: string
The name of the configuration.
path
Required
public readonly path: string;
- Type: string
Path to CI file generated by the configuration.
stages
Required
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'].
variables
Required
public readonly variables: {[ key: string ]: string | number | VariableConfig};
- Type: {[ 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.
defaultArtifacts
Optional
public readonly defaultArtifacts: Artifacts;
- Type: 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.
defaultCache
Optional
public readonly defaultCache: Cache[];
- Type: Cache[]
defaultIdTokens
Optional
public readonly defaultIdTokens: {[ key: string ]: IDToken};
- Type: {[ key: string ]: IDToken}
Default ID tokens (JSON Web Tokens) that are used for CI/CD authentication to use globally for all jobs.
defaultImage
Optional
public readonly defaultImage: Image;
- Type: Image
Specifies the default docker image to use globally for all jobs.
defaultInterruptible
Optional
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).
defaultRetry
Optional
public readonly defaultRetry: Retry;
- Type: Retry
How many times a job is retried if it fails.
If not defined, defaults to 0 and jobs do not retry.
defaultTimeout
Optional
public readonly defaultTimeout: string;
- Type: string
A default timeout job written in natural language (Ex.
one hour, 3600 seconds, 60 minutes).
pages
Optional
public readonly pages: Job;
- Type: Job
A special job used to upload static sites to Gitlab pages.
Requires a public/
directory
with artifacts.path
pointing to it.
workflow
Optional
public readonly workflow: Workflow;
- Type: Workflow
Used to control pipeline behavior.
nestedTemplates
Required
public readonly nestedTemplates: {[ key: string ]: NestedConfiguration};
- Type: {[ 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)
Name | Type | Description |
---|---|---|
| projen.Project | No description. |
|
| No description. |
| string | The name of the configuration. |
|
| No description. |
project
Required
- Type: projen.Project
parent
Required
- Type: GitlabConfiguration
name
Required
- Type: string
The name of the configuration.
options
Optional
- Type: CiConfigurationOptions
Methods
Name | Description |
---|---|
| Returns a string representation of this construct. |
| Called after synthesis. |
| Called before synthesis. |
| Synthesizes files to the project output directory. |
| Adds up to 4 default caches configuration to the CI configuration. |
| Add a globally defined variable to the CI configuration. |
| Add additional yml/yaml files to the CI includes. |
| Add jobs and their stages to the CI configuration. |
| Add additional services. |
| 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.
caches
Required
- Type: Cache[]
Caches to add.
addGlobalVariables
public addGlobalVariables(variables: {[ key: string ]: any}): void
Add a globally defined variable to the CI configuration.
variables
Required
- Type: {[ key: string ]: any}
The variables to add.
addIncludes
public addIncludes(includes: ...Include[]): void
Add additional yml/yaml files to the CI includes.
includes
Required
- Type: ...Include[]
The includes to add.
addJobs
public addJobs(jobs: {[ key: string ]: Job}): void
Add jobs and their stages to the CI configuration.
jobs
Required
- Type: {[ key: string ]: Job}
Jobs to add.
addServices
public addServices(services: ...Service[]): void
Add additional services.
services
Required
- Type: ...Service[]
The services to add.
addStages
public addStages(stages: ...string[]): void
Add stages to the CI configuration if not already present.
stages
Required
- Type: ...string[]
stages to add.
Static Functions
Name | Description |
---|---|
| Checks if x is a construct. |
| 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.
x
Required
- Type: any
Any object.
isComponent
import { gitlab } from 'projen'
gitlab.NestedConfiguration.isComponent(x: any)
Test whether the given construct is a component.
x
Required
- Type: any
Properties
Name | Type | Description |
---|---|---|
| constructs.Node | The tree node. |
| projen.Project | No description. |
| string[] | Defines default scripts that should run after all jobs. |
| string[] | Defines default scripts that should run before all jobs. |
| string[] | Used to select a specific runner from the list of all runners that are available for the project. |
| projen.YamlFile | The workflow YAML file. |
|
| The jobs in the CI configuration. |
| string | The name of the configuration. |
| string | Path to CI file generated by the configuration. |
| string[] | Groups jobs into stages. |
|
| Global variables that are passed to jobs. |
|
| Default list of files and directories that should be attached to the job if it succeeds. |
|
| No description. |
|
| Default ID tokens (JSON Web Tokens) that are used for CI/CD authentication to use globally for all jobs. |
|
| Specifies the default docker image to use globally for all jobs. |
| boolean | The default behavior for whether a job should be canceled when a newer pipeline starts before the job completes (Default: false). |
|
| How many times a job is retried if it fails. |
| string | A default timeout job written in natural language (Ex. |
|
| A special job used to upload static sites to Gitlab pages. |
|
| Used to control pipeline behavior. |
|
| No description. |
node
Required
public readonly node: Node;
- Type: constructs.Node
The tree node.
project
Required
public readonly project: Project;
- Type: projen.Project
defaultAfterScript
Required
public readonly defaultAfterScript: string[];
- Type: string[]
Defines default scripts that should run after all jobs.
Can be overriden by the job level afterScript
.
defaultBeforeScript
Required
public readonly defaultBeforeScript: string[];
- Type: string[]
Defines default scripts that should run before all jobs.
Can be overriden by the job level afterScript
.
defaultTags
Required
public readonly defaultTags: string[];
- Type: string[]
Used to select a specific runner from the list of all runners that are available for the project.
file
Required
public readonly file: YamlFile;
- Type: projen.YamlFile
The workflow YAML file.
jobs
Required
public readonly jobs: {[ key: string ]: Job};
- Type: {[ key: string ]: Job}
The jobs in the CI configuration.
name
Required
public readonly name: string;
- Type: string
The name of the configuration.
path
Required
public readonly path: string;
- Type: string
Path to CI file generated by the configuration.
stages
Required
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'].
variables
Required
public readonly variables: {[ key: string ]: string | number | VariableConfig};
- Type: {[ 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.
defaultArtifacts
Optional
public readonly defaultArtifacts: Artifacts;
- Type: 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.
defaultCache
Optional
public readonly defaultCache: Cache[];
- Type: Cache[]
defaultIdTokens
Optional
public readonly defaultIdTokens: {[ key: string ]: IDToken};
- Type: {[ key: string ]: IDToken}
Default ID tokens (JSON Web Tokens) that are used for CI/CD authentication to use globally for all jobs.
defaultImage
Optional
public readonly defaultImage: Image;
- Type: Image
Specifies the default docker image to use globally for all jobs.
defaultInterruptible
Optional
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).
defaultRetry
Optional
public readonly defaultRetry: Retry;
- Type: Retry
How many times a job is retried if it fails.
If not defined, defaults to 0 and jobs do not retry.
defaultTimeout
Optional
public readonly defaultTimeout: string;
- Type: string
A default timeout job written in natural language (Ex.
one hour, 3600 seconds, 60 minutes).
pages
Optional
public readonly pages: Job;
- Type: Job
A special job used to upload static sites to Gitlab pages.
Requires a public/
directory
with artifacts.path
pointing to it.
workflow
Optional
public readonly workflow: Workflow;
- Type: Workflow
Used to control pipeline behavior.
parent
Required
public readonly parent: GitlabConfiguration;
- Type: 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.
Initializer
import { gitlab } from 'projen'
const allowFailure: gitlab.AllowFailure = { ... }
Properties
Name | Type | Description |
---|---|---|
| number | number[] | No description. |
exitCodes
Required
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.
Initializer
import { gitlab } from 'projen'
const artifacts: gitlab.Artifacts = { ... }
Properties
Name | Type | Description |
---|---|---|
| string[] | A list of paths to files/folders that should be excluded in the artifact. |
| string | How long artifacts should be kept. |
| string | Can be used to expose job artifacts in the merge request UI. |
| string | Name for the archive created on job success. |
| string[] | A list of paths to files/folders that should be included in the artifact. |
|
| Reports will be uploaded as artifacts, and often displayed in the Gitlab UI, such as in Merge Requests. |
| boolean | Whether to add all untracked files (along with 'artifacts.paths') to the artifact. |
|
| Configure when artifacts are uploaded depended on job status. |
exclude
Optional
public readonly exclude: string[];
- Type: string[]
A list of paths to files/folders that should be excluded in the artifact.
expireIn
Optional
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'.
exposeAs
Optional
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.
name
Optional
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'
paths
Optional
public readonly paths: string[];
- Type: string[]
A list of paths to files/folders that should be included in the artifact.
reports
Optional
public readonly reports: Reports;
- Type: Reports
Reports will be uploaded as artifacts, and often displayed in the Gitlab UI, such as in Merge Requests.
untracked
Optional
public readonly untracked: boolean;
- Type: boolean
Whether to add all untracked files (along with 'artifacts.paths') to the artifact.
when
Optional
public readonly when: CacheWhen;
- Type: 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
Name | Type | Description |
---|---|---|
|
| Include asset links in the release. |
links
Required
public readonly links: Link[];
- Type: Link[]
Include asset links in the release.
Cache
Cache Definition.
Initializer
import { gitlab } from 'projen'
const cache: gitlab.Cache = { ... }
Properties
Name | Type | Description |
---|---|---|
| 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. |
|
| Used the to give each cache a unique identifying key. |
| string[] | Defines which files or directories to cache. |
|
| Defines the upload and download behaviour of the cache. |
| boolean | If set to true all files that are untracked in your Git repository will be cached. |
|
| Defines when to save the cache, based on the status of the job (Default: Job Success). |
fallbackKeys
Optional
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.
key
Optional
public readonly key: string | CacheKeyFiles;
- Type: string | CacheKeyFiles
Used the to give each cache a unique identifying key.
All jobs that use the same cache key use the same cache.
paths
Optional
public readonly paths: string[];
- Type: string[]
Defines which files or directories to cache.
policy
Optional
public readonly policy: CachePolicy;
- Type: CachePolicy
Defines the upload and download behaviour of the cache.
untracked
Optional
public readonly untracked: boolean;
- Type: boolean
If set to true all files that are untracked in your Git repository will be cached.
when
Optional
public readonly when: CacheWhen;
- Type: 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.
Initializer
import { gitlab } from 'projen'
const cacheKeyFiles: gitlab.CacheKeyFiles = { ... }
Properties
Name | Type | Description |
---|---|---|
| string[] | The files that are checked against. |
| string | Adds a custom prefix to the checksums computed. |
files
Required
public readonly files: string[];
- Type: string[]
The files that are checked against.
If the SHA checksum changes, the cache becomes invalid.
prefix
Optional
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
Name | Type | Description |
---|---|---|
|
| Default settings for the CI Configuration. |
|
| An initial set of jobs to add to the configuration. |
|
| A special job used to upload static sites to Gitlab pages. |
| string | The path of the file to generate. |
| string[] | Groups jobs into stages. |
| {[ key: string ]: any} | Global variables that are passed to jobs. |
|
| Used to control pipeline behavior. |
default
Optional
public readonly default: Default;
- Type: 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.
jobs
Optional
public readonly jobs: {[ key: string ]: Job};
- Type: {[ key: string ]: Job}
An initial set of jobs to add to the configuration.
pages
Optional
public readonly pages: Job;
- Type: Job
A special job used to upload static sites to Gitlab pages.
Requires a public/
directory
with artifacts.path
pointing to it.
path
Optional
public readonly path: string;
- Type: string
The path of the file to generate.
stages
Optional
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'].
variables
Optional
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.
workflow
Optional
public readonly workflow: Workflow;
- Type: 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
Name | Type | Description |
---|---|---|
| string | No description. |
| string | No description. |
coverageFormat
Required
public readonly coverageFormat: string;
- Type: string
path
Required
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.
Initializer
import { gitlab } from 'projen'
const default: gitlab.Default = { ... }
Properties
Name | Type | Description |
---|---|---|
| string[] | No description. |
|
| No description. |
| string[] | No description. |
|
| No description. |
|
| Specifies the default ID tokens (JSON Web Tokens) that are used for CI/CD authentication to use globally for all jobs. |
|
| No description. |
| boolean | No description. |
|
| No description. |
|
| No description. |
| string[] | No description. |
| string | No description. |
afterScript
Optional
public readonly afterScript: string[];
- Type: string[]
artifacts
Optional
public readonly artifacts: Artifacts;
- Type: Artifacts
beforeScript
Optional
public readonly beforeScript: string[];
- Type: string[]
cache
Optional
public readonly cache: Cache[];
- Type: Cache[]
idTokens
Optional
public readonly idTokens: {[ key: string ]: IDToken};
- Type: {[ key: string ]: IDToken}
Specifies the default ID tokens (JSON Web Tokens) that are used for CI/CD authentication to use globally for all jobs.
image
Optional
public readonly image: Image;
- Type: Image
interruptible
Optional
public readonly interruptible: boolean;
- Type: boolean
retry
Optional
public readonly retry: Retry;
- Type: Retry
services
Optional
public readonly services: Service[];
- Type: Service[]
tags
Optional
public readonly tags: string[];
- Type: string[]
timeout
Optional
public readonly timeout: string;
- Type: string
Engine
The engine configuration for a secret.
Initializer
import { gitlab } from 'projen'
const engine: gitlab.Engine = { ... }
Properties
Name | Type | Description |
---|---|---|
| string | Name of the secrets engine. |
| string | Path to the secrets engine. |
name
Required
public readonly name: string;
- Type: string
Name of the secrets engine.
path
Required
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
Name | Type | Description |
---|---|---|
| string | The name of the environment, e.g. 'qa', 'staging', 'production'. |
|
| Specifies what this job will do. |
| string | The amount of time it should take before Gitlab will automatically stop the environment. |
|
| Explicitly specifies the tier of the deployment environment if non-standard environment name is used. |
|
| Used to configure the kubernetes deployment for this environment. |
| string | The name of a job to execute when the environment is about to be stopped. |
| string | When set, this will expose buttons in various places for the current environment in Gitlab, that will take you to the defined URL. |
name
Required
public readonly name: string;
- Type: string
The name of the environment, e.g. 'qa', 'staging', 'production'.
action
Optional
public readonly action: Action;
- Type: 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.
autoStopIn
Optional
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'.
deploymentTier
Optional
public readonly deploymentTier: DeploymentTier;
- Type: DeploymentTier
Explicitly specifies the tier of the deployment environment if non-standard environment name is used.
kubernetes
Optional
public readonly kubernetes: KubernetesConfig;
- Type: KubernetesConfig
Used to configure the kubernetes deployment for this environment.
This is currently not supported for kubernetes clusters that are managed by Gitlab.
onStop
Optional
public readonly onStop: string;
- Type: string
The name of a job to execute when the environment is about to be stopped.
url
Optional
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
Name | Type | Description |
---|---|---|
| string[] | Filter job creation based on files that were modified in a git push. |
|
| Filter job based on if Kubernetes integration is active. |
| string[] | Control when to add jobs to a pipeline based on branch names or pipeline types. |
| string[] | Filter job by checking comparing values of environment variables. |
changes
Optional
public readonly changes: string[];
- Type: string[]
Filter job creation based on files that were modified in a git push.
kubernetes
Optional
public readonly kubernetes: KubernetesEnum;
- Type: KubernetesEnum
Filter job based on if Kubernetes integration is active.
refs
Optional
public readonly refs: string[];
- Type: string[]
Control when to add jobs to a pipeline based on branch names or pipeline types.
variables
Optional
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.
Initializer
import { gitlab } from 'projen'
const image: gitlab.Image = { ... }
Properties
Name | Type | Description |
---|---|---|
| string | Full name of the image that should be used. |
| any[] | Command or script that should be executed as the container's entrypoint. |
name
Required
public readonly name: string;
- Type: string
Full name of the image that should be used.
It should contain the Registry part if needed.
entrypoint
Optional
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.
Initializer
import { gitlab } from 'projen'
const include: gitlab.Include = { ... }
Properties
Name | Type | Description |
---|---|---|
| string[] | Files from another private project on the same GitLab instance. |
| string | Relative path from local repository root (/ ) to the yaml /yml file template. |
| string | Path to the project, e.g. group/project , or group/sub-group/project . |
| string | Branch/Tag/Commit-hash for the target project. |
| string | URL to a yaml /yml template file using HTTP/HTTPS. |
|
| Rules allows for an array of individual rule objects to be evaluated in order, until one matches and dynamically provides attributes to the job. |
| string | Use a .gitlab-ci.yml template as a base, e.g. Nodejs.gitlab-ci.yml . |
file
Optional
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.
local
Optional
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.
project
Optional
public readonly project: string;
- Type: string
Path to the project, e.g. group/project
, or group/sub-group/project
.
ref
Optional
public readonly ref: string;
- Type: string
Branch/Tag/Commit-hash for the target project.
remote
Optional
public readonly remote: string;
- Type: string
URL to a yaml
/yml
template file using HTTP/HTTPS.
rules
Optional
public readonly rules: IncludeRule[];
- Type: 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
Optional
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
Name | Type | Description |
---|---|---|
|
| No description. |
| string[] | No description. |
| string[] | No description. |
| string | No description. |
| string[] | No description. |
| string | No description. |
| {[ key: string ]: string} | No description. |
|
| No description. |
allowFailure
Optional
public readonly allowFailure: boolean | AllowFailure;
- Type: boolean | AllowFailure
changes
Optional
public readonly changes: string[];
- Type: string[]
exists
Optional
public readonly exists: string[];
- Type: string[]
if
Optional
public readonly if: string;
- Type: string
needs
Optional
public readonly needs: string[];
- Type: string[]
startIn
Optional
public readonly startIn: string;
- Type: string
variables
Optional
public readonly variables: {[ key: string ]: string};
- Type: {[ key: string ]: string}
when
Optional
public readonly when: JobWhen;
- Type: 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
Name | Type | Description |
---|---|---|
|
| Whether to inherit all globally-defined defaults or not. |
| boolean | string[] | Whether to inherit all globally-defined variables or not. |
default
Optional
public readonly default: boolean | DefaultElement[];
- Type: boolean | DefaultElement[]
Whether to inherit all globally-defined defaults or not.
Or subset of inherited defaults
variables
Optional
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.
Initializer
import { gitlab } from 'projen'
const job: gitlab.Job = { ... }
Properties
Name | Type | Description |
---|---|---|
| string[] | No description. |
|
| Whether to allow the pipeline to continue running on job failure (Default: false). |
|
| No description. |
| string[] | No description. |
|
| No description. |
| string | Must be a regular expression, optionally but recommended to be quoted, and must be surrounded with '/'. |
| string[] | Specify a list of job names from earlier stages from which artifacts should be loaded. |
|
| Used to associate environment metadata with a deploy. |
|
| Job will run except for when these filtering options match. |
| string[] | The name of one or more jobs to inherit configuration from. |
|
| Configurable ID tokens (JSON Web Tokens) that are used for CI/CD authentication. |
|
| No description. |
|
| Controls inheritance of globally-defined defaults and variables. |
| boolean | No description. |
|
| The list of jobs in previous stages whose sole completion is needed to start the current job. |
|
| Job will run only when these filtering options match. |
|
| Parallel will split up a single job into several, and provide CI_NODE_INDEX and CI_NODE_TOTAL environment variables for the running jobs. |
|
| Indicates that the job creates a Release. |
| string | Limit job concurrency. |
|
| No description. |
|
| Rules allows for an array of individual rule objects to be evaluated in order, until one matches and dynamically provides attributes to the job. |
| string[] | Shell scripts executed by the Runner. |
|
| CI/CD secrets. |
|
| No description. |
| string | Define what stage the job will run in. |
| string | No description. |
| string[] | No description. |
| string | No description. |
|
| Trigger allows you to define downstream pipeline trigger. |
| {[ key: string ]: string} | Configurable values that are passed to the Job. |
|
| Describes the conditions for when to run the job. |
afterScript
Optional
public readonly afterScript: string[];
- Type: string[]
allowFailure
Optional
public readonly allowFailure: boolean | AllowFailure;
- Type: boolean | AllowFailure
Whether to allow the pipeline to continue running on job failure (Default: false).
artifacts
Optional
public readonly artifacts: Artifacts;
- Type: Artifacts
beforeScript
Optional
public readonly beforeScript: string[];
- Type: string[]
cache
Optional
public readonly cache: Cache[];
- Type: Cache[]
coverage
Optional
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+/'
dependencies
Optional
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.
environment
Optional
public readonly environment: string | Environment;
- Type: 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.
except
Optional
public readonly except: string[] | Filter;
- Type: string[] | Filter
Job will run except for when these filtering options match.
extends
Optional
public readonly extends: string[];
- Type: string[]
The name of one or more jobs to inherit configuration from.
idTokens
Optional
public readonly idTokens: {[ key: string ]: IDToken};
- Type: {[ key: string ]: IDToken}
Configurable ID tokens (JSON Web Tokens) that are used for CI/CD authentication.
image
Optional
public readonly image: Image;
- Type: Image
inherit
Optional
public readonly inherit: Inherit;
- Type: 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.
interruptible
Optional
public readonly interruptible: boolean;
- Type: boolean
needs
Optional
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.
only
Optional
public readonly only: string[] | Filter;
- Type: string[] | Filter
Job will run only when these filtering options match.
parallel
Optional
public readonly parallel: number | Parallel;
- Type: 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
Optional
public readonly release: Release;
- Type: Release
Indicates that the job creates a Release.
resourceGroup
Optional
public readonly resourceGroup: string;
- Type: string
Limit job concurrency.
Can be used to ensure that the Runner will not run certain jobs simultaneously.
retry
Optional
public readonly retry: Retry;
- Type: Retry
rules
Optional
public readonly rules: IncludeRule[];
- Type: 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
Optional
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.
secrets
Optional
public readonly secrets: {[ key: string ]: {[ key: string ]: Secret}};
- Type: {[ key: string ]: {[ key: string ]: Secret}}
CI/CD secrets.
services
Optional
public readonly services: Service[];
- Type: Service[]
stage
Optional
public readonly stage: string;
- Type: string
Define what stage the job will run in.
startIn
Optional
public readonly startIn: string;
- Type: string
tags
Optional
public readonly tags: string[];
- Type: string[]
timeout
Optional
public readonly timeout: string;
- Type: string
trigger
Optional
public readonly trigger: string | Trigger;
- Type: 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
variables
Optional
public readonly variables: {[ key: string ]: string};
- Type: {[ key: string ]: string}
Configurable values that are passed to the Job.