Skip to content

Commit

Permalink
📝 Add mapping of env variables when migrating from GitHub to GitLab
Browse files Browse the repository at this point in the history
  • Loading branch information
veit committed May 22, 2023
1 parent 6d07db7 commit 7eb1866
Showing 1 changed file with 131 additions and 0 deletions.
131 changes: 131 additions & 0 deletions docs/productive/git/gitlab/github-migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,134 @@ GitLab CI/CD syntax for database and service containers
- postgres
script:
- python -m pytest
Mapping the environment variables
---------------------------------

+-----------------------------------------------+-----------------------------------------------+
| GitHub | GitLab |
+===============================================+===============================================+
| ``${{ github.api_url }}`` | ``CI_API_V4_URL`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.workspace }}`` | ``CI_BUILDS_DIR`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.ref }}`` | ``CI_COMMIT_BRANCH``, |
| | ``CI_COMMIT_REF_NAME``, |
| | ``CI_COMMIT_REF_SLUG``, |
| | ``CI_COMMIT_TAG``, |
| | ``CI_MERGE_REQUEST_REF_PATH`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.sha }}`` | ``CI_COMMIT_SHA``, |
| | ``CI_COMMIT_SHORT_SHA`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.job }}`` | ``CI_JOB_ID``, |
| | ``CI_JOB_NAME`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.event_name == | ``CI_JOB_MANUAL`` |
| 'workflow_dispatch' }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ job.status }}`` | ``CI_JOB_STATUS`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.server_url }}/${{ | ``CI_MERGE_REQUEST_PROJECT_URL`` |
| github.repository }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.token }}`` | ``CI_NODE_INDEX`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ strategy.job-total }}`` | ``CI_NODE_TOTAL`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.repository}}/${{ | ``CI_PIPELINE_ID`` |
| github.workflow }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.workflow }}`` | ``CI_PIPELINE_IID`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.event_name }}`` | ``CI_PIPELINE_SOURCE`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.actions }}`` | ``CI_PIPELINE_TRIGGERED`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.server_url }}/${{ | ``CI_PIPELINE_URL`` |
| github.repository }}/actions/runs/${{ | |
| github.run_id }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.workspace }}`` | ``CI_PROJECT_DIR`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.repository }}`` | ``CI_PROJECT_ID`` |
| | ``CI_PROJECT_PATH_SLUG``, |
| | ``CI_PROJECT_PATH``, |
| | ``CI_MERGE_REQUEST_PROJECT_ID``, |
| | ``CI_MERGE_REQUEST_PROJECT_PATH`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.event.repository.name | ``CI_PROJECT_NAME`` |
| }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.repository_owner }}`` | ``CI_PROJECT_NAMESPACE`` |
| | ``CI_PROJECT_ROOT_NAMESPACE`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_PROJECT_TITLE`` |
| github.event.repository.full_name }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.server_url }}/${{ | ``CI_PROJECT_URL`` |
| github.repository }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_REPOSITORY_URL`` |
| github.event.repository.clone_url }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ runner.os }}`` | ``CI_RUNNER_EXECUTABLE_ARCH`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.server_url }}`` | ``CI_SERVER_HOST``, ``CI_SERVER_URL`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.actions }}`` | ``CI_SERVER``, ``GITLAB_CI`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.actor }}`` | ``GITLAB_USER_EMAIL``, |
| | ``GITLAB_USER_ID``, |
| | ``GITLAB_USER_LOGIN``, |
| | ``GITLAB_USER_NAME`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ github.event_path }}`` | ``TRIGGER_PAYLOAD`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_MERGE_REQUEST_ASSIGNEES`` |
| github.event.pull_request.assignees | |
| }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_MERGE_REQUEST_ID``, |
| github.event.pull_request.number }}`` | ``CI_MERGE_REQUEST_IID`` |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_MERGE_REQUEST_LABELS`` |
| github.event.pull_request.labels }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_MERGE_REQUEST_MILESTONE`` |
| github.event.pull_request.milestone | |
| }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ |``CI_MERGE_REQUEST_SOURCE_BRANCH_NAME``, |
| github.event.pull_request.head.ref }}`` |``CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_NAME``|
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_MERGE_REQUEST_SOURCE_BRANCH_SHA``, |
| github.event.pull_request.head.sha }}`` | ``CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_SHA``|
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_MERGE_REQUEST_SOURCE_BRANCH_SHA``, |
| github.event.pull_request.head.repo.full_name | ``CI_MERGE_REQUEST_SOURCE_PROJECT_PATH`` |
| }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_MERGE_REQUEST_SOURCE_PROJECT_URL`` |
| github.event.pull_request.head.repo.url }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ |``CI_MERGE_REQUEST_TARGET_BRANCH_NAME``, |
| github.event.pull_request.base.ref }}`` |``CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME``|
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_MERGE_REQUEST_TARGET_BRANCH_SHA``, |
| github.event.pull_request.base.sha }}`` | ``CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_SHA``|
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_MERGE_REQUEST_TITLE`` |
| github.event.pull_request.title }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_EXTERNAL_PULL_REQUEST_IID`` |
| github.event.pull_request.number }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ | ``CI_EXTERNAL_PULL_REQUEST_SOURCE_REPOSITORY``|
| github.event.pull_request.head.repo.full_name | |
| }}`` | |
+-----------------------------------------------+-----------------------------------------------+
| ``${{ |``RCI_EXTERNAL_PULL_REQUEST_TARGET_REPOSITORY``|
| github.event.pull_request.base.repo.full_name | |
| }}`` | |
+-----------------------------------------------+-----------------------------------------------+

0 comments on commit 7eb1866

Please sign in to comment.