-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
118 lines (102 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
include:
- 'https://codebase.helmholtz.cloud/m-team/tools/ci-voodoo/-/raw/master/ci-include/github-status-sync.yml'
- "https://codebase.helmholtz.cloud/m-team/tools/ci-voodoo/raw/master/ci-include/pipeline-jobs-publish-to-repo.yml"
variables:
USE_GORELEASER: "true"
UPSTREAM_PROJECT: oidc-mytoken/server
image: golang:1.22
stages:
- build
- test
- lint
- package
- publish
- deploy
default:
tags:
- linux
cache:
paths:
- .cache
before_script:
- mkdir -p .cache
- export GOPATH=${CI_PROJECT_DIR}/.cache
test:
stage: test
script:
- go test -v ./...
test_race:
stage: test
script:
- go test -race -v ./...
staticcheck:
stage: lint
before_script:
- go install honnef.co/go/tools/cmd/staticcheck@latest
script:
- staticcheck ./...
vet:
stage: lint
script:
- go vet -structtag=false ./...
build_server:
stage: build
script:
- go build github.com/oidc-mytoken/server/cmd/mytoken-server
build_setup:
stage: build
script:
- go build github.com/oidc-mytoken/server/cmd/mytoken-server/mytoken-setup
build_migratedb:
stage: build
script:
- go build github.com/oidc-mytoken/server/cmd/mytoken-server/mytoken-migratedb
package:
stage: package
image:
name: goreleaser/goreleaser
entrypoint: [ "" ]
services:
- docker:dind
# only:
# refs:
# - tags
# - prerel
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0
REPO_HOST: repo.data.kit.edu
REPO_USER: cicd
DOCKER_REGISTRY: https://index.docker.io/v1/
before_script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin "$DOCKER_REGISTRY"
script:
- |
[[ "$CI_COMMIT_BRANCH" == "${PREREL_BRANCH_NAME}" ]] && {
echo "Running set-prerel-version"
.gitlab-ci-scripts/set-prerel-version.sh
}
[[ "$CI_COMMIT_BRANCH" != "${PREREL_BRANCH_NAME}" ]] && {
[[ "$CI_COMMIT_BRANCH" != "${CI_DEFAULT_BRANCH}" ]] && {
# we're on a devel branch
echo "Running set-devel-version"
.gitlab-ci-scripts/set-prerel-version.sh --devstring dev
}
}
.gitlab-ci-scripts/goreleaser.sh
artifacts:
paths:
- "results/*"
after_script:
- curl -d "repo=github.com/oidc-mytoken/server" https://goreportcard.com/checks
deploy-prerel:
stage: deploy
only:
refs:
- prerel
before_script:
- mkdir -p /root/.ssh
- cp $KNOWN_HOSTS /root/.ssh/known_hosts
- cp $DEPLOYMENT_SSH_KEY /root/.ssh/id_ed25519 && chmod 0600 /root/.ssh/id_ed25519
script:
- ssh -4 mytoken.data.kit.edu