-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
99 lines (88 loc) · 2.17 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
---
stages:
- build
- security
- qa
- misc
- release
include:
- template: SAST.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
- template: Security/Secret-Detection.gitlab-ci.yml
.install_ceph:
before_script:
- wget -q -O- 'https://download.ceph.com/keys/release.asc' | apt-key add -
- source /etc/os-release
- echo "deb https://download.ceph.com/debian-pacific/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/ceph.list
- apt-get update
- apt-get install -y libcephfs-dev librbd-dev librados-dev
build:
stage: build
image: golang:1.17
extends: .install_ceph
script:
- make build
artifacts:
expose_as: 'terraform-provider-ceph'
paths:
- terraform-provider-ceph
sast:
stage: security
needs: []
dependency_scanning:
stage: security
needs: []
secret_detection:
stage: security
needs: []
golang-lint:
stage: qa
needs: []
extends: .install_ceph
image: golangci/golangci-lint:v1.45
script:
- golangci-lint run -v
test-go-generate:
stage: qa
needs: []
image: golang:1.17
extends: .install_ceph
variables:
TERRAFORM_VERSION: 1.1.8
script:
- apt-get update && apt-get install zip -y
- wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
- unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin
- go generate
- |
git diff --compact-summary --exit-code ||
(echo;
echo "Unexpected difference in directories after code generation. Run 'go generate' command and commit.";
exit 1)
code_navigation:
stage: misc
image: sourcegraph/lsif-go:v1
needs: []
script:
- lsif-go
allow_failure: true # recommended
artifacts:
reports:
lsif: dump.lsif
release:
stage: release
image:
name: goreleaser/goreleaser:v1.9.2
entrypoint: ['']
only:
- tags
variables:
# Disable shallow cloning so that goreleaser can diff between tags to
# generate a changelog.
GIT_DEPTH: 0
before_script:
- apk add ceph-dev linux-headers
script:
- apk add gpg-agent
- gpg --import < $GPG_PRIVATE_KEY_FILE
- goreleaser release --rm-dist