-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
89 lines (82 loc) · 2.6 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
variables:
SPRING_PROFILES_ACTIVE: gitlab-ci
stages:
- build
- test
- package
- publish
maven-build:
image: maven:3-jdk-11
stage: build
script:
- "mvn clean package -X"
artifacts:
paths:
- target/*
sonarqube:
stage: test
only:
- main
needs: ["maven-build"]
image: sonarsource/sonar-scanner-cli:latest
allow_failure: true
variables:
SONAR_HOST_URL: https://sonar.sterul.com
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
GIT_DEPTH: 0
GIT_STRATEGY: clone
script:
- sonar-scanner
-Dsonar.qualitygate.wait=true
-Dsonar.sources=src
-Dsonar.login="$SONAR_TOKEN"
-Dsonar.projectKey="$CI_PROJECT_NAME"
-Dsonar.links.scm="$CI_PROJECT_URL"
-Dsonar.scm.revision="$CI_COMMIT_SHA"
-Dsonar.scm.disabled=False
-Dsonar.projectVersion="$CI_PIPELINE_IID"
-Dsonar.java.binaries=./target
package-docker-qa:
stage: package
needs: ["maven-build"]
resource_group: qa
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
REGISTRY_TAG: qa
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$REGISTRY_TAG --cache=true --cache-ttl=100h
only:
- main
publish-cluster:
stage: publish
needs: ["package-docker-qa"]
trigger:
project: opencookbook/opencookbook-docker
branch: main
# deploy_qa:
# stage: publish
# needs: ["package-docker-qa"]
# resource_group: qa
# image: registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/2.16.6-kube-1.13.12
# environment:
# name: qa
# script:
# - kubectl get secret opencookbook-registry --namespace $KUBE_NAMESPACE && kubectl delete secret opencookbook-registry --namespace $KUBE_NAMESPACE
# - kubectl create secret docker-registry opencookbook-registry --namespace $KUBE_NAMESPACE --docker-server=git.sterul.com:5005 --docker-username=$registry_user --docker-password=$registry_password
# - kubectl get deployment opencookbook-qa --namespace $KUBE_NAMESPACE && kubectl delete deployment opencookbook-qa --namespace $KUBE_NAMESPACE
# - kubectl apply -f kubernetes/deployment-qa.yml
# # Wait for pod
# - kubectl -n $KUBE_NAMESPACE wait --for=condition=available deployment/opencookbook-qa --timeout=300s
# stop-qa:
# stage: deploy
# script:
# -
# environment:
# name: qa
# action: stop
# rules:
# - if: $CI_MERGE_REQUEST_ID
# when: manual