-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
87 lines (77 loc) · 1.85 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
# TODO: for open source, should we include this scan.yml ?
include:
- project: "Crucible/devops/gitlab-ci-templates"
file: "azure-acr-v2.yml"
stages:
# each jon is defined in one of these CI pipeline stages
# TODO: do we need scan stage for this open source project?
- build
- release
- scan
- deploy
variables:
IMAGE_BUILD: $CI_REGISTRY_IMAGE:build
IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
# The name of your app
PLATFORM_APP_NAME: ui
# The namespace of your app
PLATFORM_NAMESPACE: snowballgr
# For Azure ACR stuff/pushing to Azure ACR (do not change)
AZURE_ACR_REPO: crucibleplatform.azurecr.io/${PLATFORM_NAMESPACE}/${PLATFORM_APP_NAME}
.docker-login-script: &docker-login-script
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
build:
stage: build
script:
- *docker-login-script
- docker pull --quiet $IMAGE_BUILD || true
- docker build
--target build
--cache-from $IMAGE_BUILD
--tag $IMAGE_BUILD
.
- docker push $IMAGE_BUILD
tags:
- aws
- crucible
- docker
release:
extends: .push_to_azure_acr
stage: release
before_script:
- *docker-login-script
- docker pull --quiet $IMAGE_BUILD || true
- docker pull --quiet $IMAGE_LATEST || true
- docker build
--cache-from $IMAGE_BUILD
--cache-from $IMAGE_LATEST
--tag $IMAGE_LATEST
--tag ${AZURE_ACR_REPO}:${BRANCH_BUILD_NUM}
.
- docker push $IMAGE_LATEST
tags:
- aws
- crucible
- docker
scan:
extends: .scan
stage: scan
tags:
- crucible
- docker
- aws
deploy:
extends: .deploy_to_azure_aks
stage: deploy
only:
refs:
- dev
- prod
environment: $CI_COMMIT_REF_SLUG
before_script:
- *docker-login-script
- echo "Deploying to Azure AKS"
tags:
- aws
- crucible
- docker