Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alfa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
alfa
Commits
430eaab4
Commit
430eaab4
authored
4 years ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
OZG-533 jenkins on rancher
parent
80353786
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Jenkinsfile
+60
-89
60 additions, 89 deletions
Jenkinsfile
goofy-client/apps/goofy-e2e/cypress-ci.json
+2
-2
2 additions, 2 deletions
goofy-client/apps/goofy-e2e/cypress-ci.json
goofy-client/package.json
+3
-1
3 additions, 1 deletion
goofy-client/package.json
with
65 additions
and
92 deletions
Jenkinsfile
+
60
−
89
View file @
430eaab4
def
FAILED_STAGE
def
FAILED_STAGE
pipeline
{
pipeline
{
agent
any
agent
{
tools
{
node
{
maven
'maven3'
label
'jenkins-worker'
jdk
'jdk11'
}
nodejs
'node14'
}
//{
// node {
// label 'goofy'
//}
//}
environment
{
//BLUE_OCEAN_URL = "https://jenkins-dev-tools.apps.lab.okd.local/blue/organizations/jenkins/OZG%2Fgoofy/detail/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/pipeline"
BLUE_OCEAN_URL
=
"https://jenkins.ozg-sh.de/blue/organizations/jenkins/OZG%2Fgoofy/detail/${env.BRANCH_NAME}/${env.BUILD_NUMBER}/pipeline"
}
}
options
{
options
{
...
@@ -27,13 +16,16 @@ pipeline {
...
@@ -27,13 +16,16 @@ pipeline {
stages
{
stages
{
stage
(
'Client'
)
{
stage
(
'Client'
)
{
steps
{
steps
{
//
container("nodejs"){
container
(
"nodejs"
){
script
{
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
FAILED_STAGE
=
env
.
STAGE_NAME
sh
'npm --version'
sh
'npm --version'
dir
(
'goofy-client'
)
{
dir
(
'goofy-client'
)
{
sh
'npm install'
sh
'echo "registry=http://nexus.ozg-sh.de/repository/npm-proxy" >> ~/.npmrc'
sh
'echo "_auth=amVua2luczpQaihzX0ZNNFU5ZC8=" >> ~/.npmrc'
sh
'npm install --no-optional'
if
(
env
.
BRANCH_NAME
==
'release'
)
{
if
(
env
.
BRANCH_NAME
==
'release'
)
{
sh
'npm run ci-prodBuild'
sh
'npm run ci-prodBuild'
...
@@ -43,21 +35,15 @@ pipeline {
...
@@ -43,21 +35,15 @@ pipeline {
}
}
sh
'npm run ci-test'
sh
'npm run ci-test'
if
(
env
.
BRANCH_NAME
==
'master'
)
{
withSonarQubeEnv
(
'sonarqube'
){
sh
'npm run ci-sonar'
}
}
}
}
}
}
//gi
}
}
}
}
post
{
post
{
always
{
always
{
junit
testResults:
'goofy-client/test-report.xml'
,
skipPublishingChecks:
true
junit
testResults:
'goofy-client/test-report.xml'
,
skipPublishingChecks:
true
}
}
}
}
}
}
stage
(
'Server'
)
{
stage
(
'Server'
)
{
...
@@ -66,19 +52,9 @@ pipeline {
...
@@ -66,19 +52,9 @@ pipeline {
FAILED_STAGE
=
env
.
STAGE_NAME
FAILED_STAGE
=
env
.
STAGE_NAME
}
}
container
(
"maven-11"
){
container
(
"maven-11"
){
configFileProvider
([
configFile
(
fileId:
'
9aac2fac-7d8d-4128-846b-0a61951df703
'
,
variable:
'MAVEN_SETTINGS'
)])
{
configFileProvider
([
configFile
(
fileId:
'
maven-settings
'
,
variable:
'MAVEN_SETTINGS'
)])
{
sh
'mvn --version'
sh
'mvn --version'
sh
'mvn -s $MAVEN_SETTINGS -pl -goofy-client clean install'
sh
'mvn -s $MAVEN_SETTINGS -pl -goofy-client clean install spring-boot:build-image -Dspring-boot.build-image.imageName=docker.ozg-sh.de/goofy:build-latest'
script
{
if
(
env
.
BRANCH_NAME
==
'master'
)
{
dir
(
'goofy-server'
){
withSonarQubeEnv
(
'sonarqube'
){
sh
'mvn sonar:sonar'
}
}
}
}
}
}
}
}
}
}
...
@@ -87,34 +63,25 @@ pipeline {
...
@@ -87,34 +63,25 @@ pipeline {
junit
testResults:
'**/target/surefire-reports/*.xml'
,
skipPublishingChecks:
true
junit
testResults:
'**/target/surefire-reports/*.xml'
,
skipPublishingChecks:
true
}
}
}
}
}
}
stage
(
'
Openshift build
'
)
{
stage
(
'
Push Docker image
'
)
{
steps
{
steps
{
script
{
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
FAILED_STAGE
=
env
.
STAGE_NAME
def
pom
=
readMavenPom
file:
'pom.xml'
def
pom
=
readMavenPom
file:
'pom.xml'
def
version
=
pom
.
version
def
version
=
pom
.
version
openshift
.
withCluster
()
{
container
(
"docker"
)
{
openshift
.
withProject
()
{
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-docker-login'
,
usernameVariable:
'USER'
,
passwordVariable:
'PASSWORD'
)])
{
dir
(
'goofy-server'
)
{
sh
'docker login docker.ozg-sh.de -u ${USER} -p ${PASSWORD}'
openshift
.
startBuild
(
"goofy-builder"
,
"--from-dir=."
,
"--follow"
,
"--wait"
)
}
openshift
.
tag
(
"goofy-builder:build-latest"
,
"goofy-builder:${env.BRANCH_NAME}-${version}"
)
if
(
env
.
BRANCH_NAME
==
'release'
)
{
sh
"docker tag docker.ozg-sh.de/goofy:build-latest docker.ozg-sh.de/goofy:${env.BRANCH_NAME}-${version}"
openshift
.
tag
(
"goofy-builder:${env.BRANCH_NAME}-${version}"
,
"goofy-builder:latest"
)
sh
"docker push docker.ozg-sh.de/goofy:${env.BRANCH_NAME}-${version}"
}
if
(
env
.
BRANCH_NAME
==
'master'
)
{
if
(
env
.
BRANCH_NAME
==
'master'
)
{
def
dc
=
openshift
.
selector
(
'dc'
,
'goofy-e2e'
)
sh
'docker tag docker.ozg-sh.de/goofy:build-latest docker.ozg-sh.de/goofy:e2e-test'
sh
'docker push docker.ozg-sh.de/goofy:e2e-test'
openshift
.
tag
(
"goofy-builder:${env.BRANCH_NAME}-${version}"
,
"goofy-builder:snapshot-latest"
)
openshift
.
tag
(
"goofy-builder:${env.BRANCH_NAME}-${version}"
,
"goofy-builder:e2e-latest"
)
dc
.
rollout
().
status
()
}
}
}
}
}
}
...
@@ -122,7 +89,7 @@ pipeline {
...
@@ -122,7 +89,7 @@ pipeline {
}
}
}
}
stage
(
'E2E-Test'
)
{
stage
(
'E2E-Test
s
'
)
{
when
{
when
{
branch
'master'
branch
'master'
}
}
...
@@ -130,10 +97,17 @@ pipeline {
...
@@ -130,10 +97,17 @@ pipeline {
script
{
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
FAILED_STAGE
=
env
.
STAGE_NAME
}
}
container
(
"cypress"
){
sh
'npm --version'
container
(
"kubectl"
)
{
sh
'kubectl rollout restart deployment/goofy -n sh-kiel-e2e'
sh
'kubectl rollout status deployment/goofy -n sh-kiel-e2e'
sh
'kubectl rollout restart deployment/pluto -n sh-kiel-e2e'
sh
'kubectl rollout status deployment/pluto -n sh-kiel-e2e'
}
container
(
"cypress"
)
{
dir
(
'goofy-client'
)
{
dir
(
'goofy-client'
)
{
sh
'npm install'
sh
'npm run cypress:version'
sh
'npm run cypress:version'
sh
'npm run cypress:ci-run'
sh
'npm run cypress:ci-run'
}
}
...
@@ -153,7 +127,7 @@ pipeline {
...
@@ -153,7 +127,7 @@ pipeline {
}
}
}
}
stage
(
'
nexus deploy
'
){
stage
(
'
Deploy Maven Artifacts to Nexus
'
)
{
when
{
when
{
anyOf
{
anyOf
{
branch
'master'
branch
'master'
...
@@ -165,55 +139,52 @@ pipeline {
...
@@ -165,55 +139,52 @@ pipeline {
FAILED_STAGE
=
env
.
STAGE_NAME
FAILED_STAGE
=
env
.
STAGE_NAME
}
}
container
(
'maven-11'
)
{
container
(
'maven-11'
)
{
configFileProvider
([
configFile
(
fileId:
'
9aac2fac-7d8d-4128-846b-0a61951df703
'
,
variable:
'MAVEN_SETTINGS'
)])
{
configFileProvider
([
configFile
(
fileId:
'
maven-settings
'
,
variable:
'MAVEN_SETTINGS'
)])
{
sh
'mvn -s $MAVEN_SETTINGS -pl -goofy-client -DskipTests deploy'
sh
'mvn -s $MAVEN_SETTINGS -pl -goofy-client -DskipTests deploy'
}
}
}
}
}
}
}
}
stage
(
'
Openshift deplo
y'
)
{
stage
(
'
Deploy Goof
y'
)
{
when
{
when
{
anyOf
{
anyOf
{
branch
'master'
;
branch
'master'
branch
'release'
branch
'release'
}
}
}
}
steps
{
steps
{
script
{
container
(
"docker"
)
{
FAILED_STAGE
=
env
.
STAGE_NAME
script
{
def
pom
=
readMavenPom
file:
'pom.xml'
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-docker-login'
,
usernameVariable:
'USER'
,
passwordVariable:
'PASSWORD'
)])
{
def
version
=
pom
.
version
sh
'docker login docker.ozg-sh.de -u ${USER} -p ${PASSWORD}'
openshift
.
withCluster
()
{
openshift
.
withProject
()
{
openshift
.
tag
(
"goofy-builder:${env.BRANCH_NAME}-${version}"
,
"sh-kiel-dev/goofy:${env.BRANCH_NAME}-${version}"
)
if
(
env
.
BRANCH_NAME
==
'master'
)
{
openshift
.
tag
(
"goofy-builder:snapshot-latest"
,
"sh-kiel-dev/goofy:snapshot-latest"
)
}
if
(
env
.
BRANCH_NAME
==
'release'
)
{
if
(
env
.
BRANCH_NAME
==
'release'
)
{
openshift
.
tag
(
"goofy-builder:latest"
,
"sh-kiel-dev/goofy:latest"
)
sh
'docker tag docker.ozg-sh.de/goofy:build-latest docker.ozg-sh.de/goofy:latest'
sh
'docker push docker.ozg-sh.de/goofy:latest'
}
}
}
if
(
env
.
BRANCH_NAME
==
'master'
)
{
openshift
.
withProject
(
'sh-kiel-dev'
)
{
def
dc
=
openshift
.
selector
(
'deployments'
,
'goofy'
)
dc
.
rollout
().
status
()
if
(
env
.
BRANCH_NAME
==
'master'
)
{
sh
'docker tag docker.ozg-sh.de/goofy:build-latest docker.ozg-sh.de/goofy:snapshot-latest'
sh
'docker push docker.ozg-sh.de/goofy:snapshot-latest'
}
}
}
}
}
}
}
}
}
}
container
(
"kubectl"
){
}
script
{
post
{
if
(
env
.
BRANCH_NAME
==
'release'
)
{
failure
{
sh
'kubectl rollout restart deployment/goofy -n sh-kiel-test'
script
{
sh
'kubectl rollout status deployment/goofy -n sh-kiel-test'
if
(
env
.
BRANCH_NAME
==
'master'
)
{
}
slackSend
(
color:
"danger"
,
message:
"Goofy: Build Failed. Stage: ${FAILED_STAGE} Build-ID: <${BLUE_OCEAN_URL}|${env.BUILD_NUMBER}>"
)
if
(
env
.
BRANCH_NAME
==
'master'
)
{
sh
'kubectl rollout restart deployment/goofy -n sh-kiel-dev'
sh
'kubectl rollout status deployment/goofy -n sh-kiel-dev'
}
}
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
goofy-client/apps/goofy-e2e/cypress-ci.json
+
2
−
2
View file @
430eaab4
{
{
"baseUrl"
:
"http://
goofy-e2e-dev-tools.apps.lab.okd.local/
"
,
"baseUrl"
:
"http
s
://
kiel.e2e.ozg-sh.de
"
,
"env"
:
{
"env"
:
{
"dbUrl"
:
"e2e-test:
sadf3tr%2Cmb4%25.
@1
7
2.
30.190.222:27017
"
,
"dbUrl"
:
"e2e-test:
JkejFfXD
@1
9
2.
168.101.11:30423
"
,
"database"
:
"sh-kiel-e2e-test"
,
"database"
:
"sh-kiel-e2e-test"
,
"keycloakRealm"
:
"sh-kiel-dev"
,
"keycloakRealm"
:
"sh-kiel-dev"
,
"keycloakUrl"
:
"https://sso.ozg-sh.de/"
,
"keycloakUrl"
:
"https://sso.ozg-sh.de/"
,
...
...
This diff is collapsed.
Click to expand it.
goofy-client/package.json
+
3
−
1
View file @
430eaab4
...
@@ -93,7 +93,6 @@
...
@@ -93,7 +93,6 @@
"@typescript-eslint/eslint-plugin"
:
"4.3.0"
,
"@typescript-eslint/eslint-plugin"
:
"4.3.0"
,
"@typescript-eslint/parser"
:
"4.3.0"
,
"@typescript-eslint/parser"
:
"4.3.0"
,
"codelyzer"
:
"6.0.1"
,
"codelyzer"
:
"6.0.1"
,
"cypress"
:
"^6.6.0"
,
"cypress-mochawesome-reporter"
:
"^1.3.0"
,
"cypress-mochawesome-reporter"
:
"^1.3.0"
,
"dotenv"
:
"6.2.0"
,
"dotenv"
:
"6.2.0"
,
"eslint"
:
"7.10.0"
,
"eslint"
:
"7.10.0"
,
...
@@ -111,5 +110,8 @@
...
@@ -111,5 +110,8 @@
"ts-node"
:
"9.1.1"
,
"ts-node"
:
"9.1.1"
,
"tslint"
:
"6.1.3"
,
"tslint"
:
"6.1.3"
,
"typescript"
:
"^4.0.7"
"typescript"
:
"^4.0.7"
},
"optionalDependencies"
:
{
"cypress"
:
"^6.6.0"
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment