SHARE
TWEET

Untitled

a guest Dec 6th, 2019 110 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. image: atlassian/pipelines-awscli
  2.  
  3. pipelines:
  4.   custom:
  5.     testBackendStep: &testBackendStep
  6.       - step:
  7.           image: python:3.8.0
  8.           name: Backend testing
  9.           caches:
  10.            - pip
  11.           script:
  12.            - cd backend
  13.             - pip install pipenv --upgrade
  14.             - pipenv install --dev --deploy --system
  15.             - python manage.py db upgrade
  16.             - tox
  17.           services:
  18.            - db
  19.     testFrontendStep: &testFrontendStep
  20.       - step:
  21.           image: node:12.11.1
  22.           name: Frontend testing
  23.           script:
  24.            - cd frontend
  25.             - npm i -D
  26.             - npm run test
  27.     testDeploymentStep: &testDeploymentStep
  28.       - step:
  29.           image: atlassian/pipelines-awscli
  30.           name: Deployment scripts testing
  31.           script:
  32.            - wget https://storage.googleapis.com/shellcheck/shellcheck-stable.linux.x86_64.tar.xz
  33.             - tar -xvf shellcheck-stable.linux.x86_64.tar.xz shellcheck-stable/shellcheck
  34.             - chmod u+x ./shellcheck-stable/shellcheck
  35.             - ./shellcheck-stable/shellcheck -x ./deployment/tests/run-tests.sh ./deployment/deploy.sh
  36.             - ./deployment/tests/run-tests.sh
  37.   default:
  38.     - parallel:
  39.         - <<: *testBackendStep
  40.         - <<: *testFrontendStep
  41.         - <<: *testDeploymentStep
  42.   branches:
  43.     develop:
  44.       - parallel:
  45.         - <<: *testBackendStep
  46.         - <<: *testFrontendStep
  47.         - <<: *testDeploymentStep
  48.       - step: &buildHelm
  49.           name: Build Helm Charts
  50.           image: alpine/helm:3.0.0-beta.5
  51.           script:
  52.            - export HELM_PATH="./deployment/fiat-system"
  53.             - helm init
  54.             - helm lint "${HELM_PATH}"
  55.             - helm package "${HELM_PATH}"
  56.           artifacts:
  57.            - fiat-system-0.1.0.tgz
  58.       - step: &build
  59.           name: Build & Push Image
  60.           image: atlassian/pipelines-awscli
  61.           script:
  62.            # Set ENV_TAG to "prod" on master branch
  63.             - '[[ $BITBUCKET_BRANCH == "master" ]] && ENV_TAG="prod" || ENV_TAG="dev"'
  64.             # Build docker image
  65.             - >
  66.              docker build
  67.               --file ./deployment/docker/Dockerfile
  68.               --no-cache
  69.               --tag "${AWS_REGISTRY_URL}:${BITBUCKET_COMMIT}"
  70.               --tag "${AWS_REGISTRY_URL}:${ENV_TAG}"
  71.               ./backend
  72.             # Log in docker client into AWS ECR
  73.             - eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION:-eu-west-1} --no-include-email)
  74.             # Push image to ECR
  75.             - docker push "${AWS_REGISTRY_URL}:${BITBUCKET_COMMIT}"
  76.             - docker push "${AWS_REGISTRY_URL}:${ENV_TAG}"
  77.           services:
  78.            - docker
  79.       - step: &deploy
  80.           name: Deploy to Kubernetes
  81.           image: atlassian/pipelines-awscli
  82.           deployment: staging
  83.           script:
  84.            - CHART_IMAGE="$AWS_REGISTRY_URL"
  85.             - CHART_IMAGE_TAG="$BITBUCKET_COMMIT"
  86.             - ./deployment/install-deploy-deps.sh
  87.             - ./deployment/deploy.sh -i -r "$RELEASE_NAME" -n "$NAMESPACE" -c fiat-system-0.1.0.tgz deploy
  88.     master:
  89.       - parallel:
  90.           - <<: *testBackendStep
  91.           - <<: *testFrontendStep
  92.           - <<: *testDeploymentStep
  93.       - step:
  94.           <<: *buildHelm
  95.       - step:
  96.           <<: *build
  97.       - step:
  98.           <<: *deploy
  99.           deployment: production
  100.  
  101. definitions:
  102.   services:
  103.     db:
  104.       image: postgres:latest
  105.       variables:
  106.         POSTGRES_DB: 'fiat-system'
  107.         POSTGRES_USER: 'postgres'
  108.         POSTGRES_PASSWORD: 'postgres'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top