05-display-project-information
TODO
Part 1: define your own variables
-
Define 2 CI variables in the settings of the project (see § Help, Define CI variables in the CI/CD Settings section: -
FIRST_NAME
(set it with your first name) -
LAST_NAME
(set it with your last name)
-
-
create a merge request from this issue -
open the WebIDE -
update the .gitlab-ci.yml
file -
add a new stage: display_variables
-
add a new job: ci_variables
belonging todisplay_variables
-
add a script to this job to display your first name and your last name -
commit your changes, it will trigger the pipeline -
observe the pipeline -
observe the output of the pipeline -
don't merge on master
Part 2: use GitLab Predefined Variables
-
update the .gitlab-ci.yml
file -
add a new job: predefined_variables
belonging todisplay_variables
-
add a script to this job to display 2 CI variables: - The title of the commit - the full first line of the message:
CI_COMMIT_REF_NAME
- The branch or tag name for which project is built:
CI_COMMIT_TITLE
- The title of the commit - the full first line of the message:
-
commit your changes, it will trigger the pipeline -
observe the pipeline -
observe the output of the pipeline -
merge on master (the pipe will be triggered again)
Help
Define CI variables in the CI/CD Settings
- Go to the left panel menu and choose Settings/CI/CD
- Expand the Variables section (click on the Expand button):
CI/CD Settings - Click on the Add Variable button
- Add a
MESSAGE
variable whit this content:Hello people!
CI/CD Settings / Variables section - Uncheck the checkbox
Protect variable
- Click on the Add variable button
CI/CD Settings / Add a variable
MESSAGE
variable in the CI script of your project: echo "this is a message: $MESSAGE"
Predefined variables
Refs:
- Predefined variables https://docs.gitlab.com/ee/ci/variables/predefined_variables.html