-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci-explorviz-common.yml
110 lines (104 loc) · 3.8 KB
/
.gitlab-ci-explorviz-common.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
variables:
DEFAULT_TAG: exec-docker
default:
tags:
- $DEFAULT_TAG
.build-and-deploy:
stage: deploy:images
variables:
DOCKERHUB_TAG: "amd64"
DOCKER_CONTEXT_PATH: $CI_PROJECT_DIR
IMAGE_NAME: $DOCKERHUB_IMAGE_NAME
DOCKERFILE_NAME: "Dockerfile"
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
rules:
- if: $ARM64_BUILD
when: never
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CONTAINER_REGISTRY_URL\":{\"auth\":\"$(echo -n ${DOCKERHUB_USERNAME}:${DOCKERHUB_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context=$DOCKER_CONTEXT_PATH
--dockerfile=${DOCKER_CONTEXT_PATH}/${DOCKERFILE_NAME}
--destination=$DOCKERHUB_ORGANIZATION/${IMAGE_NAME}:${DOCKERHUB_TAG}
.build-and-deploy-quarkus-native:
stage: deploy:images
image: explorviz/ubi-quarkus-mandrel-builder-image
variables:
IMAGE_NAME: $DOCKERHUB_IMAGE_NAME_NATIVE
IMAGE_TAG: "latest"
rules:
- if: $ARM64_BUILD
when: never
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
script:
- ./gradlew clean assemble
-Dquarkus.package.type=native -Dquarkus.container-image.push=true
-Dquarkus.container-image.name=$DOCKERHUB_IMAGE_NAME_NATIVE
-Dquarkus.container-image.tag=$IMAGE_TAG
-Dquarkus.native.additional-build-args="--initialize-at-run-time=org.apache.kafka.common.security.authenticator.SaslClientAuthenticator\\,org.apache.kafka.common.security.oauthbearer.internals.expiring.ExpiringCredentialRefreshingLogin"
-Dquarkus.container-image.username=$DOCKERHUB_USERNAME
-Dquarkus.container-image.password=$DOCKERHUB_PASSWORD
after_script:
- echo "Image was uploaded to Dockerhub; explorviz/${DOCKERHUB_IMAGE_NAME_NATIVE}:${IMAGE_TAG}"
.build-and-deploy-quarkus-jvm:
stage: deploy:images
image: ghcr.io/graalvm/graalvm-community:21
variables:
IMAGE_NAME: $DOCKERHUB_IMAGE_NAME
IMAGE_TAG: "latest"
rules:
- if: $ARM64_BUILD
when: never
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
script:
- ./gradlew clean assemble
-Dquarkus.container-image.build=true
-Dquarkus.container-image.push=true
-Dquarkus.container-image.name=$IMAGE_NAME
-Dquarkus.container-image.tag=$IMAGE_TAG
-Dquarkus.container-image.username=$DOCKERHUB_USERNAME
-Dquarkus.container-image.password=$DOCKERHUB_PASSWORD
after_script:
- echo "Image was uploaded to Dockerhub; explorviz/${DOCKERHUB_IMAGE_NAME}:${IMAGE_TAG}"
.retag-dockerhub-image:
stage: deploy:retagging
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [""]
rules:
- if: $MULTI_ARCH_BUILD || $ARM64_BUILD
when: never
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
variables:
IMAGE_NAME: ${DOCKERHUB_IMAGE_NAME}
SOURCE_TAG: "latest"
TARGET_TAG: $CI_COMMIT_SHORT_SHA
script:
- crane auth login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD "index.docker.io"
- crane cp $DOCKERHUB_ORGANIZATION/$DOCKERHUB_IMAGE_NAME:$SOURCE_TAG $DOCKERHUB_ORGANIZATION/$DOCKERHUB_IMAGE_NAME:$TARGET_TAG
.retag-as-multi-arch-dockerhub-image:
image:
name: mplatform/manifest-tool:alpine
entrypoint: [""]
stage: deploy:retagging
rules:
- if: $MULTI_ARCH_BUILD || $ARM64_BUILD
variables:
MANIFEST_PLATFORMS: "linux/amd64,linux/arm64/v8"
IMAGE_NAME: ${DOCKERHUB_IMAGE_NAME}
TARGET_TAG: "latest"
TAG_PREFIX: ""
script:
- manifest-tool
--username ${DOCKERHUB_USERNAME}
--password ${DOCKERHUB_PASSWORD}
push from-args
--platforms ${MANIFEST_PLATFORMS}
--template ${DOCKERHUB_ORGANIZATION}/${IMAGE_NAME}:${TAG_PREFIX}ARCH
--target ${DOCKERHUB_ORGANIZATION}/${IMAGE_NAME}:${TARGET_TAG}