@@ -33,7 +33,7 @@ glab auth login --stdin < token.txt
33
33
# View a list of issues
34
34
glab issue list
35
35
36
- # Create merge request for issue 123
36
+ # Create merge request for issue 123
37
37
glab mr create 123
38
38
39
39
# Check out the branch for merge request 243
@@ -113,6 +113,56 @@ To authenticate with your GitLab account, run `glab auth login`.
113
113
` glab ` also integrates with the [ 1Password shell plugin] ( https://developer.1password.com/docs/cli/shell-plugins/gitlab/ )
114
114
for secure authentication.
115
115
116
+ ## Examples
117
+
118
+ ### Run a CI/CD pipeline with variables from a file
119
+
120
+ The ` glab ci run ` command, when run with the ` -f ` (` --variables-from-string ` ) flag, uses values stored
121
+ in an external file. For example, add this code to your ` .gitlab-ci.yml ` file
122
+ to reference two variables:
123
+
124
+ ``` yaml
125
+ stages :
126
+ - build
127
+
128
+ # $EXAMPLE_VARIABLE_1 and $EXAMPLE_VARIABLE_2 are stored in another file
129
+ build-job :
130
+ stage : build
131
+ script :
132
+ - echo $EXAMPLE_VARIABLE_1
133
+ - echo $EXAMPLE_VARIABLE_2
134
+ - echo $CI_JOB_ID
135
+ ` ` `
136
+
137
+ Then, create a file named ` variables.json` to contain those variables:
138
+
139
+ ` ` ` json
140
+ [
141
+ {
142
+ "key": "EXAMPLE_VARIABLE_1",
143
+ "value": "example value 1"
144
+ },
145
+ {
146
+ "key": "EXAMPLE_VARIABLE_2",
147
+ "value": "example value 2"
148
+ }
149
+ ]
150
+ ` ` `
151
+
152
+ To start a CI/CD pipeline that includes the contents of `variables.json`, run this command, editing
153
+ the path to the file as needed :
154
+
155
+ ` ` ` shell
156
+ $ glab ci run --variables-file /tmp/variables.json`
157
+
158
+ $ echo $EXAMPLE_VARIABLE_1
159
+ example value 1
160
+ $ echo $EXAMPLE_VARIABLE_2
161
+ example value 2
162
+ $ echo $CI_JOB_ID
163
+ 9811701914
164
+ ```
165
+
116
166
## Report issues
117
167
118
168
Open an issue in the [ ` gitlab-org/cli ` repository] ( https://gitlab.com/gitlab-org/cli/-/issues/new )
0 commit comments