allow rancher pipeline to wait gitlab cicd finsh and do deployment
463
allow rancher pipeline to wait gitlab cicd finsh and do deployment, Gitlab need at least version 10.2
| Env Variable | Description |
|---|---|
GITLAB_TOKEN | this is the account for git lab , to create this login to gitlab > setting > access token > create |
GITLAB_PIPELINE_URL | this is the pipeline url show be something like https://gitlab.example.com/api/v4/projects/:id/pipelines to find project id Enter the project -> On the Left Hand menu click Settings -> General -> Expand General Settings -> It has a label Project ID and is next to the project name |
GITLAB_HOST | Only use when GITLAB_PIPELINE_URL not set , define gitlabhost |
GITLAB_PROJECTID | Only use when GITLAB_PIPELINE_URL not set , define project id to find it: Enter the project -> On the Left Hand menu click Settings -> General -> Expand General Settings -> It has a label Project ID and is next to the project name |
BRANCH | this is the branch you are targeting |
setup the .rancger-pipeline.yml like this
stages:
- name: Wait docker image build ready in gitlab
steps:
- runScriptConfig:
image: myclau/rancher-pipeline-syn-gitlab-cicd
shellScript: docker-entrypoint.sh
env:
BRANCH: ${CICD_GIT_BRANCH}
GITLAB_PIPELINE_URL: <url>
GITLAB_TOKEN: <gitlab-access-token>
- name: Deploy
steps:
- applyYamlConfig:
path: ./deployment.yaml
timeout: 60
OR
stages:
- name: wait docker image ready
steps:
- runScriptConfig:
image: myclau/rancher-pipeline-syn-gitlab-cicd
shellScript: docker-entrypoint.sh
env:
BRANCH: ${CICD_GIT_BRANCH}
GITLAB_HOST: <url>
GITLAB_PROJECTID: <project id>
GITLAB_TOKEN: <gitlab-access-token>
- name: Deploy
steps:
- applyYamlConfig:
path: ./deployment.yaml
timeout: 60
if you want to put token into secret:
stages:
- name: wait docker image ready
steps:
- runScriptConfig:
image: myclau/rancher-pipeline-syn-gitlab-cicd
shellScript: docker-entrypoint.sh
env:
BRANCH: ${CICD_GIT_BRANCH}
GITLAB_PIPELINE_URL: <url>
envFrom:
- sourceName: <gitlab-access-token-secret-name>
sourceKey: token
targetKey: GITLAB_TOKEN
- name: Deploy
steps:
- applyYamlConfig:
path: ./deployment.yaml
timeout: 60
OR
stages:
- name: wait docker image ready
steps:
- runScriptConfig:
image: myclau/rancher-pipeline-syn-gitlab-cicd
shellScript: docker-entrypoint.sh
env:
BRANCH: ${CICD_GIT_BRANCH}
GITLAB_HOST: <url>
GITLAB_PROJECTID: <project id>
envFrom:
- sourceName: <gitlab-access-token-secret-name>
sourceKey: token
targetKey: GITLAB_TOKEN
- name: Deploy
steps:
- applyYamlConfig:
path: ./deployment.yaml
timeout: 60
Content type
Image
Digest
Size
7.9 MB
Last updated
over 6 years ago
docker pull myclau/rancher-pipeline-syn-gitlab-cicd