Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend-clients
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
frontend-clients
Commits
08e499cf
Commit
08e499cf
authored
3 years ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
ozg-2541 pr anmerkungen
parent
87c9cdcb
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Jenkinsfile
+41
-11
41 additions, 11 deletions
Jenkinsfile
with
41 additions
and
11 deletions
Jenkinsfile
+
41
−
11
View file @
08e499cf
...
@@ -136,10 +136,7 @@ pipeline {
...
@@ -136,10 +136,7 @@ pipeline {
sh
'cp ${KUBE_CONFIG} ~/.kube/config'
sh
'cp ${KUBE_CONFIG} ~/.kube/config'
}
}
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-nexus-login'
,
usernameVariable:
'USER'
,
passwordVariable:
'PASSWORD'
)])
{
initHelmRepo
()
sh
'helm repo add ozg-base-apps-snapshot https://nexus.ozg-sh.de/repository/ozg-base-apps-snapshot --username ${USER} --password ${PASSWORD}'
sh
'helm repo add ozg-base-apps https://nexus.ozg-sh.de/repository/ozg-base-apps --username ${USER} --password ${PASSWORD}'
}
sh
'helm version'
sh
'helm version'
}
}
...
@@ -333,19 +330,23 @@ Void checkIfNamespaceExists(String namespace) {
...
@@ -333,19 +330,23 @@ Void checkIfNamespaceExists(String namespace) {
def
namespaceList
=
sh
(
script:
'kubectl get namespaces'
,
returnStdout:
true
)
def
namespaceList
=
sh
(
script:
'kubectl get namespaces'
,
returnStdout:
true
)
if
(
namespaceList
.
contains
(
namespace
))
{
if
(
namespaceList
.
contains
(
namespace
))
{
sh
"kubectl delete namespace ${namespace}"
deleteNamespace
(
namespace
)
}
}
}
}
}
Void
deleteNamespace
(
String
namespace
)
{
sh
"kubectl delete namespace ${namespace}"
}
}
Void
startPluto
(
String
namespace
,
String
values
,
String
bezeichner
)
{
Void
startPluto
(
String
namespace
,
String
values
,
String
bezeichner
)
{
container
(
"k8s"
)
{
container
(
"k8s"
)
{
dir
(
'goofy-client/apps/goofy-e2e/deployment-values/pluto'
)
{
dir
(
'goofy-client/apps/goofy-e2e/deployment-values/pluto'
)
{
if
(
env
.
BRANCH_NAME
==
'release'
)
{
if
(
env
.
BRANCH_NAME
==
'release'
)
{
sh
"helm upgrade --install --create-namespace pluto ozg-base-apps/pluto -f ${values} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --wait --wait-for-jobs"
startPlutoForReleaseTests
(
namespace
,
values
,
bezeichner
)
}
}
else
{
else
{
sh
"helm upgrade --install --create-namespace pluto ozg-base-apps-snapshot/pluto -f ${values} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --version ${getLatestChartVersion('pluto').trim()} --wait --wait-for-jobs"
startPlutoForSnapshotTests
(
namespace
,
values
,
bezeichner
)
}
}
}
}
...
@@ -353,14 +354,22 @@ Void startPluto(String namespace, String values, String bezeichner) {
...
@@ -353,14 +354,22 @@ Void startPluto(String namespace, String values, String bezeichner) {
}
}
}
}
Void
startPlutoForReleaseTests
(
String
namespace
,
String
values
,
String
bezeichner
)
{
sh
"helm upgrade --install --create-namespace pluto ozg-base-apps/pluto -f ${values} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --wait --wait-for-jobs"
}
Void
startPlutoForSnapshotTests
(
String
namespace
,
String
values
,
String
bezeichner
)
{
sh
"helm upgrade --install --create-namespace pluto ozg-base-apps-snapshot/pluto -f ${values} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --version ${getLatestChartVersion('pluto').trim()} --wait --wait-for-jobs"
}
Void
startGoofy
(
String
namespace
,
String
values
,
String
imageTag
,
String
bezeichner
)
{
Void
startGoofy
(
String
namespace
,
String
values
,
String
imageTag
,
String
bezeichner
)
{
container
(
"k8s"
)
{
container
(
"k8s"
)
{
dir
(
'goofy-client/apps/goofy-e2e/deployment-values/goofy'
)
{
dir
(
'goofy-client/apps/goofy-e2e/deployment-values/goofy'
)
{
if
(
env
.
BRANCH_NAME
==
'release'
)
{
if
(
env
.
BRANCH_NAME
==
'release'
)
{
sh
"helm upgrade --install --create-namespace goofy ozg-base-apps/goofy -f ${values} --set image.tag=${imageTag} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --wait --wait-for-jobs"
startGoofyForReleaseTests
(
namespace
,
values
,
bezeichner
,
imageTag
)
}
}
else
{
else
{
sh
"helm upgrade --install --create-namespace goofy ozg-base-apps-snapshot/goofy -f ${values} --set image.tag=${imageTag} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --version ${getLatestChartVersion('goofy').trim()} --wait --wait-for-jobs"
startGoofyForSnapshotTests
(
namespace
,
values
,
bezeichner
,
imageTag
)
}
}
}
}
...
@@ -371,6 +380,14 @@ Void startGoofy(String namespace, String values, String imageTag, String bezeich
...
@@ -371,6 +380,14 @@ Void startGoofy(String namespace, String values, String imageTag, String bezeich
}
}
}
}
Void
startGoofyForReleaseTests
(
String
namespace
,
String
values
,
String
bezeichner
,
String
imageTag
)
{
sh
"helm upgrade --install --create-namespace goofy ozg-base-apps/goofy -f ${values} --set image.tag=${imageTag} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --wait --wait-for-jobs"
}
Void
startGoofyForSnapshotTests
(
String
namespace
,
String
values
,
String
bezeichner
,
String
imageTag
)
{
sh
"helm upgrade --install --create-namespace goofy ozg-base-apps-snapshot/goofy -f ${values} --set image.tag=${imageTag} --set kop.bezeichner=${bezeichner} --namespace ${namespace} --version ${getLatestChartVersion('goofy').trim()} --wait --wait-for-jobs"
}
String
getLatestChartVersion
(
String
chart
)
{
String
getLatestChartVersion
(
String
chart
)
{
container
(
"k8s"
)
{
container
(
"k8s"
)
{
return
sh
(
script:
"helm search repo ozg-base-apps-snapshot --devel -l -o json | jq -r 'first(.[] | select((.name==\"ozg-base-apps-snapshot/${chart}\") and (.version|match(\"SNAPSHOT\$\"))) | .version)'"
,
returnStdout:
true
)
return
sh
(
script:
"helm search repo ozg-base-apps-snapshot --devel -l -o json | jq -r 'first(.[] | select((.name==\"ozg-base-apps-snapshot/${chart}\") and (.version|match(\"SNAPSHOT\$\"))) | .version)'"
,
returnStdout:
true
)
...
@@ -414,13 +431,19 @@ String generateBezeichner(String stage) {
...
@@ -414,13 +431,19 @@ String generateBezeichner(String stage) {
def
branchName
=
makeUrlConform
(
env
.
BRANCH_NAME
)
def
branchName
=
makeUrlConform
(
env
.
BRANCH_NAME
)
def
stageName
=
makeUrlConform
(
stage
)
def
stageName
=
makeUrlConform
(
stage
)
def
cutBranchNamePosition
=
30
-
(
branchName
.
length
()
+
stageName
.
length
()
+
8
)
return
"${cutBranchNameForKeycloakRealm(branchName, stageName)}${stageName}"
}
String
cutBranchNameForKeycloakRealm
(
String
branchName
,
String
stageName
)
{
def
maxKeycloakRealmLength
=
30
def
postPrefixLength
=
8
def
cutBranchNamePosition
=
maxKeycloakRealmLength
-
(
branchName
.
length
()
+
stageName
.
length
()
+
postPrefixLength
)
if
(
cutBranchNamePosition
<
0
)
{
if
(
cutBranchNamePosition
<
0
)
{
branchName
=
branchName
[
0
..
cutBranchNamePosition
]
branchName
=
branchName
[
0
..
cutBranchNamePosition
]
}
}
return
"${
branchName
}${stageName}"
return
branchName
}
}
String
generateNamespaceName
(
String
bezeichner
)
{
String
generateNamespaceName
(
String
bezeichner
)
{
...
@@ -578,3 +601,10 @@ String getElementAccessToken() {
...
@@ -578,3 +601,10 @@ String getElementAccessToken() {
return
readJSON
(
text:
sh
(
script:
'''curl -XPOST -d \"$LOGIN_JSON\" https://matrix.ozg-sh.de/_matrix/client/v3/login'''
,
returnStdout:
true
)).
access_token
return
readJSON
(
text:
sh
(
script:
'''curl -XPOST -d \"$LOGIN_JSON\" https://matrix.ozg-sh.de/_matrix/client/v3/login'''
,
returnStdout:
true
)).
access_token
}
}
}
}
Void
initHelmRepo
()
{
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-nexus-login'
,
usernameVariable:
'USER'
,
passwordVariable:
'PASSWORD'
)])
{
sh
'helm repo add ozg-base-apps-snapshot https://nexus.ozg-sh.de/repository/ozg-base-apps-snapshot --username ${USER} --password ${PASSWORD}'
sh
'helm repo add ozg-base-apps https://nexus.ozg-sh.de/repository/ozg-base-apps --username ${USER} --password ${PASSWORD}'
}
}
\ No newline at end of file
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