-
Notifications
You must be signed in to change notification settings - Fork 1
/
bitbucket-pipelines.yml
147 lines (143 loc) · 5.4 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
image:
name: 007098893018.dkr.ecr.eu-central-1.amazonaws.com/ci-image:1.0.2
aws:
access-key: $AWS_ACCESS_KEY_ID
secret-key: $AWS_SECRET_ACCESS_KEY
options:
max-time: 30
clone:
depth: full
definitions:
services:
docker:
memory: 2048
pipelines:
default:
- step:
name: Test and build
image: circleci/node:10-browsers
caches:
- node
script:
- export CYPRESS_CACHE_FOLDER=node_modules/cypress/.cache
- yarn install
- yarn dev & # start dev server
- while ! nc -z localhost 3000 </dev/null; do sleep 20; done
- Xvfb :99 -ac & # virtual display
- yarn test:e2e
- kill -9 $(pgrep node) || true
- yarn build
custom:
build-and-publish-image:
- step:
name: Build
image: node:10-jessie
script:
- yarn install
- echo $(node -pe "require('./package.json').version") > version.txt
- yarn build
artifacts:
- version.txt
- package.json
- step:
name: Containerize
caches:
- docker
script:
- export APP_VERSION=$(cat version.txt)
- export REPO_NAME=TBD
- export DOCKER_IMAGE_VERSION=$(date +%Y.%m.%d-%H.%M.%S)
- export DOCKER_BRANCH=$(if [[ "$BITBUCKET_BRANCH" != "master" ]]; then echo ${BITBUCKET_BRANCH//\//-}; else echo "master"; fi);
- export DOCKER_REPOSITORY=007098893018.dkr.ecr.eu-central-1.amazonaws.com/$REPO_NAME
- docker build -t $DOCKER_REPOSITORY:$APP_VERSION-dev.$DOCKER_BRANCH.$DOCKER_IMAGE_VERSION .
- $(aws ecr get-login --no-include-email --region eu-central-1)
- docker push $DOCKER_REPOSITORY:$APP_VERSION-dev.$DOCKER_BRANCH.$DOCKER_IMAGE_VERSION
services:
- docker
release-major:
- step:
name: Release
image: atlassian/default-image:2
caches:
- node
script:
- cp /opt/atlassian/pipelines/agent/data/id_rsa ~/.ssh/id_rsa
- git remote set-url origin ${BITBUCKET_GIT_SSH_ORIGIN}
- git config --local user.email "[email protected]" && git config --local user.name "Continuous Integration"
- git checkout "${BITBUCKET_BRANCH:-master}"
- yarn install
- yarn release:major
- echo $(node -pe "require('./package.json').version") > version.txt
- yarn build
artifacts:
- version.txt
- package.json
- step:
name: Containerize
caches:
- docker
script:
- export APP_VERSION=$(cat version.txt)
- export REPO_NAME=TBD
- export DOCKER_REPOSITORY=007098893018.dkr.ecr.eu-central-1.amazonaws.com/$REPO_NAME
- docker build -t $DOCKER_REPOSITORY:$APP_VERSION . && $(aws ecr get-login --no-include-email --region eu-central-1) && docker push $DOCKER_REPOSITORY:$APP_VERSION
services:
- docker
release-minor:
- step:
name: Release
image: node:10-jessie
caches:
- node
script:
- cp /opt/atlassian/pipelines/agent/data/id_rsa ~/.ssh/id_rsa
- git remote set-url origin ${BITBUCKET_GIT_SSH_ORIGIN}
- git config --local user.email "[email protected]" && git config --local user.name "Continuous Integration"
- git checkout "${BITBUCKET_BRANCH:-master}"
- yarn install
- yarn release:minor
- echo $(node -pe "require('./package.json').version") > version.txt
- yarn build
artifacts:
- version.txt
- package.json
- step:
name: Containerize
caches:
- docker
script:
- export APP_VERSION=$(cat version.txt)
- export REPO_NAME=TBD
- export DOCKER_REPOSITORY=007098893018.dkr.ecr.eu-central-1.amazonaws.com/$REPO_NAME
- docker build -t $DOCKER_REPOSITORY:$APP_VERSION . && $(aws ecr get-login --no-include-email --region eu-central-1) && docker push $DOCKER_REPOSITORY:$APP_VERSION
services:
- docker
release-patch:
- step:
name: Release
image: node:10-jessie
caches:
- node
script:
- cp /opt/atlassian/pipelines/agent/data/id_rsa ~/.ssh/id_rsa
- git remote set-url origin ${BITBUCKET_GIT_SSH_ORIGIN}
- git config --local user.email "[email protected]" && git config --local user.name "Continuous Integration"
- git checkout "${BITBUCKET_BRANCH:-master}"
- yarn install
- yarn release:patch
- echo $(node -pe "require('./package.json').version") > version.txt
- yarn build
artifacts:
- version.txt
- package.json
- step:
name: Containerize
caches:
- docker
script:
- export APP_VERSION=$(cat version.txt)
- export REPO_NAME=TBD
- export DOCKER_REPOSITORY=007098893018.dkr.ecr.eu-central-1.amazonaws.com/$REPO_NAME
- docker build -t $DOCKER_REPOSITORY:$APP_VERSION . && $(aws ecr get-login --no-include-email --region eu-central-1) && docker push $DOCKER_REPOSITORY:$APP_VERSION
services:
- docker