Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- image: atlassian/pipelines-awscli
- pipelines:
- custom:
- testBackendStep: &testBackendStep
- - step:
- image: python:3.8.0
- name: Backend testing
- caches:
- - pip
- script:
- - cd backend
- - pip install pipenv --upgrade
- - pipenv install --dev --deploy --system
- - python manage.py db upgrade
- - tox
- services:
- - db
- testFrontendStep: &testFrontendStep
- - step:
- image: node:12.11.1
- name: Frontend testing
- script:
- - cd frontend
- - npm i -D
- - npm run test
- testDeploymentStep: &testDeploymentStep
- - step:
- image: atlassian/pipelines-awscli
- name: Deployment scripts testing
- script:
- - wget https://storage.googleapis.com/shellcheck/shellcheck-stable.linux.x86_64.tar.xz
- - tar -xvf shellcheck-stable.linux.x86_64.tar.xz shellcheck-stable/shellcheck
- - chmod u+x ./shellcheck-stable/shellcheck
- - ./shellcheck-stable/shellcheck -x ./deployment/tests/run-tests.sh ./deployment/deploy.sh
- - ./deployment/tests/run-tests.sh
- default:
- - parallel:
- - <<: *testBackendStep
- - <<: *testFrontendStep
- - <<: *testDeploymentStep
- branches:
- develop:
- - parallel:
- - <<: *testBackendStep
- - <<: *testFrontendStep
- - <<: *testDeploymentStep
- - step: &buildHelm
- name: Build Helm Charts
- image: alpine/helm:3.0.0-beta.5
- script:
- - export HELM_PATH="./deployment/fiat-system"
- - helm init
- - helm lint "${HELM_PATH}"
- - helm package "${HELM_PATH}"
- artifacts:
- - fiat-system-0.1.0.tgz
- - step: &build
- name: Build & Push Image
- image: atlassian/pipelines-awscli
- script:
- # Set ENV_TAG to "prod" on master branch
- - '[[ $BITBUCKET_BRANCH == "master" ]] && ENV_TAG="prod" || ENV_TAG="dev"'
- # Build docker image
- - >
- docker build
- --file ./deployment/docker/Dockerfile
- --no-cache
- --tag "${AWS_REGISTRY_URL}:${BITBUCKET_COMMIT}"
- --tag "${AWS_REGISTRY_URL}:${ENV_TAG}"
- ./backend
- # Log in docker client into AWS ECR
- - eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION:-eu-west-1} --no-include-email)
- # Push image to ECR
- - docker push "${AWS_REGISTRY_URL}:${BITBUCKET_COMMIT}"
- - docker push "${AWS_REGISTRY_URL}:${ENV_TAG}"
- services:
- - docker
- - step: &deploy
- name: Deploy to Kubernetes
- image: atlassian/pipelines-awscli
- deployment: staging
- script:
- - CHART_IMAGE="$AWS_REGISTRY_URL"
- - CHART_IMAGE_TAG="$BITBUCKET_COMMIT"
- - ./deployment/install-deploy-deps.sh
- - ./deployment/deploy.sh -i -r "$RELEASE_NAME" -n "$NAMESPACE" -c fiat-system-0.1.0.tgz deploy
- master:
- - parallel:
- - <<: *testBackendStep
- - <<: *testFrontendStep
- - <<: *testDeploymentStep
- - step:
- <<: *buildHelm
- - step:
- <<: *build
- - step:
- <<: *deploy
- deployment: production
- definitions:
- services:
- db:
- image: postgres:latest
- variables:
- POSTGRES_DB: 'fiat-system'
- POSTGRES_USER: 'postgres'
- POSTGRES_PASSWORD: 'postgres'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement