This repository has been archived by the owner on Dec 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
115 lines (107 loc) · 3.21 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
110
111
112
113
114
variables:
REGISTRY_HOST: ipe-wim-gitlab.fzi.de:5000
IMAGE_NAME: $REGISTRY_HOST/$CI_PROJECT_PATH
MAVEN_CLI_OPTS: -DskipTests --batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true
GIT_REPO_ORIGIN: ssh://[email protected]:2222
GIT_STRATEGY: clone
stages:
- build
- docker
- deploy
- release
build:
image: maven:3-jdk-8
stage: build
script:
- echo "$MAVEN_CREDENTIALS" > /root/.m2/settings.xml
- mvn clean package -DskipTests
- export MVN_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[')
- "echo $MVN_VERSION >> ./target/mvn_version"
artifacts:
paths:
- ./target/*.jar
- ./target/mvn_version
expire_in: 1 hour
except:
- /release-.*$/
docker-flink:
image: docker:17.06.0-ce
stage: docker
dependencies:
- build
script:
- export MVN_VERSION=$(cat ./target/mvn_version)
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $REGISTRY_HOST
- docker build --pull -t $IMAGE_NAME:$MVN_VERSION .
- docker push $IMAGE_NAME:$MVN_VERSION
only:
- dev
deploy:
image: maven:3-jdk-8
stage: deploy
script:
- echo "$MAVEN_CREDENTIALS" > /root/.m2/settings.xml
- mvn deploy -DskipTests
only:
- dev
artifacts:
paths:
- ./**/*.jar
expire_in: 1 hour
start release:
image: maven:3-jdk-8
stage: release
script:
- echo "$MAVEN_CREDENTIALS" > /root/.m2/settings.xml
- git remote set-url origin $GIT_REPO_ORIGIN/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME.git
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH")
- mkdir ~/.ssh
- touch ~/.ssh/known_hosts
- ssh-keyscan -p 2222 -t rsa ipe-wim-gitlab.fzi.de > ~/.ssh/known_hosts
- git config --global user.email '[email protected]'
- git config --global user.name 'zehnder'
- git fetch
- git checkout master
- git checkout dev
- mvn -B jgitflow:release-start $MAVEN_CLI_OPTS
- git push origin --all
only:
- dev
when: manual
finish release:
image: maven:3-jdk-8
stage: release
script:
- echo "$MAVEN_CREDENTIALS" > /root/.m2/settings.xml
- git remote set-url origin $GIT_REPO_ORIGIN/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME.git
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH")
- mkdir ~/.ssh
- touch ~/.ssh/known_hosts
- ssh-keyscan -p 2222 -t rsa ipe-wim-gitlab.fzi.de > ~/.ssh/known_hosts
- git config --global user.email '[email protected]'
- git config --global user.name 'zehnder'
- git checkout master
- git checkout dev
- git checkout $CI_BUILD_REF_NAME
- mvn -B jgitflow:release-finish $MAVEN_CLI_OPTS
- git push origin --all
- git push origin --tags
when: manual
except:
- master
docker hub:
image: docker:17.06.0-ce
stage: release
when: manual
script:
- export MVN_VERSION=$(cat ./target/mvn_version)
- echo $MVN_VERSION
- docker login -u streampipesbuild -p $DOCKER_HUB_USER_PWD
- docker build --pull -t streampipes/pe-examples-flink:$MVN_VERSION .
- docker push streampipes/pe-examples-flink:$MVN_VERSION
- docker build --pull -t streampipes/pe-examples-flink .
- docker push streampipes/pe-examples-flink
only:
- master