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
20751746
Commit
20751746
authored
2 years ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
ozg-3075 test build and deploy helm chart
parent
752c3107
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
+47
-0
47 additions, 0 deletions
Jenkinsfile
with
47 additions
and
0 deletions
Jenkinsfile
+
47
−
0
View file @
20751746
...
@@ -183,6 +183,24 @@ pipeline {
...
@@ -183,6 +183,24 @@ pipeline {
}
}
}
}
}
}
stage
(
'Test, build and deploy Helm Chart'
)
{
steps
{
container
(
'k8s'
)
{
FAILED_GOOFY_STAGE
=
env
.
STAGE_NAME
def
helmChartVersion
=
generateImageTag
()
setHelmChartVersion
(
helmChartVersion
)
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"
deployHelmChart
(
helmChartVersion
)
}
}
}
stage
(
'Trigger Dev rollout'
)
{
stage
(
'Trigger Dev rollout'
)
{
when
{
when
{
branch
'master'
branch
'master'
...
@@ -297,6 +315,33 @@ pipeline {
...
@@ -297,6 +315,33 @@ 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
}
else
{
result
=
sh
script:
'''curl -u $USERNAME:$PASSWORD $NEXUS_SNAPSHOT_URL -F file=@goofy-'''
+
helmChartVersion
+
'''.tgz'''
,
returnStdout:
true
}
if
(
result
!=
''
)
{
error
(
result
)
}
}
}
Void
setHelmChartVersion
(
String
helmChartVersion
)
{
def
helmChartPath
=
'goofy-server/src/main/helm/Chart.yaml'
def
chart
=
readYaml
file:
helmChartPath
chart
.
version
=
helmChartVersion
writeYaml
file:
helmChartPath
,
data:
chart
,
overwrite:
true
}
Void
tagAndPushDockerImage
(
String
newTag
){
Void
tagAndPushDockerImage
(
String
newTag
){
container
(
"docker"
)
{
container
(
"docker"
)
{
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-docker-login'
,
usernameVariable:
'USER'
,
passwordVariable:
'PASSWORD'
)])
{
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-docker-login'
,
usernameVariable:
'USER'
,
passwordVariable:
'PASSWORD'
)])
{
...
@@ -407,6 +452,7 @@ Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) {
...
@@ -407,6 +452,7 @@ Void editEnvironemntVersion(String stage, String imageTag, Boolean isEa) {
devVersions
.
values
.
pluto
.
put
(
'env'
,
[
'overrideSpringProfiles'
:
overrideSpringProfiles
])
devVersions
.
values
.
pluto
.
put
(
'env'
,
[
'overrideSpringProfiles'
:
overrideSpringProfiles
])
devVersions
.
versions
.
goofy
.
image
.
tag
=
imageTag
devVersions
.
versions
.
goofy
.
image
.
tag
=
imageTag
devVersions
.
charts
.
goofy
.
version
=
imageTag
writeYaml
file:
editFile
,
data:
devVersions
,
overwrite:
true
writeYaml
file:
editFile
,
data:
devVersions
,
overwrite:
true
}
}
...
@@ -734,6 +780,7 @@ Void setNewGoofyProvisioningVersion(String environment) {
...
@@ -734,6 +780,7 @@ Void setNewGoofyProvisioningVersion(String environment) {
def
envVersions
=
readYaml
file:
envFile
def
envVersions
=
readYaml
file:
envFile
envVersions
.
versions
.
goofy
.
image
.
tag
=
IMAGE_TAG
envVersions
.
versions
.
goofy
.
image
.
tag
=
IMAGE_TAG
devVersions
.
charts
.
goofy
.
version
=
imageTag
writeYaml
file:
envFile
,
data:
envVersions
,
overwrite:
true
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