Sign inSign up

myclau/rancher-pipeline-syn-gitlab-cicd

By myclau

•Updated over 6 years ago

allow rancher pipeline to wait gitlab cicd finsh and do deployment

Image
0

463

myclau/rancher-pipeline-syn-gitlab-cicd repository overview

⁠rancher_pipeline_syn_gitlab_cicd

allow rancher pipeline to wait gitlab cicd finsh and do deployment, Gitlab need at least version 10.2

⁠Environment Variable (must be fill before using)

Env VariableDescription
GITLAB_TOKENthis is the account for git lab , to create this login to gitlab > setting > access token > create
GITLAB_PIPELINE_URLthis 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_HOSTOnly use when GITLAB_PIPELINE_URL not set , define gitlabhost
GITLAB_PROJECTIDOnly 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
BRANCHthis is the branch you are targeting

⁠How to use

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

Tag summary

Content type

Image

Digest

Size

7.9 MB

Last updated

over 6 years ago

docker pull myclau/rancher-pipeline-syn-gitlab-cicd