thesuhu

Gitlab .gitlab-ci.yaml

Oct 12th, 2020
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.04 KB | None | 0 0
  1. # This file is a template, and might need editing before it works on your project.
  2. # Official docker image.
  3. stages:
  4.  - version
  5.   - build
  6.   - deploy
  7.  
  8. variables:
  9.   DOCKER_DRIVER: overlay
  10.  
  11.  
  12. version:
  13.   stage: version
  14.   image: mrooding/gitlab-semantic-versioning
  15.   script:
  16.    - python3 /version-update/version-update.py
  17.     - VERSSI=$(git describe --tags --always)
  18.     - echo "export VERSSI=$VERSSI" > .variables
  19.     - cat .variables
  20.   artifacts:
  21.     paths:
  22.    - .variables
  23.   only:
  24.   - master
  25.    
  26.  
  27. build-master:
  28.   stage: build
  29.   image: docker:18.09
  30.   services:
  31.    - docker:dind
  32.   before_script:
  33.    - docker login --username gitlab-ci-token --password $NPA_PASSWORD $Registry
  34.     - source .variables
  35.   script:
  36.    - docker build -t $Tagging:latest .
  37.     - docker tag $Tagging:latest $Tagging:$VERSSI
  38.     - docker push $Tagging:latest
  39.     - docker push $Tagging:$VERSSI
  40.   after_script:
  41.    - docker logout $Registry
  42.   only:
  43.    - master
  44.  
  45. build-staging:
  46.   stage: build
  47.   image: docker:18.09
  48.   services:
  49.    - docker:dind
  50.   before_script:
  51.    - docker login --username gitlab-ci-token --password $NPA_PASSWORD $Registry
  52.   script:
  53.    - docker build -t $Tagging:staging .
  54.     - docker push $Tagging:staging
  55.   after_script:
  56.    - docker logout $Registry
  57.   only:
  58.    - staging
  59.  
  60. build-devel:
  61.   stage: build
  62.   image: docker:18.09
  63.   services:
  64.    - docker:dind
  65.   before_script:
  66.    - docker login --username gitlab-ci-token --password $NPA_PASSWORD $Registry
  67.   script:
  68.    - docker build -t $Tagging:devel .
  69.     - docker push $Tagging:devel
  70.   after_script:
  71.    - docker logout $Registry
  72.   only:
  73.    - devel
  74.  
  75.  
  76. deploy-master:
  77.   stage: deploy
  78.   image: docker:18.09
  79.   services:
  80.    - docker:dind
  81.   script:
  82.    - $RunProd
  83.   only:
  84.    - master
  85.  
  86. deploy-staging:
  87.   stage: deploy
  88.   image: docker:18.09
  89.   services:
  90.    - docker:dind
  91.   script:
  92.    - $RunStag
  93.   only:
  94.    - staging
  95.  
  96. deploy-devel:
  97.   stage: deploy
  98.   image: docker:18.09
  99.   services:
  100.    - docker:dind
  101.   script:
  102.    - $RunDev
  103.   only:
  104.    - devel
Add Comment
Please, Sign In to add comment