Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- variables:
- DEPLOY_ENV: "staging"
- NODE_IMAGE: node:12.13.0-alpine
- image: $NODE_IMAGE
- stages:
- - install_modules
- - build_and_test
- - build_docker
- - deploy
- .cache:
- cache:
- key:
- files:
- - package.json
- - yarn.lock
- paths:
- - node_modules/
- - npm-packages-offline-cache/
- install_modules:
- extends: .cache
- stage: install_modules
- script:
- - yarn config set yarn-offline-mirror $PWD/npm-packages-offline-cache
- - yarn config set install.prefer-offline true
- - yarn
- install_prod_modules:
- extends: .cache
- stage: install_modules
- artifacts:
- paths:
- - node_modules_prod/
- expire_in: 30 mins
- script:
- - yarn install --production --modules-folder node_modules_prod/
- cache:
- policy: pull
- .build_node:
- extends: .cache
- needs:
- - install_prod_modules
- - install_modules
- script:
- - yarn run build
- artifacts:
- paths:
- - node_modules_prod/
- - build/
- expire_in: 30 mins
- cache:
- policy: pull
- build-stage:
- stage: build_and_test
- extends: .build_node
- variables:
- DEPLOY_ENV: "staging"
- except:
- - master
- - tags
- build-prod:
- stage: build_and_test
- extends: .build_node
- variables:
- DEPLOY_ENV: "production"
- only:
- - master
- - tags
- lint:
- extends: .cache
- needs:
- - install_modules
- stage: build_and_test
- allow_failure: true
- script:
- - yarn lint
- cache:
- policy: pull
- test:
- extends: .cache
- needs:
- - install_modules
- stage: build_and_test
- allow_failure: true
- script:
- - yarn test -w 2
- cache:
- policy: pull
- build-docker:
- stage: build_docker
- image: docker:19.03.11
- variables:
- ...
- before_script:
- - docker info
- - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- ...
- tags:
- - docker-socket
- .deploy-kubernetes:
- stage: deploy
- image: dtzar/helm-kubectl:3.2.1
- dependencies: []
- needs:
- - build-docker
- variables:
- ...
- before_script:
- - export KUBECONFIG=$K8S_STAGING_CONF
- script:
- ...
- deploy-branch:
- extends: .deploy-kubernetes
- environment:
- ...
- before_script:
- - ls -la
- - apk add --update --no-cache bash curl unzip
- - curl -s https://rclone.org/install.sh | bash &> /dev/null
- - rclone --config ${RCLONE_CONFIG} copy ./build/ ${SELECTEL_CLOUD}/
- variables:
- ...
- when: manual
- deploy-staging:
- extends: .deploy-kubernetes
- environment:
- ...
- variables:
- ...
- only:
- - develop
- - release/*
- deploy-production:
- extends: .deploy-kubernetes
- variables:
- ...
- environment:
- ...
- before_script:
- - export KUBECONFIG=$K8S_PRODUCTION_CONF
- only:
- - master
- - tags
- when: manual
- check-build:
- stage: deploy
- before_script:
- - cat /etc/os-release && ls -la
- script:
- - echo test
Add Comment
Please, Sign In to add comment