-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
178 lines (162 loc) · 5.61 KB
/
.gitlab-ci.yml
File metadata and controls
178 lines (162 loc) · 5.61 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
image: registry.gitlab.com/chromaway/core-tools/chromia-images/maven-docker-java21:1.0.11@sha256:a985644b469b4d01dcbd726176d69e238d8c7012c077a429beb65f86905d0bd1
include:
- project: "chromaway/core-infra/gitlab-automation"
ref: 1.3.1
file:
- templates/release.yml
- templates/maven-dependency-scanning.yml
- templates/container-dependency-scanning.yml
.setup:
services:
- name: docker:23.0.4-dind
alias: docker
command: [ "--tls=false" , "--experimental" ]
artifacts:
when: on_failure
paths:
- "**/*.log"
reports:
junit:
- "**/target/surefire-reports/TEST-*.xml"
- "**/target/failsafe-reports/TEST-*.xml"
- "**/target/rell-reports/rell-tests.xml"
expire_in: 1 week
stages:
- build
- deploy
- dependency-check
- release
deploy:
extends: .setup
stage: deploy
rules:
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/
script:
- mvn
$MAVEN_CLI_OPTS
-Drevision=$CI_COMMIT_TAG
-Djib.to.tags=$CI_COMMIT_TAG
--activate-profiles ci,docker,docker-push
deploy
trigger-homebrew-release:
stage: release
rules:
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/
variables:
VERSION: $CI_COMMIT_TAG
FORMULA: pmc
trigger:
project: chromaway/core-tools/homebrew-chromia
strategy: depend
trigger-apt-repo-release:
stage: release
rules:
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/
variables:
VERSION: $CI_COMMIT_TAG
TOOL: pmc
script: |
curl -L \
--user "$JENKINS_USER:$JENKINS_USER_TOKEN" \
--form TOOL=$TOOL \
--form VERSION=$VERSION \
--request POST \
https://jenkins.infra.chromia.dev/job/apt-repository-chromia/buildWithParameters?token=$JENKINS_APT_JOB_TOKEN
update-docs:
stage: release
extends: .setup
rules:
- if: $CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/
variables:
VERSION: $CI_COMMIT_TAG
before_script:
- !reference [ .git-setup, script ]
script: |
git clone https://x-token-auth:$BITBUCKET_CI_TOKEN@bitbucket.org/chromawallet/chromia-docs.git docs-repo
cd docs-repo
bash generate-pmc-docs.sh
# Check if there are changes
if [ `git status --porcelain | wc -l` -gt 0 ]; then
# Commit and push the changes
branch=pmc-version-$VERSION
git checkout -b $branch
git add .
git commit -m "Update pmc docs to version $VERSION"
git push origin $branch
# Create a merge request
curl -v --request POST \
--header 'Authorization: Bearer '"$BITBUCKET_CI_TOKEN" \
--header 'Accept: application/json' \
--header "Content-Type: application/json" \
--data '{
"title": "BUILD_USER: Update pmc docs version '"$VERSION"'",
"source": {"branch": {"name": "'"$branch"'"}},
"destination": {"branch": {"name": "master"}}
}' \
"https://api.bitbucket.org/2.0/repositories/chromawallet/chromia-docs/pullrequests"
else
echo "No changes to commit."
fi
build:
extends:
- .setup
stage: build
interruptible: true
except:
refs:
- tags
script:
- mvn
$MAVEN_CLI_OPTS
--activate-profiles ci,docker
verify
gitlab-release:
extends: .gitlab-release-with-notes
script:
- echo "Release PMC $CI_COMMIT_TAG"
release:
name: 'PMC $CI_COMMIT_TAG'
description: release_notes.md
tag_name: '$CI_COMMIT_TAG'
assets:
links:
- name: 'Build Artifact (.tar.gz)'
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven/net/postchain/mc/management-console/${CI_COMMIT_TAG}/management-console-${CI_COMMIT_TAG}-dist.tar.gz'
link_type: 'package'
- name: 'Build Artifact (.zip)'
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/maven/net/postchain/mc/management-console/${CI_COMMIT_TAG}/management-console-${CI_COMMIT_TAG}-dist.zip'
link_type: 'package'
dependency-check:
extends: .maven-dependency-check
stage: dependency-check
interruptible: true
rules:
- if: $RUN_DEPENDENCY_CHECK == "true"
container-scanning:
variables:
REGISTRY: registry.gitlab.com/chromaway/core-tools/management-console
parallel:
matrix:
- IMAGE: [ pmc ]
VERSION: [ latest ]
only:
variables:
- $RUN_DEPENDENCY_CHECK == "true"
variables:
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
# when running from the command line.
# `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true -s .gitlab-settings.xml -U"
MAVEN_CLI_NVD_OPTS: "-DpnpmAuditAnalyzerEnabled=false -DnvdDatafeedUrl=https://nvd-data-feeds.chromia.dev/nvdcve-{0}.json.gz"
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
DOCKER_DRIVER: overlay2
DOCKER_CLI_EXPERIMENTAL: enabled
# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache:
paths:
- .m2/repository