-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitbucket-pipelines.yml
85 lines (82 loc) · 4.2 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
image: node:18.12.1-alpine
options:
size: 1x
definitions:
services:
docker:
memory: 2048
pipelines:
custom:
develop:
- step:
name: Manual Build for Develop
# caches:
# - node
script:
- npm install | tee -a logs.txt 2>&1
- npm run build | tee -a logs.txt 2>&1
branches:
beta:
- step:
name: Build for Beta & Push Image To Beta DigitalOcean
# caches:
# - node
services:
- docker
script:
- set -o pipefail # important! makes sure the build fails when ANY of piped commands fail
- export VERSION_LABEL=`[[ $BITBUCKET_TAG ]] && echo "$BITBUCKET_TAG-${BITBUCKET_COMMIT::7}" || echo "$BITBUCKET_REPO_FULL_NAME-${BITBUCKET_COMMIT::7}"`
- export VERSION_REF=`[[ $BITBUCKET_TAG ]] && echo "$BITBUCKET_TAG" || echo "$BITBUCKET_BRANCH"`
- cd deployment/kubernetes && docker build --build-arg VERSION=$VERSION_LABEL -t simplaq-frontend-website:beta -f ./Dockerfile-beta ../.. | tee -a logs.txt 2>&1
- export REMOTE_IMAGE_TAG="registry.digitalocean.com/simplaq/k8s-simplaq-frontend-website:beta"
- docker login -u $DIGITALOCEAN_CONTAINER_REGISTRY_TOKEN -p $DIGITALOCEAN_CONTAINER_REGISTRY_TOKEN registry.digitalocean.com | tee -a logs.txt 2>&1
- docker tag simplaq-frontend-website:beta $REMOTE_IMAGE_TAG | tee -a logs.txt 2>&1
- docker push $REMOTE_IMAGE_TAG | tee -a logs.txt 2>&1
- step:
name: Refresh Beta Kubernetes
trigger: automatic
script:
- pipe: atlassian/kubectl-run:3.6.0
variables:
KUBE_CONFIG: $KUBE_CONFIG
KUBECTL_COMMAND: 'rollout restart deployment frontend-website-beta'
# RESOURCE_PATH: '<string>' # Optional.
# KUBECTL_APPLY_ARGS: '<string>' # Optional.
# KUBECTL_ARGS: '<array>' # Optional.
# LABELS: '<array>' # Optional.
# WITH_DEFAULT_LABELS: '<boolean>' # Optional.
# DISABLE_VALIDATION: '<boolean>' # Optional.
# PRE_EXECUTION_SCRIPT: '<string>' # Optional.
# DEBUG: '<boolean>' # Optional.
production:
- step:
name: Build for Production & Push Image To Production DigitalOcean
# caches:
# - node
services:
- docker
script:
- set -o pipefail # important! makes sure the build fails when ANY of piped commands fail
- export VERSION_LABEL=`[[ $BITBUCKET_TAG ]] && echo "$BITBUCKET_TAG-${BITBUCKET_COMMIT::7}" || echo "$BITBUCKET_REPO_FULL_NAME-${BITBUCKET_COMMIT::7}"`
- export VERSION_REF=`[[ $BITBUCKET_TAG ]] && echo "$BITBUCKET_TAG" || echo "$BITBUCKET_BRANCH"`
- cd deployment/kubernetes && docker build --build-arg VERSION=$VERSION_LABEL -t simplaq-frontend-website:latest -f ./Dockerfile-production ../.. | tee -a logs.txt 2>&1
- export REMOTE_IMAGE_TAG="registry.digitalocean.com/simplaq/k8s-simplaq-frontend-website:latest"
- docker login -u $DIGITALOCEAN_CONTAINER_REGISTRY_TOKEN -p $DIGITALOCEAN_CONTAINER_REGISTRY_TOKEN registry.digitalocean.com | tee -a logs.txt 2>&1
- docker tag simplaq-frontend-website:latest $REMOTE_IMAGE_TAG | tee -a logs.txt 2>&1
- docker push $REMOTE_IMAGE_TAG | tee -a logs.txt 2>&1
- step:
name: Refresh Production Kubernetes
trigger: automatic
script:
- pipe: atlassian/kubectl-run:3.6.0
variables:
KUBE_CONFIG: $KUBE_CONFIG
KUBECTL_COMMAND: 'rollout restart deployment frontend-website'
# RESOURCE_PATH: '<string>' # Optional.
# KUBECTL_APPLY_ARGS: '<string>' # Optional.
# KUBECTL_ARGS: '<array>' # Optional.
# LABELS: '<array>' # Optional.
# WITH_DEFAULT_LABELS: '<boolean>' # Optional.
# DISABLE_VALIDATION: '<boolean>' # Optional.
# PRE_EXECUTION_SCRIPT: '<string>' # Optional.
# DEBUG: '<boolean>' # Optional.