-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
112 lines (101 loc) · 3.86 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
# Copyright (C) 2023 Solution Libre <[email protected]>
#
# This file is part of Helm release generic Terraform module.
#
# Helm release generic Terraform module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Helm release generic Terraform module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Helm release generic Terraform module. If not, see <https://www.gnu.org/licenses/>.
include:
- template: Terraform/Base.latest.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Terraform/Base.latest.gitlab-ci.yml
- template: Terraform/Module-Base.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Terraform/Module-Base.gitlab-ci.yml
# - template: Jobs/Code-Quality.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/Code-Quality.gitlab-ci.yml
- template: Jobs/Code-Intelligence.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/Code-Intelligence.gitlab-ci.yml
- template: Jobs/SAST-IaC.latest.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/SAST-IaC.latest.gitlab-ci.yml
- template: Jobs/Secret-Detection.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Jobs/Secret-Detection.gitlab-ci.yml
stages:
- validate
- test
- upload
- release
variables:
TERRAFORM_MODULE_SYSTEM: helm
fmt:
extends: .terraform:fmt
needs: []
validate:
extends: .terraform:validate
needs: []
markdownlint:
stage: validate
image:
name: registry.gitlab.com/06kellyjac/docker_markdownlint-cli:latest
entrypoint:
- '/usr/bin/env'
cache: []
before_script:
- markdownlint --version
script:
- markdownlint '**/*.md'
rules:
- changes:
- '**/*.md'
needs: []
# code_quality:
# artifacts:
# paths:
# - gl-code-quality-report.json
kics-iac-sast:
artifacts:
paths:
- gl-sast-report.json
changelog:
stage: test
image: docker
artifacts:
paths:
- release-note.md
cache: []
before_script:
- docker run --rm sean0x42/markdown-extract:v2 --version
script:
- docker run -v $PWD:/opt sean0x42/markdown-extract:v2 -n "$(echo "$CI_COMMIT_TAG" | sed -e 's/^v//')" /opt/CHANGELOG.md > release-note.md
rules:
- if: $CI_COMMIT_TAG
upload:
extends: .terraform-module:deploy
stage: upload
cache: []
before_script:
- TERRAFORM_MODULE_VERSION=$(echo "${TERRAFORM_MODULE_VERSION}" | sed -e 's/^v//')
rules:
- if: $CI_COMMIT_TAG
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
cache: []
needs:
- changelog
- upload
rules:
- if: $CI_COMMIT_TAG
before_script:
- apk add curl jq --no-cache --update
- |
PACKAGE_WEB_PATH=$(curl --fail-with-body --location --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "${PACKAGE_API_URL}" | jq -r .[0]._links.web_path)
- PACKAGE_WEB_URL="${CI_SERVER_URL}${PACKAGE_WEB_PATH}"
script:
- |
release-cli create --name "$CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--description release-note.md \
--assets-link "{\"name\":\"Terraform module\",\"url\":\"${PACKAGE_WEB_URL}\",\"link_type\":\"package\"}"
variables:
PACKAGE_API_URL: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages?package_type=terraform_module&package_name=${TERRAFORM_MODULE_NAME}/${TERRAFORM_MODULE_SYSTEM}&sort=desc&per_page=1