This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
.gitlab-ci.yml
100 lines (93 loc) · 2.57 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
include:
- project: nci-gdc/gitlab-templates
ref: 0.7.8
file:
- templates/global/full.yaml
- templates/deployments/salt-service.yaml
stages:
- test
- build
- release
- deploy
pre-commit:
except:
- tags
test:
stage: test
image: docker.osdc.io/node:13
script:
- npm ci
- npm run lint
- npm test
except:
- tags
build:
stage: build
services:
- docker:${DOCKER_VERSION}-dind
tags:
- dind
image: docker:${DOCKER_VERSION}-dind
parallel:
matrix:
- IMAGE_NAME: portal-ui
DOCKER_FILE: portal.Dockerfile
- IMAGE_NAME: portal-ui-awg
DOCKER_FILE: awgportal.Dockerfile
script:
- |
docker build \
--build-arg "NPM_REGISTRY=https://nexus.osdc.io/repository/npm-all/" \
--build-arg BASE_CONTAINER_REGISTRY \
--build-arg BASE_CONTAINER_VERSION \
--label org.opencontainers.image.created="$(date -Iseconds)" \
--label org.opencontainers.image.revision="${CI_COMMIT_SHA}" \
--label org.opencontainers.image.ref.name="${IMAGE_NAME}:${CI_COMMIT_REF_NAME/\//_}" \
-t $DOCKER_RELEASE_REGISTRY/ncigdc/$IMAGE_NAME:$CI_COMMIT_REF_SLUG-${CI_COMMIT_SHORT_SHA} \
-t $DOCKER_RELEASE_REGISTRY/ncigdc/$IMAGE_NAME:$CI_COMMIT_SHA \
-f $DOCKER_FILE . \
--progress=plain
- docker push -a $DOCKER_RELEASE_REGISTRY/ncigdc/$IMAGE_NAME
except:
- tags
release:latest:
only:
- master
stage: release
services:
- docker:${DOCKER_VERSION}-dind
tags:
- dind
image: docker:${DOCKER_VERSION}-dind
parallel:
matrix:
- IMAGE_NAME: [portal-ui, portal-ui-awg]
script:
- docker pull $BASE_CONTAINER_REGISTRY/$IMAGE_NAME:$CI_COMMIT_SHA
- docker tag $BASE_CONTAINER_REGISTRY/$IMAGE_NAME:$CI_COMMIT_SHA $DOCKER_RELEASE_REGISTRY/ncigdc/$IMAGE_NAME:latest
- docker push $DOCKER_RELEASE_REGISTRY/ncigdc/$IMAGE_NAME:latest
release:tag:
only:
- tags
stage: release
services:
- docker:${DOCKER_VERSION}-dind
tags:
- dind
image: docker:${DOCKER_VERSION}-dind
parallel:
matrix:
- IMAGE_NAME: [portal-ui, portal-ui-awg]
script:
- docker pull $BASE_CONTAINER_REGISTRY/$IMAGE_NAME:$CI_COMMIT_SHA
- docker tag $BASE_CONTAINER_REGISTRY/$IMAGE_NAME:$CI_COMMIT_SHA $DOCKER_RELEASE_REGISTRY/ncigdc/$IMAGE_NAME:${CI_COMMIT_TAG}
- docker push $DOCKER_RELEASE_REGISTRY/ncigdc/$IMAGE_NAME:${CI_COMMIT_TAG}
.services:
allow_failure: true
stage: deploy
when: manual
variables:
DEPLOY_SERVICE_TAG: $CI_COMMIT_SHA
parallel:
matrix:
- DEPLOY_SERVICE_LIST: [ portal, awgportal ]