-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy path.gitlab-ci.yml
41 lines (39 loc) · 1.9 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
stages:
- build
- deploy
build:
stage: build
cache:
paths:
- dist-newstyle
tags:
- shell
script:
- docker info
- if [ ! -z "$CI_COMMIT_TAG" ]; then COMMON_TAG="release"; elif [ "$CI_COMMIT_REF_NAME" == "master" ]; then COMMON_TAG="latest"; else COMMON_TAG=$CI_COMMIT_REF_SLUG; fi
- if [ ! -z "$CI_COMMIT_TAG" ]; then IMAGE_IDENTIFIER="$CI_COMMIT_TAG"; else IMAGE_IDENTIFIER=$CI_COMMIT_SHA; fi
- ./.ci/build cabal update
- ./.ci/build -t "$CI_REGISTRY_IMAGE:$IMAGE_IDENTIFIER" -t "$CI_REGISTRY_IMAGE:$COMMON_TAG"
- echo $CI_REGISTRY_PASSWORD | docker login --username $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
- docker push $CI_REGISTRY_IMAGE:$IMAGE_IDENTIFIER
- docker push $CI_REGISTRY_IMAGE:$COMMON_TAG
deploy-dev:
stage: deploy
image: docker:latest
only:
refs:
- develop
script:
- echo $CI_REGISTRY_PASSWORD | docker login --username $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
- docker --host 172.31.0.6:2376 service update --with-registry-auth --image $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA kuber_dev_preprod
- docker --host 172.31.0.6:2376 service update --with-registry-auth --image $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA kuber_dev_preview
deploy-release:
stage: deploy
image: docker:latest
only:
- tags
script:
- echo $CI_REGISTRY_PASSWORD | docker login --username $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
- docker --host 172.31.0.7:2376 service update --with-registry-auth --image $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG cardanoapi_preprod
- docker --host 172.31.0.7:2376 service update --with-registry-auth --image $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG cardanoapi_preview
- docker --host 172.31.0.7:2376 service update --with-registry-auth --image $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG cardanoapi_mainnet