-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
64 lines (60 loc) · 1.77 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
include:
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
stages:
- semgrep
- build-maven
- build-docker
semgrep:
stage: semgrep
image: returntocorp/semgrep-agent:latest
script: semgrep-agent --gitlab-json > gl-sast-report.json || true
variables:
SEMGREP_RULES: >- # more at semgrep.dev/explore
p/r2c-ci
p/r2c-security-audit
p/command-injection
p/jwt
p/xss
artifacts:
reports:
sast: gl-sast-report.json
build-maven:
stage: build-maven
image: maven:3-openjdk-17
variables:
MAVEN_OPTS: '-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository'
script:
- mvn clean package
- git diff --exit-code
- git describe --tags | sed 's/\(.*\)-.*/\1/' > ./VERSION.txt
cache:
key: '$CI_JOB_NAME-$CI_COMMIT_REF_SLUG'
paths:
- '.m2/repository'
- 'ones-frontend/node'
artifacts:
expire_in: 1 hour
paths:
- ones-webapp/target/ones-webapp.jar
- VERSION.txt
reports:
junit:
- 'ones-frontend/junit.xml'
- 'ones-webapp/target/surefire-reports/TEST-*.xml'
- 'ones-webapp/target/failsafe-reports/TEST-*.xml'
build-docker:
stage: build-docker
only:
- master
dependencies:
- semgrep
- build-maven
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"$(echo -n $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD | base64)\"}}}" > /kaniko/.docker/config.json
- version=`cat VERSION.txt`
- echo Publishing version $version
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination docker.io/fourtyseveneleven/ones:$version --destination docker.io/fourtyseveneleven/ones:latest