Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
386060df
Commit
386060df
authored
Jul 22, 2020
by
Shinya Maeda
Committed by
Alessio Caiazza
Jul 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Describe more about backward compatibility on CI template dev guide
parent
3304ace8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
1 deletion
+40
-1
doc/development/cicd/templates.md
doc/development/cicd/templates.md
+40
-1
No files found.
doc/development/cicd/templates.md
View file @
386060df
...
@@ -8,6 +8,7 @@ All template files reside in the `lib/gitlab/ci/templates` directory, and are ca
...
@@ -8,6 +8,7 @@ All template files reside in the `lib/gitlab/ci/templates` directory, and are ca
| Sub-directroy | Content |
[
Selectable in UI
](
#make-sure-the-new-template-can-be-selected-in-ui
)
|
| Sub-directroy | Content |
[
Selectable in UI
](
#make-sure-the-new-template-can-be-selected-in-ui
)
|
|---------------|--------------------------------------------------------------|-----------------------------------------------------------------------|
|---------------|--------------------------------------------------------------|-----------------------------------------------------------------------|
|
`/AWS/*`
| Cloud Deployment (AWS) related jobs | No |
|
`/Jobs/*`
| Auto DevOps related jobs | Yes |
|
`/Jobs/*`
| Auto DevOps related jobs | Yes |
|
`/Pages/*`
| Static site generators for GitLab Pages (for example Jekyll) | Yes |
|
`/Pages/*`
| Static site generators for GitLab Pages (for example Jekyll) | Yes |
|
`/Security/*`
| Security related jobs | Yes |
|
`/Security/*`
| Security related jobs | Yes |
...
@@ -25,9 +26,37 @@ Also, all templates must be named with the `*.gitlab-ci.yml` suffix.
...
@@ -25,9 +26,37 @@ Also, all templates must be named with the `*.gitlab-ci.yml` suffix.
### Backward compatibility
### Backward compatibility
A template might be dynamically included with the
`include:template:`
keyword. If
A template might be dynamically included with the
`include:template:`
keyword. If
you make a change to an
*existing*
template, you
must
make sure that it won't break
you make a change to an
*existing*
template, you
**must**
make sure that it won't break
CI/CD in existing projects.
CI/CD in existing projects.
For example, changing a job name in a template could break pipelines in an existing project.
Let's say there is a template named
`Performance.gitlab-ci.yml`
with the following content:
```
yaml
performance
:
image
:
registry.gitlab.com/gitlab-org/verify-tools/performance:v0.1.0
script
:
./performance-test $TARGET_URL
```
and users include this template with passing an argument to the
`performance`
job.
This can be done by specifying the environment variable
`TARGET_URL`
in _their_
`.gitlab-ci.yml`
:
```
yaml
include
:
template
:
Performance.gitlab-ci.yml
performance
:
variables
:
TARGET_URL
:
https://awesome-app.com
```
If the job name
`performance`
in the template is renamed to
`browser-performance`
,
user's
`.gitlab-ci.yml`
will immediately cause a lint error because there
are no such jobs named
`performance`
in the included template anymore. Therefore,
users have to fix their
`.gitlab-ci.yml`
that could annoy their workflow.
Please read
[
versioning
](
#versioning
)
section for introducing breaking change safely.
## Testing
## Testing
Each CI/CD template must be tested in order to make sure that it's safe to be published.
Each CI/CD template must be tested in order to make sure that it's safe to be published.
...
@@ -64,3 +93,13 @@ You should write an RSpec test to make sure that pipeline jobs will be generated
...
@@ -64,3 +93,13 @@ You should write an RSpec test to make sure that pipeline jobs will be generated
A template could contain malicious code. For example, a template that contains the
`export`
shell command in a job
A template could contain malicious code. For example, a template that contains the
`export`
shell command in a job
might accidentally expose project secret variables in a job log.
might accidentally expose project secret variables in a job log.
If you're unsure if it's secure or not, you need to ask security experts for cross-validation.
If you're unsure if it's secure or not, you need to ask security experts for cross-validation.
## Versioning
Versioning allows you to introduce a new template without modifying the existing
one. This is useful process especially when we need to introduce a breaking change,
but don't want to affect the existing projects that depends on the current template.
There is an
[
open issue
](
https://gitlab.com/gitlab-org/gitlab/-/issues/17716
)
for
introducing versioning concept in GitLab Ci Template. Please follow the issue for
checking the progress.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment