-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
109 lines (102 loc) · 3.46 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
stages:
- .pre
- build
- test
- deploy
dependency-build-job:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
stage: .pre
variables:
SSL_CERT_DIR: "/tmp/other-ssl-dir"
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- >-
/kaniko/executor
--target=dependencies
--cache=true
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/docker/dependency-image/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}/dependencies:latest"
--skip-tls-verify
when: manual
allow_failure: true
build-job:
image: maven:3.8.4-openjdk-17
stage: build
script:
- mvn package -B
- mvn javadoc:javadoc
artifacts:
paths:
- target/site/apidocs/
container-build-job:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
stage: build
variables:
SSL_CERT_DIR: "/tmp/other-ssl-dir"
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- export DEPENDENCIES_IMAGE="${CI_REGISTRY_IMAGE}/dependencies:latest"
- >-
/kaniko/executor
--cache=false
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/docker/build-image/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG-build}"
--build-arg DEPENDENCIES_IMAGE
--skip-tls-verify
test-job:
image: maven:3.8.4-openjdk-17
stage: test
script:
- "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report"
- "mvn groovy:execute@printJacocoCoverage"
coverage: '/Instructions.*?([0-9]{1,3})%/'
artifacts:
paths:
- target/site/jacoco/
- target/karate-reports/
sonar-cloud-job:
image: maven:3.8.4-openjdk-17
stage: deploy
script:
- mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=hslu.enlab:url-shortener
pages:
stage: deploy
image: registry.gitlab.com/pages/hugo/hugo_extended:latest
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- apk add --update curl && rm -rf /var/cache/apk/*
script:
- mkdir -p doc/themes/geekdoc/
- curl -L https://github.com/thegeeklab/hugo-geekdoc/releases/latest/download/hugo-geekdoc.tar.gz | tar -xz -C doc/themes/geekdoc/ --strip-components=1
- hugo --source doc/
- mkdir public
- cp -r doc/public/* public
artifacts:
paths:
- public
only:
- main
deploy-job:
stage: deploy
before_script:
- apk add git
# Setup SSH deploy keys
- 'which ssh-agent || ( apk add openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- ssh [email protected] "cd git/url-shortener && bash deploy.sh && exit"
only:
refs:
- main