diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 07e26cb..01adacc 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -19,8 +19,8 @@ pipelines: - step: name: Build and Test script: - - 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 build . --file docker/coturn/Dockerfile --tag autoscaler-${BITBUCKET_REPO_SLUG} + - docker build . --file docker/coturn-dns/Dockerfile --tag coturn-dns-${BITBUCKET_REPO_SLUG} services: - docker caches: @@ -29,16 +29,16 @@ pipelines: name: Lint the Dockerfile image: hadolint/hadolint:latest-debian script: - - hadolint Dockerfile-autoscaler - - hadolint Docuerfile-coturn-dns + - hadolint docker/coturn/Dockerfile + - hadolint docker/coturn-dns/Dockerfile branches: main: - step: name: Build and Test script: - - 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 build . --file docker/coturn/Dockerfile --tag autoscaler-${BITBUCKET_REPO_SLUG} + - docker build . --file docker/coturn-dns/Dockerfile --tag autoscaler-${BITBUCKET_REPO_SLUG} + - docker save coturn-${BITBUCKET_REPO_SLUG} --output "coturn-${BITBUCKET_REPO_SLUG}.tar" - docker save coturn-dns-${BITBUCKET_REPO_SLUG} --output "coturn-dns-${BITBUCKET_REPO_SLUG}.tar" services: - docker @@ -54,14 +54,14 @@ 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 - - docker load --input "autoscaler-${BITBUCKET_REPO_SLUG}.tar" + - docker load --input "coturn-${BITBUCKET_REPO_SLUG}.tar" - docker load --input "coturn-dns-${BITBUCKET_REPO_SLUG}.tar" - - VERSION="prod-0.1.${BITBUCKET_BUILD_NUMBER}" - - docker tag "autoscaler-${BITBUCKET_REPO_SLUG}" "gcr.io/${GCLOUD_PROJECT}/autoscaler:${VERSION}" + - VERSION="latest" #VERSION="prod-0.1.${BITBUCKET_BUILD_NUMBER}" + - docker tag "coturn-${BITBUCKET_REPO_SLUG}" "gcr.io/${GCLOUD_PROJECT}/coturn:${VERSION}" - docker tag "coturn-dns-${BITBUCKET_REPO_SLUG}" "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}/autoscaler:${VERSION}" + - docker push "gcr.io/${GCLOUD_PROJECT}/coturn:${VERSION}" - docker push "gcr.io/${GCLOUD_PROJECT}/coturn-dns:${VERSION}" services: - docker @@ -112,31 +112,31 @@ pipelines: # --set grafana.adminPassword=jamkazamMonitoring - - step: - name: Deploy to K8s - deployment: production - script: - - AUTOSCALER_IMAGE="gcr.io/$GCLOUD_PROJECT/autoscaler:prod-0.1.$BITBUCKET_BUILD_NUMBER" - - COTURN_DNS_IMAGE="gcr.io/$GCLOUD_PROJECT/coturn-dns:prod-0.1.$BITBUCKET_BUILD_NUMBER" - - sed -i "s|{{linode_autoscaler_image}}|$AUTOSCALER_IMAGE|g" k8s/linode-autoscaler/production-webrtc-be-autoscaler.yaml - - sed -i "s|{{linode_autoscaler_image}}|$AUTOSCALER_IMAGE|g" k8s/linode-autoscaler/production-coturn-autoscaler.yaml - - sed -i "s|{{coturn_dns_image}}|$COTURN_DNS_IMAGE|g" k8s/coturn-dns/production-coturn-dns.yaml - # - pipe: atlassian/kubectl-run:1.1.2 - # variables: - # KUBE_CONFIG: $KUBE_CONFIG_PRD - # KUBECTL_COMMAND: 'apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml' - - pipe: atlassian/kubectl-run:1.1.2 - variables: - KUBE_CONFIG: $KUBE_CONFIG_PRD - KUBECTL_COMMAND: 'apply' - RESOURCE_PATH: 'k8s/linode-autoscaler/linode-autoscaler-namespace-secrets.yaml' - - pipe: atlassian/kubectl-run:1.1.2 - variables: - KUBE_CONFIG: $KUBE_CONFIG_PRD - KUBECTL_COMMAND: 'apply' - RESOURCE_PATH: 'k8s/linode-autoscaler/production-coturn-autoscaler.yaml' - - pipe: atlassian/kubectl-run:1.1.2 - variables: - KUBE_CONFIG: $KUBE_CONFIG_PRD - KUBECTL_COMMAND: 'apply' - RESOURCE_PATH: 'k8s/coturn-dns/production-coturn-dns.yaml' \ No newline at end of file + # - step: + # name: Deploy to K8s + # deployment: production + # script: + # - AUTOSCALER_IMAGE="gcr.io/$GCLOUD_PROJECT/autoscaler:prod-0.1.$BITBUCKET_BUILD_NUMBER" + # - COTURN_DNS_IMAGE="gcr.io/$GCLOUD_PROJECT/coturn-dns:prod-0.1.$BITBUCKET_BUILD_NUMBER" + # - sed -i "s|{{linode_autoscaler_image}}|$AUTOSCALER_IMAGE|g" k8s/linode-autoscaler/production-webrtc-be-autoscaler.yaml + # - sed -i "s|{{linode_autoscaler_image}}|$AUTOSCALER_IMAGE|g" k8s/linode-autoscaler/production-coturn-autoscaler.yaml + # - sed -i "s|{{coturn_dns_image}}|$COTURN_DNS_IMAGE|g" k8s/coturn-dns/production-coturn-dns.yaml + # # - pipe: atlassian/kubectl-run:1.1.2 + # # variables: + # # KUBE_CONFIG: $KUBE_CONFIG_PRD + # # KUBECTL_COMMAND: 'apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml' + # - pipe: atlassian/kubectl-run:1.1.2 + # variables: + # KUBE_CONFIG: $KUBE_CONFIG_PRD + # KUBECTL_COMMAND: 'apply' + # RESOURCE_PATH: 'k8s/linode-autoscaler/linode-autoscaler-namespace-secrets.yaml' + # - pipe: atlassian/kubectl-run:1.1.2 + # variables: + # KUBE_CONFIG: $KUBE_CONFIG_PRD + # KUBECTL_COMMAND: 'apply' + # RESOURCE_PATH: 'k8s/linode-autoscaler/production-coturn-autoscaler.yaml' + # - pipe: atlassian/kubectl-run:1.1.2 + # variables: + # KUBE_CONFIG: $KUBE_CONFIG_PRD + # KUBECTL_COMMAND: 'apply' + # RESOURCE_PATH: 'k8s/coturn-dns/production-coturn-dns.yaml' \ No newline at end of file