--- image: atlassian/default-image:2 definitions: services: docker: memory: 3072 pipelines: default: - parallel: - step: name: Build images script: - docker build . --file docker/coturn/Dockerfile --tag coturn - docker build . --file docker/coturn-dns/Dockerfile --tag coturn-dns services: - docker caches: - docker - step: name: Lint the Dockerfile image: hadolint/hadolint:latest-debian script: - hadolint docker/coturn/Dockerfile - hadolint docker/coturn-dns/Dockerfile branches: main: - parallel: - step: name: Build images script: - docker build . --file docker/coturn/Dockerfile --tag coturn - docker build . --file docker/coturn-dns/Dockerfile --tag coturn-dns - docker save coturn --output "coturn.tar" - docker save coturn-dns --output "coturn-dns.tar" services: - docker caches: - docker artifacts: - "*.tar" - step: name: Deploy terraform image: hashicorp/terraform:latest script: - cd terraform/ - terraform init - terraform plan - terraform apply -input=false -auto-approve - step: name: Deploy K8s apps (staging) script: - pipe: atlassian/kubectl-run:3.1.2s variables: KUBE_CONFIG: $KUBE_CONFIG_STG KUBECTL_COMMAND: '-n argocd apply -k k8s/argocd/overlays/staging' - step: name: Push images image: google/cloud-sdk:alpine script: # Authenticating with the service account key file - echo $GCLOUD_API_KEYFILE | base64 -d > ./gcloud-api-key.json - gcloud auth activate-service-account --key-file gcloud-api-key.json - gcloud config set project $GCLOUD_PROJECT - cat ./gcloud-api-key.json | docker login -u _json_key --password-stdin https://gcr.io # Push Docker images - VERSION="latest" - docker load --input "coturn.tar" - docker load --input "coturn-dns.tar" - docker tag "coturn" "gcr.io/${GCLOUD_PROJECT}/coturn:${VERSION}" - docker tag "coturn-dns" "gcr.io/${GCLOUD_PROJECT}/coturn-dns:${VERSION}" - docker push "gcr.io/${GCLOUD_PROJECT}/coturn:${VERSION}" - docker push "gcr.io/${GCLOUD_PROJECT}/coturn-dns:${VERSION}" services: - docker - step: name: Deploy coturn/coturn-dns to staging deployment: staging script: - pipe: atlassian/kubectl-run:1.1.2 variables: KUBE_CONFIG: $KUBE_CONFIG_STG KUBECTL_COMMAND: '-n coturn rollout restart deployment/coturn' - pipe: atlassian/kubectl-run:1.1.2 variables: KUBE_CONFIG: $KUBE_CONFIG_STG KUBECTL_COMMAND: '-n coturn rollout status -w deployment/coturn' - pipe: atlassian/kubectl-run:1.1.2 variables: KUBE_CONFIG: $KUBE_CONFIG_STG KUBECTL_COMMAND: '-n coturn-dns rollout restart deployment/coturn-dns' - pipe: atlassian/kubectl-run:1.1.2 variables: KUBE_CONFIG: $KUBE_CONFIG_STG KUBECTL_COMMAND: '-n coturn-dns rollout status -w deployment/coturn-dns'