-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
99 lines (86 loc) · 2.8 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
stages:
- static-test
- build
- build-variant
- test
- release
include:
- template: Security/Container-Scanning.gitlab-ci.yml
container_scanning:
before_script: []
variables:
DOCKER_IMAGE: ${CI_REGISTRY_IMAGE}
default:
image: docker:stable
tags:
- docker
services:
- docker:dind
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
variables:
DOCKER_HOST: tcp://docker:2375/
PANDOC_VERSION: '2.17.1.1'
test:pandoc:
stage: static-test
needs: []
before_script: []
services: []
image: hadolint/hadolint:latest-alpine
script:
- hadolint Dockerfile
test:eisvogel:
stage: static-test
needs: []
before_script: []
services: []
image: hadolint/hadolint:latest-alpine
script:
- hadolint variants/eisvogel.Dockerfile
build:pandoc:
stage: build
needs: ["test:pandoc"]
script:
- docker pull "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}" || echo "could not pull image for use as cache"
- docker build --cache-from "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}" --build-arg PANDOC_VERSION="$PANDOC_VERSION" -t "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}" .
- docker push "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}"
build-variant:eisvogel:
stage: build-variant
needs: ["build:pandoc", "test:eisvogel"]
script:
- docker pull "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}-eisvogel" || echo "could not pull image for use as cache"
- docker build --cache-from "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}-eisvogel" --build-arg PANDOC_VERSION="$PANDOC_VERSION" -t "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}-eisvogel" ./variants -f ./variants/eisvogel.Dockerfile
- docker push "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}-eisvogel"
release:pandoc:
stage: release
needs: ["build:pandoc"]
script:
- docker pull "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}"
- docker tag "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}" "${CI_REGISTRY_IMAGE}:latest"
- docker push "${CI_REGISTRY_IMAGE}:latest"
only:
- main
- tags
release:eisvogel:
stage: release
needs: ["build-variant:eisvogel"]
script:
- docker pull "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}-eisvogel"
- docker tag "${CI_REGISTRY_IMAGE}:${PANDOC_VERSION}-eisvogel" "${CI_REGISTRY_IMAGE}:eisvogel"
- docker push "${CI_REGISTRY_IMAGE}:eisvogel"
only:
- main
- tags
release:rpm:
stage: release
needs: ["build:pandoc"]
script:
- "id=$(docker create ${CI_REGISTRY_IMAGE}:${PANDOC_VERSION} ls) && docker cp $id:/root/pandoc.rpm - > pandoc-${PANDOC_VERSION}.rpm"
- "apk add --no-cache curl"
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file pandoc-${PANDOC_VERSION}.rpm "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/pandoc-rpm/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}.rpm"'
only:
- tags
artifacts:
paths:
- "*.rpm"