From b4f1938b62ae7f7716cc5828c0d3a65c486c02f4 Mon Sep 17 00:00:00 2001 From: Victor Barba Martin Date: Tue, 10 Aug 2021 19:36:34 +0200 Subject: [PATCH] set pipeline --- bitbucket-pipelines.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 4cfe028..bbfe1f0 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -19,8 +19,8 @@ pipelines: - step: name: Build and Test script: - - IMAGE_NAME=$BITBUCKET_REPO_SLUG - - docker build . --file k8s/Dockerfile-autoscaler --tag ${IMAGE_NAME} + - docker build . --file k8s/Dockerfile-autoscaler --tag autoscaler-${BITBUCKET_REPO_SLUG} + - docker build . --file k8s/Dockerfile-coturn-dns --tag coturn-dns-${BITBUCKET_REPO_SLUG} services: - docker caches: @@ -29,15 +29,17 @@ pipelines: name: Lint the Dockerfile image: hadolint/hadolint:latest-debian script: - - hadolint Dockerfile + - hadolint Dockerfile-autoscaler + - hadolint Docuerfile-coturn-dns branches: main: - step: name: Build and Test script: - - IMAGE_NAME=linode-autoscaler - - docker build . --file k8s/Dockerfile-autoscaler --tag ${IMAGE_NAME} - - docker save ${IMAGE_NAME} --output "${IMAGE_NAME}.tar" + - docker build . --file k8s/Dockerfile-autoscaler --tag autoscaler-${BITBUCKET_REPO_SLUG} + - docker build . --file k8s/Dockerfile-coturn-dns --tag coturn-dns-${BITBUCKET_REPO_SLUG} + - docker save autoscaler-${BITBUCKET_REPO_SLUG} --output "autoscaler-${BITBUCKET_REPO_SLUG}.tar" + - docker save coturn-dns-${BITBUCKET_REPO_SLUG} --output "coturn-dns-${BITBUCKET_REPO_SLUG}.tar" services: - docker caches: @@ -52,20 +54,22 @@ pipelines: - 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 - - IMAGE_NAME="linode-autoscaler" - - docker load --input "${IMAGE_NAME}.tar" + - docker load --input "autoscaler-${BITBUCKET_REPO_SLUG}.tar" + - docker load --input "coturn-dns-${BITBUCKET_REPO_SLUG}.tar" - VERSION="prod-0.1.${BITBUCKET_BUILD_NUMBER}" - - docker tag "${IMAGE_NAME}" "gcr.io/${GCLOUD_PROJECT}/${IMAGE_NAME}:${VERSION}" + - docker tag "autoscaler-${BITBUCKET_REPO_SLUG}.tar" "gcr.io/${GCLOUD_PROJECT}/autoscaler:${VERSION}" + - docker tag "coturn-dns-${BITBUCKET_REPO_SLUG}.tar" "gcr.io/${GCLOUD_PROJECT}/coturn-dns:${VERSION}" # Login to google docker hub - cat ./gcloud-api-key.json | docker login -u _json_key --password-stdin https://gcr.io - - docker push "gcr.io/${GCLOUD_PROJECT}/${IMAGE_NAME}:${VERSION}" + - docker push "gcr.io/${GCLOUD_PROJECT}/autoscaler:${VERSION}" + - docker push "gcr.io/${GCLOUD_PROJECT}/coturn-dns:${VERSION}" services: - docker - step: name: Deploy to K8s deployment: production script: - - IMAGE="gcr.io/$GCLOUD_PROJECT/linode-autoscaler:prod-0.1.$BITBUCKET_BUILD_NUMBER" + - IMAGE="gcr.io/$GCLOUD_PROJECT/autoscaler:prod-0.1.$BITBUCKET_BUILD_NUMBER" - sed -i "s|{{linode_autoscaler_image}}|$IMAGE|g" k8s/linode-autoscaler/webrtc-be-autoscaler.yaml - sed -i "s|{{linode_autoscaler_image}}|$IMAGE|g" k8s/linode-autoscaler/coturn-autoscaler.yaml - pipe: atlassian/kubectl-run:1.1.2