Guest User

Untitled

a guest
Aug 28th, 2020
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.99 KB | None | 0 0
  1. image: docker:stable
  2.  
  3. variables:
  4.   DOCKER_TAG: $CI_BUILD_REF
  5.   IMAGE_COMMIT: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
  6.   IMAGE_TEST: $CI_REGISTRY_IMAGE:test
  7.   IMAGE_NEXT: $CI_REGISTRY_IMAGE:next
  8.   IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
  9.   IMAGE_STABLE: $CI_REGISTRY_IMAGE:stable
  10.   DOCKER_DRIVER: overlay2
  11.  
  12. before_script:
  13.  ##
  14.   ## Install ssh-agent if not already installed, it is required by Docker.
  15.   ## (change apt-get to yum if you use an RPM-based image)
  16.   ##
  17.   - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
  18.  
  19.   ##
  20.   ## Run ssh-agent (inside the build environment)
  21.   ##
  22.   - echo "$USER"
  23.   - eval $(ssh-agent -s)
  24.  
  25.   ##
  26.   ## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
  27.   ## We're using tr to fix line endings which makes ed25519 keys work
  28.   ## without extra base64 encoding.
  29.   ## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
  30.   ##
  31.   - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
  32.  
  33.   ##
  34.   ## Create the SSH directory and give it the right permissions
  35.   ##
  36.   - mkdir -p ~/.ssh
  37.   - chmod 700 ~/.ssh
  38.  
  39.   ##
  40.   ## Optionally, if you will be using any Git commands, set the user name and
  41.   ## and email.
  42.   ##
  43.   #- git config --global user.email "user@example.com"
  44.   #- git config --global user.name "User name"
  45.  
  46. stages:
  47.  - unit-testing
  48.   #- build-test-image
  49.   #- trigger-deploy-on-test-environment
  50.   #- build-next-image
  51.   #- trigger-deploy-on-next-environment
  52.   - build-stable-image
  53.   #- trigger-deploy-on-stable-environment
  54.  
  55. run-unit-tests:
  56.   stage: unit-testing
  57.   tags:
  58.    - docker
  59.   image:
  60.     name: tarampampam/node:12-alpine
  61.   script:
  62.    - yarn install
  63.     - yarn lint
  64.     - yarn test
  65.     #
  66.     # Merged realease notes stage
  67.     # Create release notes and upgrade version if branch is one of 'master', 'next', 'stable'
  68.     - echo $CI_COMMIT_BRANCH
  69.     - git branch
  70.     - if [[ "$CI_COMMIT_BRANCH" =~ ^(master|next|stable)$ ]]; then
  71.     - yarn release
  72.     - fi
Add Comment
Please, Sign In to add comment