You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md
+57-52Lines changed: 57 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: Migrating from GitLab to GitHub Actions
3
-
intro: '{% data variables.product.prodname_actions %} and GitLab share several configuration similarities, which makes migrating to {% data variables.product.prodname_actions %} relatively straightforward.'
2
+
title: Migrating from GitLab CI/CD to GitHub Actions
3
+
intro: '{% data variables.product.prodname_actions %} and GitLab CI/CD share several configuration similarities, which makes migrating to {% data variables.product.prodname_actions %} relatively straightforward.'
4
4
versions:
5
5
free-pro-team: '*'
6
6
enterprise-server: '>=2.22'
@@ -11,31 +11,31 @@ versions:
11
11
12
12
### Introduction
13
13
14
-
GitLab and {% data variables.product.prodname_actions %} both allow you to create workflows that automatically build, test, publish, release, and deploy code. GitLab and {% data variables.product.prodname_actions %} share some similarities in workflow configuration:
14
+
GitLab CI/CD and {% data variables.product.prodname_actions %} both allow you to create workflows that automatically build, test, publish, release, and deploy code. GitLab CI/CD and {% data variables.product.prodname_actions %} share some similarities in workflow configuration:
15
15
16
16
- Workflow configuration files are written in YAML and are stored in the code's repository.
17
17
- Workflows include one or more jobs.
18
18
- Jobs include one or more steps or individual commands.
19
-
- Jobs can run on both managed or on self-hosted machines.
19
+
- Jobs can run on either managed or self-hosted machines.
20
20
21
-
There are a few differences, and this article will guide you to important differences so that you can easily migrate your workflow to GitHub Actions.
21
+
There are a few differences, and this guide will show you the important differences so that you can migrate your workflow to {% data variables.product.prodname_actions %}.
22
22
23
23
### Jobs
24
24
25
-
Jobs in GitLab are very similar to jobs in {% data variables.product.prodname_actions %}. In both systems, jobs have the following characteristics:
25
+
Jobs in GitLab CI/CD are very similar to jobs in {% data variables.product.prodname_actions %}. In both systems, jobs have the following characteristics:
26
26
27
27
* Jobs contain a series of steps or scripts that run sequentially.
28
-
* Jobs run on separate virtual machines or in separate containers.[ need to check]
28
+
* Jobs can run on separate machines or in separate containers.
29
29
* Jobs run in parallel by default, but can be configured to run sequentially.
30
30
31
-
You can run a script or a shell command in a job. In GitLab, script steps are specified using the `script` key. In {% data variables.product.prodname_actions %}, all scripts are specified using the `run` key.
31
+
You can run a script or a shell command in a job. In GitLab CI/CD, script steps are specified using the `script` key. In {% data variables.product.prodname_actions %}, all scripts are specified using the `run` key.
32
32
33
33
Below is an example of the syntax for each system:
34
34
35
35
<tableclass="d-block">
36
36
<tr>
37
37
<th>
38
-
GitLab
38
+
GitLab CI/CD
39
39
</th>
40
40
<th>
41
41
{% data variables.product.prodname_actions %}
@@ -48,7 +48,7 @@ GitLab
48
48
job1:
49
49
variables:
50
50
GIT_CHECKOUT: "true"
51
-
script:
51
+
script:
52
52
- echo "Run your script here"
53
53
```
54
54
{% endraw %}
@@ -69,17 +69,17 @@ jobs:
69
69
70
70
### Runners
71
71
72
-
Runners are machines on which the jobs run. Both GitLab and {% data variables.product.prodname_actions %} offers managed and self-hosted variants of runners. In GitLab, `tags` are used to run jobs on different platforms while the same is done in {% data variables.product.prodname_actions %} with a `runs-on` key.
72
+
Runners are machines on which the jobs run. Both GitLab CI/CD and {% data variables.product.prodname_actions %} offer managed and self-hosted variants of runners. In GitLab CI/CD, `tags` are used to run jobs on different platforms, while in {% data variables.product.prodname_actions %} it is done with the `runs-on` key.
73
73
74
-
Below is an example of the syntax for each system.
74
+
Below is an example of the syntax for each system:
75
75
76
76
<table>
77
77
<tr>
78
78
<th>
79
-
GitLab
79
+
GitLab CI/CD
80
80
</th>
81
81
<th>
82
-
GitHub Actions
82
+
{% data variables.product.prodname_actions %}
83
83
</th>
84
84
</tr>
85
85
<tr>
@@ -118,16 +118,18 @@ linux_job:
118
118
</tr>
119
119
</table>
120
120
121
-
### Docker Images
121
+
For more information, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)."
122
+
123
+
### Docker images
122
124
123
-
Both GitLab and {% data variables.product.prodname_actions %} support running steps inside of a Docker image. In GitLab, docker images are defined with a `image` key while in GitHub Actions, the same can be done with a `container` key.
125
+
Both GitLab CI/CD and {% data variables.product.prodname_actions %} support running jobs in a Docker image. In GitLab CI/CD, Docker images are defined with a `image` key, while in {% data variables.product.prodname_actions %} it is done with the `container` key.
124
126
125
127
Below is an example of the syntax for each system:
126
128
127
129
<table class="d-block">
128
130
<tr>
129
131
<th>
130
-
GitLab
132
+
GitLab CI/CD
131
133
</th>
132
134
<th>
133
135
{% data variables.product.prodname_actions %}
@@ -154,18 +156,18 @@ jobs:
154
156
</tr>
155
157
</table>
156
158
157
-
For more information, see "[Syntax for Containers](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainer)."
159
+
For more information, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainer)."
158
160
159
-
### Conditionals and Expression syntax
161
+
### Condition and expression syntax
160
162
161
-
GitLab uses `rules` to determine if the job will or will not run for a specific condition. GitHub Actions provide a `if` keyword to prevent a job from running unless a condition is met.
163
+
GitLab CI/CD uses `rules` to determine if a job will run for a specific condition. {% data variables.product.prodname_actions %} uses the `if` keyword to prevent a job from running unless a condition is met.
162
164
163
165
Below is an example of the syntax for each system:
164
166
165
167
<table class="d-block">
166
168
<tr>
167
169
<th>
168
-
GitLab
170
+
GitLab CI/CD
169
171
</th>
170
172
<th>
171
173
{% data variables.product.prodname_actions %}
@@ -189,9 +191,10 @@ deploy_prod:
189
191
```yaml
190
192
jobs:
191
193
deploy_prod:
192
-
if: contains( github.ref, 'master' )
194
+
if: contains( github.ref, 'master')
195
+
runs-on: ubuntu-latest
193
196
steps:
194
-
- run: echo "Deply to production server"
197
+
- run: echo "Deply to production server"
195
198
```
196
199
{% endraw %}
197
200
</td>
@@ -202,14 +205,14 @@ For more information, see "[Context and expression syntax for {% data variables.
202
205
203
206
### Dependencies between Jobs
204
207
205
-
Both GitLab and {% data variables.product.prodname_actions %} allow you to set dependencies for a job. In both systems, jobs run in parallel by default, but job dependencies can be specified explicitly with the `needs` key. GitLab also has a concept of `stages`, where jobs in a stage run concurrently, but the next stage will kick in once all the jobs in the previous stage has completed. You can easily recreate this scenario in GitHub Actions with the `needs` keys.
208
+
Both GitLab CI/CD and {% data variables.product.prodname_actions %} allow you to set dependencies for a job. In both systems, jobs run in parallel by default, but job dependencies in {% data variables.product.prodname_actions %} can be specified explicitly with the `needs` key. GitLab CI/CD also has a concept of `stages`, where jobs in a stage run concurrently, but the next stage will start when all the jobs in the previous stage have completed. You can recreate this scenario in {% data variables.product.prodname_actions %} with the `needs` key.
206
209
207
-
Below is an example of the syntax for each system. The workflows start with two jobs named `build_a` and `build_b`, and when these jobs complete, another job called `test_ab` will run. Finally, when this job complete, the job `deploy` will run.
210
+
Below is an example of the syntax for each system. The workflows start with two jobs named `build_a` and `build_b` running in parallel, and when those jobs complete, another job called `test_ab` will run. Finally, when `test_ab` completes, the `deploy_ab` job will run.
208
211
209
212
<table class="d-block">
210
213
<tr>
211
214
<th>
212
-
GitLab
215
+
GitLab CI/CD
213
216
</th>
214
217
<th>
215
218
{% data variables.product.prodname_actions %}
@@ -237,10 +240,10 @@ build_b:
237
240
test_ab:
238
241
stage: test
239
242
script:
240
-
- echo "This job will run after build_a and buil_b have finished."
243
+
- echo "This job will run after build_a and build_b have finished."
241
244
242
245
deploy_ab:
243
-
stage: test
246
+
stage: deploy
244
247
script:
245
248
- echo "This job will run after test_ab is complete"
246
249
```
@@ -264,44 +267,46 @@ jobs:
264
267
runs-on: ubuntu-latest
265
268
needs: [build_a,build_b]
266
269
steps:
267
-
- run: echo "This job will run after build_a and buil_b have finished"
270
+
- run: echo "This job will run after build_a and build_b have finished"
268
271
269
272
deploy_ab:
270
273
runs-on: ubuntu-latest
271
274
needs: [test_ab]
272
275
steps:
273
-
- run: echo "This job will run after test_ab is complete"
276
+
- run: echo "This job will run after test_ab is complete"
274
277
```
275
278
{% endraw %}
276
279
</td>
277
280
</tr>
278
281
</table>
279
282
280
-
### Scheduled Jobs
283
+
For more information, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds)."
281
284
282
-
Both GitLab and {% data variables.product.prodname_actions %} allow you to run workflows at a specific interval. In GitLab, pipeline schedules are configured with a UI, while in GitHub Actions, you can trigger a workflow on the scheduled interval with the "on" key.
285
+
### Scheduling workflows
283
286
284
-
For more information, see "[Scheduled events](/actions/reference/events-that-trigger-workflows#scheduled-events)."
287
+
Both GitLab CI/CD and {% data variables.product.prodname_actions %} allow you to run workflows at a specific interval. In GitLab CI/CD, pipeline schedules are configured with the UI, while in {% data variables.product.prodname_actions %} you can trigger a workflow on a scheduled interval with the "on" key.
285
288
286
-
### Variables and Secrets
289
+
For more information, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#scheduled-events)."
287
290
288
-
GitLab and {% data variables.product.prodname_actions %} support setting environment variables in the configuration file and creating secrets using the GitLab or {% data variables.product.product_name %} UI.
291
+
### Variables and secrets
289
292
290
-
For more information, see "[Using environment variables](/actions/configuring-and-managing-workflows/using-environment-variables)" and "[Creating and using encrypted secrets](/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)."
293
+
GitLab CI/CD and {% data variables.product.prodname_actions %} support setting environment variables in the pipeline or workflow configuration file, and creating secrets using the GitLab or {% data variables.product.product_name %} UI.
294
+
295
+
For more information, see "[Environment variables](/actions/reference/environment-variables)" and "[Encrypted secrets](/actions/reference/encrypted-secrets)."
291
296
292
297
### Caching
293
298
294
-
GitLab and {% data variables.product.prodname_actions %} provide a method to manually cache files in the configuration file.
299
+
GitLab CI/CD and {% data variables.product.prodname_actions %} provide a method in the configuration file to manually cache workflow files.
295
300
296
-
Below is an example of the syntax for each system.
301
+
Below is an example of the syntax for each system:
297
302
298
303
<table class="d-block">
299
304
<tr>
300
305
<th>
301
-
GitLab
306
+
GitLab CI/CD
302
307
</th>
303
308
<th>
304
-
GitHub Actions
309
+
{% data variables.product.prodname_actions %}
305
310
</th>
306
311
</tr>
307
312
<tr>
@@ -341,21 +346,21 @@ jobs:
341
346
</tr>
342
347
</table>
343
348
344
-
For more information, see "[Caching dependencies to speed up workflows](/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows)."
349
+
For more information, see "[Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows)."
345
350
346
351
### Artifacts
347
352
348
-
Both GitLab and {% data variables.product.prodname_actions %} provide `artifacts` to upload files and directories created by the job. In {% data variables.product.prodname_actions %}, artifacts can be used to persist data across multiple jobs.
353
+
Both GitLab CI/CD and {% data variables.product.prodname_actions %} can upload files and directories created by a job as artifacts. In {% data variables.product.prodname_actions %}, artifacts can be used to persist data across multiple jobs.
349
354
350
-
Below is an example of the syntax for each system.
355
+
Below is an example of the syntax for each system:
351
356
352
357
<table>
353
358
<tr>
354
359
<th>
355
-
GitLab
360
+
GitLab CI/CD
356
361
</th>
357
362
<th>
358
-
GitHub Actions
363
+
{% data variables.product.prodname_actions %}
359
364
</th>
360
365
</tr>
361
366
<tr>
@@ -383,23 +388,23 @@ artifacts:
383
388
</tr>
384
389
</table>
385
390
386
-
For more information, see "[Persisting workflow data using artifacts](/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts)."
391
+
For more information, see "[Storing workflow data as artifacts](/actions/guides/storing-workflow-data-as-artifacts)."
387
392
388
-
### Databases and Service containers
393
+
### Databases and service containers
389
394
390
395
Both systems enable you to include additional containers for databases, caching, or other dependencies.
391
396
392
-
In GitLab, primary containers are specified with a `image` key while {% data variables.product.prodname_actions %} use `container` key for primary containers. In both system additional containers can be specificed with `services` key.
397
+
In GitLab CI/CD, a container for the job is specified with the `image` key, while {% data variables.product.prodname_actions %} uses the `container` key. In both systems, additional service containers are specified with the `services` key.
393
398
394
-
Below is an example in GitLab and {% data variables.product.prodname_actions %} configuration syntax.
399
+
Below is an example of the syntax for each system:
395
400
396
401
<table class="d-block">
397
402
<tr>
398
403
<th>
399
-
GitLab
404
+
GitLab CI/CD
400
405
</th>
401
406
<th>
402
-
GitHub Actions
407
+
{% data variables.product.prodname_actions %}
403
408
</th>
404
409
</tr>
405
410
<tr>
@@ -468,4 +473,4 @@ jobs:
468
473
</tr>
469
474
</table>
470
475
471
-
For more information, see "[About service containers](/actions/configuring-and-managing-workflows/about-service-containers)."
476
+
For more information, see "[About service containers](/actions/guides/about-service-containers)."
0 commit comments