diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-07 18:19:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-07 18:19:19 +0300 |
commit | d4fcd1794ea9fc10d83cdc75490f76a418e59d52 (patch) | |
tree | b072bfe2c59dc666ddaa28c11e0c04a7971014e0 /doc/ci | |
parent | dfa6eac07553d5a3f254ee904e4298bd666b410f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/ci')
-rw-r--r-- | doc/ci/components/index.md | 48 | ||||
-rw-r--r-- | doc/ci/yaml/inputs.md | 8 |
2 files changed, 34 insertions, 22 deletions
diff --git a/doc/ci/components/index.md b/doc/ci/components/index.md index 9063b6d0378..338e4b2c205 100644 --- a/doc/ci/components/index.md +++ b/doc/ci/components/index.md @@ -29,6 +29,8 @@ A components repository is a GitLab project with a repository that hosts one or If a component requires different versioning from other components, the component should be migrated to its own components repository. +One component repository can have a maximum of 10 components. + ## Create a components repository To create a components repository, you must: @@ -65,17 +67,17 @@ the file structure should be similar to: ```plaintext ├── templates/ -│ └── only_template.yml +│ └── secret-detection.yml ├── README.md └── .gitlab-ci.yml ``` -This example component could be referenced with a path similar to `gitlab.com/my-username/my-component/only_template@<version>`, +This example component could be referenced with a path similar to `gitlab.com/my-namespace/my-project/secret-detection@<version>`, if the project is: - On GitLab.com -- Named `my-component` -- In a personal namespace named `my-username` +- Named `my-project` +- In a personal namespace or group named `my-namespace` The templates directory and the suffix of the configuration file should be excluded from the referenced path. @@ -85,26 +87,32 @@ If the project contains multiple components, then the file structure should be s ├── README.md ├── .gitlab-ci.yml └── templates/ - └── all-scans.yml + ├── all-scans.yml └── secret-detection.yml ``` These components would be referenced with these paths: -- `gitlab.com/my-username/my-component/all-scans` -- `gitlab.com/my-username/my-component/secret-detection` +- `gitlab.com/my-namespace/my-project/all-scans@<version>` +- `gitlab.com/my-namespace/my-project/secret-detection@<version>` + +You can also have components defined as a directory if you want to bundle together multiple related files. +In this case GitLab expects a `template.yml` file to be present: -You can omit the filename in the path if the configuration file is named `template.yml`. -For example, the following component could be referenced with `gitlab.com/my-username/my-component/dast`: +For example: ```plaintext ├── README.md ├── .gitlab-ci.yml -├── templates/ -│ └── dast -│ └── template.yml +└── templates/ + └── dast + ├── docs.md + ├── Dockerfile + └── template.yml ``` +In this example, the component could be referenced with `gitlab.com/my-namespace/my-project/dast@<version>`. + #### Component configurations saved in any directory (deprecated) WARNING: @@ -117,8 +125,8 @@ Components configurations can be saved through the following directory structure components, each file must be in a separate subdirectory. - `README.md`: A documentation file explaining the details of all the components in the repository. -For example, if the project is on GitLab.com, named `my-component`, and in a personal -namespace named `my-username`: +For example, if the project is on GitLab.com, named `my-project`, and in a personal +namespace named `my-namespace`: - Containing a single component and a simple pipeline to test the component, then the file structure might be: @@ -132,7 +140,7 @@ namespace named `my-username`: The `.gitlab-ci.yml` file is not required for a CI/CD component to work, but [testing the component](#test-the-component) in a pipeline in the project is recommended. - This component is referenced with the path `gitlab.com/my-username/my-component@<version>`. + This component is referenced with the path `gitlab.com/my-namespace/my-project@<version>`. - Containing one default component and multiple sub-components, then the file structure might be: @@ -149,9 +157,9 @@ namespace named `my-username`: These components are identified by these paths: - - `gitlab.com/my-username/my-component` - - `gitlab.com/my-username/my-component/unit` - - `gitlab.com/my-username/my-component/integration` + - `gitlab.com/my-namespace/my-project` + - `gitlab.com/my-namespace/my-project/unit` + - `gitlab.com/my-namespace/my-project/integration` It is possible to have a components repository with no default component, by having no `template.yml` in the root directory. @@ -205,7 +213,7 @@ For example: ```yaml include: - - component: gitlab.example.com/my-namespace/my-component@1.0 + - component: gitlab.example.com/my-namespace/my-project@1.0 inputs: stage: build ``` @@ -410,7 +418,7 @@ For example: ```yaml include: # include the component located in the current project from the current SHA - - component: gitlab.com/$CI_PROJECT_PATH/my-component@$CI_COMMIT_SHA + - component: gitlab.com/$CI_PROJECT_PATH/my-project@$CI_COMMIT_SHA inputs: stage: build diff --git a/doc/ci/yaml/inputs.md b/doc/ci/yaml/inputs.md index 9e084cf0020..cf5040408a2 100644 --- a/doc/ci/yaml/inputs.md +++ b/doc/ci/yaml/inputs.md @@ -14,7 +14,8 @@ and subject to change without notice. ## Define input parameters with `spec:inputs` -> `description` keyword [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/415637) in GitLab 16.5. +> - `description` keyword [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/415637) in GitLab 16.5. +> - `options` keyword [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/393401) in GitLab 16.6. Use `spec:inputs` to define input parameters for CI/CD configuration intended to be added to a pipeline with `include`. Use [`include:inputs`](#set-input-parameter-values-with-includeinputs) @@ -43,6 +44,8 @@ When using `spec:inputs`: - Defined inputs are mandatory by default. - Inputs can be made optional by specifying a `default`. Use `default: null` to have no default value. +- Inputs can use `options` to specify a list of allowed values for an input. The limit is 50 options per input. +- If an input uses both `default` and `options`, the default value must be one of the listed options. If not, the pipeline fails with a validation error. - You can optionally use `description` to give a description to a specific input. - A string containing an interpolation block must not exceed 1 MB. - The string inside an interpolation block must not exceed 1 KB. @@ -55,6 +58,7 @@ spec: website: user: default: 'test-user' + options: ['test-user', 'admin-user'] flags: default: null description: 'Sample description of the `flags` input detail.' @@ -66,7 +70,7 @@ spec: In this example: - `website` is mandatory and must be defined. -- `user` is optional. If not defined, the value is `test-user`. +- `user` is optional. If not defined, the value is `test-user`, which is one of the values specified in `options`. - `flags` is optional. If not defined, it has no value. The optional description should give details about the input. ## Set input parameter values with `include:inputs` |