set pipeline
This commit is contained in:
parent
faaa2d98fc
commit
b4f1938b62
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue