-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbitbucket-pipelines.yml
58 lines (44 loc) · 2.05 KB
/
bitbucket-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:10.15.0
pipelines:
default:
- step:
name: Run NPM Install
caches:
- node
script:
- npm install
- step:
name: Run Node Tests
caches:
- node
script:
- npm test
- step:
name: Build and Push Docker Image
image: google/cloud-sdk:latest
script:
- echo $GCLOUD_API_KEYFILE > ~/.gcloud-api-key.json
- gcloud auth activate-service-account --key-file ~/.gcloud-api-key.json
- docker login -u _json_key --password-stdin https://$DOCKER_GCR_REPO_URL < ~/.gcloud-api-key.json
- docker build -t $DOCKER_IMAGE_NAME:${BITBUCKET_COMMIT} .
- docker tag $DOCKER_IMAGE_NAME:${BITBUCKET_COMMIT} $DOCKER_GCR_REPO_URL/$GCLOUD_PROJECT_ID/$DOCKER_IMAGE_NAME:${BITBUCKET_COMMIT}
- docker push $DOCKER_GCR_REPO_URL/$GCLOUD_PROJECT_ID/$DOCKER_IMAGE_NAME:${BITBUCKET_COMMIT}
# - gcloud container clusters get-credentials $K8s_CLUSTER_NAME --zone=$GCLOUD_ZONE --project $GCLOUD_PROJECT_ID
# DEPLOYMENT
# - kubectl set image deployment $K8s_DEPLOYMENT_NAME $K8s_DEPLOYMENT_NAME=$DOCKER_GCR_REPO_URL/$GCLOUD_PROJECT_ID/$DOCKER_IMAGE_NAME:${BITBUCKET_COMMIT} --record --namespace=$K8s_NAMESPACE
# - step:
# name: Build Docker Image
# image: atlassian/pipelines-awscli
# script:
# - echo $(aws ecr get-login --no-include-email --region us-west-2) > login.sh
# - sh login.sh
# - docker build -t $DOCKER_IMAGE_NAME:${BITBUCKET_COMMIT} .
# - docker tag $DOCKER_IMAGE_NAME:${BITBUCKET_COMMIT} $DOCKER_ECR_REPO_URL/$DOCKER_IMAGE_NAME:${BITBUCKET_COMMIT}
# - docker push $DOCKER_ECR_REPO_URL/$DOCKER_IMAGE_NAME:${BITBUCKET_COMMIT}
options:
docker: true