forked from XPRNetwork/proton-market-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
105 lines (98 loc) · 3.8 KB
/
.gitlab-ci.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
image: docker:18
variables:
GIT_SSL_NO_VERIFY: 1
DOCKER_DRIVER: overlay2
REPOSITORY_HOST: 830055101690.dkr.ecr.us-west-2.amazonaws.com
REPOSITORY_IMAGE: metal/proton-market
SERVICE_NAME: proton-market
stages:
- test
- build
- release
test:
image: nikolaik/python-nodejs
stage: test
only:
- merge_requests
script:
- yarn
- yarn format
- yarn typecheck
- yarn lint
- yarn build
build development:
stage: build
only:
- develop@proton/proton-market
services:
- docker:dind
before_script:
- docker info
- apk add --no-cache curl jq python py-pip
- pip install awscli yq
script:
- export IMAGE=devel-$CI_COMMIT_SHA
- $(aws ecr get-login --no-include-email --region us-west-2)
- docker build --no-cache
--build-arg NPM_TOKEN=${NPM_TOKEN}
--build-arg NEXT_PUBLIC_BLOCK_EXPLORER=${NEXT_PUBLIC_BLOCK_EXPLORER}
--build-arg NEXT_PUBLIC_CHAIN_ENDPOINTS=${NEXT_PUBLIC_CHAIN_ENDPOINTS}
--build-arg NEXT_PUBLIC_GA_TRACKING_ID=${NEXT_PUBLIC_GA_TRACKING_ID}
--build-arg NEXT_PUBLIC_NFT_ENDPOINT=${NEXT_PUBLIC_NFT_ENDPOINT}
- docker tag $REPOSITORY_IMAGE:latest $REPOSITORY_HOST/$REPOSITORY_IMAGE:latest
- docker tag $REPOSITORY_IMAGE:latest $REPOSITORY_HOST/$REPOSITORY_IMAGE:$IMAGE
- docker push $REPOSITORY_HOST/$REPOSITORY_IMAGE:latest
- docker push $REPOSITORY_HOST/$REPOSITORY_IMAGE:$IMAGE
build acceptance:
stage: build
only:
- /^release-.*/@proton/proton-market
variables:
DEPLOYMENT_ENVIRONMENT: "PRODUCTION"
services:
- docker:dind
before_script:
- docker info
- apk add --no-cache curl jq python py-pip
- pip install awscli yq
script:
- export IMAGE=$(cat package.json | jq .version -r)
- $(aws ecr get-login --no-include-email --region us-west-2)
- docker build --no-cache
--build-arg NPM_TOKEN=${NPM_TOKEN}
--build-arg NEXT_PUBLIC_BLOCK_EXPLORER=${NEXT_PUBLIC_BLOCK_EXPLORER}
--build-arg NEXT_PUBLIC_CHAIN_ENDPOINTS=${NEXT_PUBLIC_CHAIN_ENDPOINTS}
--build-arg NEXT_PUBLIC_GA_TRACKING_ID=${NEXT_PUBLIC_GA_TRACKING_ID}
--build-arg NEXT_PUBLIC_NFT_ENDPOINT=${NEXT_PUBLIC_NFT_ENDPOINT}
- docker tag $REPOSITORY_IMAGE:latest $REPOSITORY_HOST/$REPOSITORY_IMAGE:latest
- docker tag $REPOSITORY_IMAGE:latest $REPOSITORY_HOST/$REPOSITORY_IMAGE:$IMAGE
- docker push $REPOSITORY_HOST/$REPOSITORY_IMAGE:latest
- docker push $REPOSITORY_HOST/$REPOSITORY_IMAGE:$IMAGE
update development helm chart:
image: 830055101690.dkr.ecr.us-west-2.amazonaws.com/metal/ci:latest
stage: release
only:
- develop@proton/proton-market
script:
- export IMAGE=devel-$CI_COMMIT_SHA
- git clone -b develop [email protected]:metalpay/metal-devops.git
- cd metal-devops/helm/proton
- touch values-development.yaml
- cat values-development.yaml | yq '."'$SERVICE_NAME'".image.tag="'$IMAGE'"' -y > new-values.yaml
- mv -f new-values.yaml values-development.yaml
- git add values-development.yaml
- if [[ -z $(git status -s) ]]; then echo 'Tree is clean'; else git commit -m "Update $SERVICE_NAME image tag to $IMAGE"; git push; fi
update acceptance helm chart:
image: 830055101690.dkr.ecr.us-west-2.amazonaws.com/metal/ci:latest
stage: release
only:
- /^release-.*/@proton/proton-market
script:
- export IMAGE=$(cat package.json | jq .version -r)
- git clone -b develop [email protected]:metalpay/metal-devops.git
- cd metal-devops/helm/proton
- touch values-acceptance.yaml
- cat values-acceptance.yaml | yq '."'$SERVICE_NAME'".image.tag="'$IMAGE'"' -y > new-values.yaml
- mv -f new-values.yaml values-acceptance.yaml
- git add values-acceptance.yaml
- if [[ -z $(git status -s) ]]; then echo 'Tree is clean'; else git commit -m "Update $SERVICE_NAME image tag to $IMAGE"; git push; fi