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
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
alfa
Commits
0c12f8d0
Commit
0c12f8d0
authored
2 years ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
ozg-3075 build helm chart
parent
ac100788
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
+25
-25
25 additions, 25 deletions
Jenkinsfile
with
25 additions
and
25 deletions
Jenkinsfile
+
25
−
25
View file @
0c12f8d0
...
...
@@ -13,6 +13,7 @@ pipeline {
IMAGE_TAG
=
""
VERSION
=
""
E2E_FAILED
=
""
HELM_CHART_VERSION
=
""
}
options
{
...
...
@@ -189,16 +190,14 @@ pipeline {
container
(
'k8s'
)
{
script
{
FAILED_GOOFY_STAGE
=
env
.
STAGE_NAME
def
helmChartVersion
=
generateImageTag
()
setHelmChartVersion
(
helmChartVersion
)
HELM_CHART_VERSION
=
generateHelmChartVersion
()
sh
"helm lint -f goofy-server/src/main/helm/test-values.yaml goofy-server/src/main/helm"
sh
"helm unittest -f '../../test/helm/*.yaml' goofy-server/src/main/helm"
sh
"helm package goofy-server/src/main/helm"
sh
"helm package goofy-server/src/main/helm
--version=${HELM_CHART_VERSION}
"
deployHelmChart
(
helmChartVersion
)
deployHelmChart
(
HELM_CHART_VERSION
)
}
}
}
...
...
@@ -235,7 +234,7 @@ pipeline {
def
stageName
=
env
.
STAGE_NAME
def
bezeichner
=
generateBezeichner
(
stageName
)
startEnvironment
(
bezeichner
,
stageName
,
IMAGE_TAG
,
true
)
startEnvironment
(
bezeichner
,
stageName
,
IMAGE_TAG
,
true
,
HELM_CHART_VERSION
)
def
testResult
=
runTests
(
stageName
,
bezeichner
,
'einheitlicher-ansprechpartner'
)
...
...
@@ -263,7 +262,7 @@ pipeline {
def
stageName
=
env
.
STAGE_NAME
def
bezeichner
=
generateBezeichner
(
stageName
)
startEnvironment
(
bezeichner
,
stageName
,
IMAGE_TAG
,
false
)
startEnvironment
(
bezeichner
,
stageName
,
IMAGE_TAG
,
false
,
HELM_CHART_VERSION
)
def
testResult
=
runTests
(
stageName
,
bezeichner
,
'main-tests'
)
...
...
@@ -328,15 +327,12 @@ pipeline {
}
Void
deployHelmChart
(
String
helmChartVersion
)
{
NEXUS_URL
=
'http://nexus.dev-tools:8081/service/rest/v1/components?repository=ozg-base-apps'
NEXUS_SNAPSHOT_URL
=
'http://nexus.dev-tools:8081/service/rest/v1/components?repository=ozg-base-apps-snapshot'
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-nexus-login'
,
usernameVariable:
'USERNAME'
,
passwordVariable:
'PASSWORD'
)]){
if
(
env
.
BRANCH_NAME
==
'release'
)
{
result
=
sh
script:
'''curl -u $USERNAME:$PASSWORD
$NEXUS_URL
-F file=@goofy-'''
+
helmChartVersion
+
'''.tgz'''
,
returnStdout:
true
result
=
sh
script:
'''curl -u $USERNAME:$PASSWORD
http://nexus.dev-tools:8081/service/rest/v1/components?repository=ozg-base-apps
-F file=@goofy-'''
+
helmChartVersion
+
'''.tgz'''
,
returnStdout:
true
}
else
{
result
=
sh
script:
'''curl -u $USERNAME:$PASSWORD
$NEXUS_SNAPSHOT_URL
-F file=@goofy-'''
+
helmChartVersion
+
'''.tgz'''
,
returnStdout:
true
result
=
sh
script:
'''curl -u $USERNAME:$PASSWORD
http://nexus.dev-tools:8081/service/rest/v1/components?repository=ozg-base-apps-snapshot
-F file=@goofy-'''
+
helmChartVersion
+
'''.tgz'''
,
returnStdout:
true
}
if
(
result
!=
''
)
{
...
...
@@ -345,13 +341,17 @@ Void deployHelmChart(String helmChartVersion) {
}
}
Void
setHelmChartVersion
(
String
helmChartVersion
)
{
def
helmChartPath
=
'goofy-server/src/main/helm/Chart.yaml'
def
chart
=
readYaml
file:
helmChartPath
String
generateHelmChartVersion
()
{
def
chartVersion
=
"${VERSION}"
chart
.
version
=
helmChartVersion
if
(
env
.
BRANCH_NAME
==
'master'
)
{
chartVersion
+=
"-${env.GIT_COMMIT.take(7)}"
}
else
if
(
env
.
BRANCH_NAME
!=
'release'
)
{
chartVersion
+=
"-${env.BRANCH_NAME}"
}
writeYaml
file:
helmChartPath
,
data:
chart
,
overwrite:
true
return
chartVersion
}
Void
tagAndPushDockerImage
(
String
newTag
){
...
...
@@ -375,8 +375,8 @@ String generateImageTag() {
return
imageTag
}
Void
startEnvironment
(
String
bezeichner
,
String
stage
,
String
imageTag
,
Boolean
isEa
)
{
setupAnsible
(
imageTag
,
stage
,
isEa
)
Void
startEnvironment
(
String
bezeichner
,
String
stage
,
String
imageTag
,
Boolean
isEa
,
String
chartVersion
)
{
setupAnsible
(
imageTag
,
stage
,
isEa
,
chartVersion
)
try
{
deleteKopStack
(
bezeichner
,
stage
)
...
...
@@ -389,14 +389,14 @@ Void startEnvironment(String bezeichner, String stage, String imageTag, Boolean
addKeycloakUser
(
bezeichner
,
stage
)
}
Void
setupAnsible
(
String
imageTag
,
String
stage
,
Boolean
isEa
)
{
Void
setupAnsible
(
String
imageTag
,
String
stage
,
Boolean
isEa
,
String
chartVersion
)
{
checkoutProvisioningRepo
(
stage
)
if
(
env
.
BRANCH_NAME
==
'release'
)
{
copyTestEnvironmentToDev
(
stage
)
}
editEnvironemntVersion
(
stage
,
imageTag
,
isEa
)
editEnvironemntVersion
(
stage
,
imageTag
,
isEa
,
chartVersion
)
if
(
isEa
)
{
setupEaEnvironment
(
stage
)
...
...
@@ -448,7 +448,7 @@ Void copyTestEnvironmentToDev(stage) {
}
}
Void
editEnvironemntVersion
(
String
stage
,
String
imageTag
,
Boolean
isEa
)
{
Void
editEnvironemntVersion
(
String
stage
,
String
imageTag
,
Boolean
isEa
,
String
chartVersion
)
{
dir
(
"${stage}/provisioning"
)
{
def
editFile
=
"inventories/group_vars/dev/versions"
...
...
@@ -464,7 +464,7 @@ Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) {
devVersions
.
values
.
pluto
.
put
(
'env'
,
[
'overrideSpringProfiles'
:
overrideSpringProfiles
])
devVersions
.
versions
.
goofy
.
image
.
tag
=
imageTag
devVersions
.
charts
.
goofy
.
version
=
imageTag
devVersions
.
charts
.
goofy
.
version
=
chartVersion
writeYaml
file:
editFile
,
data:
devVersions
,
overwrite:
true
}
...
...
@@ -792,7 +792,7 @@ Void setNewGoofyProvisioningVersion(String environment) {
def
envVersions
=
readYaml
file:
envFile
envVersions
.
versions
.
goofy
.
image
.
tag
=
IMAGE_TAG
devVersions
.
charts
.
goofy
.
version
=
imageTag
devVersions
.
charts
.
goofy
.
version
=
HELM_CHART_VERSION
writeYaml
file:
envFile
,
data:
envVersions
,
overwrite:
true
}
...
...
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