-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
65 lines (59 loc) · 1.91 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
stages:
- build
- test
- release
- publish
test-web-service:
stage: test
image: registry.gitlab.com/medicines-discovery-catapult/informatics/docker-images/ci/golang:latest
script:
- go test -v ./... -coverpkg=./... -coverprofile=cover.out
lint:
stage: test
image: registry.gitlab.com/medicines-discovery-catapult/informatics/docker-images/ci/golang:latest
script:
- go mod tidy
- go vet ./...
- golangci-lint run
except:
variables:
- $CI_COMMIT_MESSAGE =~ /^Setting version to.*/
coverage: /total:\s+\(statements\)\s+(\d+.\d+\%)/
publish:
stage: publish
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
before_script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor --context $CI_PROJECT_DIR --build-arg VERSION_HASH=$CI_COMMIT_SHORT_SHA --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
except:
refs:
- master
variables:
- $CI_COMMIT_MESSAGE =~ /^Setting version to.*/
release:
stage: release
image: registry.gitlab.com/medicines-discovery-catapult/informatics/docker-images/ci/golang:latest
script:
- cictl exec release
only:
- main
except:
variables:
- $CI_COMMIT_MESSAGE =~ /^Setting version to.*/
publish-master:
stage: publish
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
before_script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor --context $CI_PROJECT_DIR --build-arg VERSION_HASH=$CI_COMMIT_SHORT_SHA --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME --destination $CI_REGISTRY_IMAGE:latest
only:
refs:
- tags
variables:
- $CI_COMMIT_MESSAGE =~ /^Setting version to.*/