Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
user-manager
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
user-manager
Commits
e060d60d
Commit
e060d60d
authored
2 years ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
OZG-3293 argocd rollout
parent
850e9c96
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Jenkinsfile
+43
-12
43 additions, 12 deletions
Jenkinsfile
with
43 additions
and
12 deletions
Jenkinsfile
+
43
−
12
View file @
e060d60d
...
@@ -10,6 +10,7 @@ pipeline {
...
@@ -10,6 +10,7 @@ pipeline {
RELEASE_REGEX
=
/\d+.\d+.\d+/
RELEASE_REGEX
=
/\d+.\d+.\d+/
SNAPSHOT_REGEX
=
/\d+.\d+.\d+-SNAPSHOT/
SNAPSHOT_REGEX
=
/\d+.\d+.\d+-SNAPSHOT/
FAILED_STAGE
=
""
FAILED_STAGE
=
""
SH_SUCCESS_STATUS_CODE
=
0
//The container runtime (e.g. docker) that is used to do an image based build. If this is set then a container build is always done.
//The container runtime (e.g. docker) that is used to do an image based build. If this is set then a container build is always done.
QUARKUS_NATIVE_CONTAINER_RUNTIME
=
"docker"
QUARKUS_NATIVE_CONTAINER_RUNTIME
=
"docker"
...
@@ -156,16 +157,16 @@ pipeline {
...
@@ -156,16 +157,16 @@ pipeline {
script
{
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
FAILED_STAGE
=
env
.
STAGE_NAME
c
heckout
GitopsRepo
()
c
lone
GitopsRepo
()
setNew
Gitops
Version
(
'dev'
)
setNew
DevUserManager
Version
()
push
New
Gitops
Version
(
'dev'
)
push
Dev
Gitops
Repo
(
)
}
}
}
}
}
}
stage
(
'Trigger Test
| Stage
rollout'
)
{
stage
(
'Trigger Test rollout'
)
{
when
{
when
{
branch
'release'
branch
'release'
}
}
...
@@ -174,11 +175,11 @@ pipeline {
...
@@ -174,11 +175,11 @@ pipeline {
script
{
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
FAILED_STAGE
=
env
.
STAGE_NAME
c
heckout
GitopsRepo
()
c
lone
GitopsRepo
()
setNew
Gitops
Version
(
'test'
)
setNew
TestUserManager
Version
()
push
New
Gitops
Version
(
'test'
)
push
Test
Gitops
Repo
(
)
}
}
}
}
}
}
...
@@ -246,6 +247,14 @@ String getElementAccessToken() {
...
@@ -246,6 +247,14 @@ String getElementAccessToken() {
}
}
}
}
Void
setNewDevUserManagerVersion
()
{
setNewGitopsVersion
(
'dev'
)
}
Void
setNewTestUserManagerVersion
()
{
setNewGitopsVersion
(
'test'
)
}
Void
setNewGitopsVersion
(
String
environment
)
{
Void
setNewGitopsVersion
(
String
environment
)
{
dir
(
"gitops"
)
{
dir
(
"gitops"
)
{
def
envFile
=
"${environment}/application/values/user-manager-values.yaml"
def
envFile
=
"${environment}/application/values/user-manager-values.yaml"
...
@@ -259,29 +268,51 @@ Void setNewGitopsVersion(String environment) {
...
@@ -259,29 +268,51 @@ Void setNewGitopsVersion(String environment) {
}
}
}
}
Void
checkoutGitopsRepo
()
{
Void
configGit
()
{
final
email
=
"jenkins@ozg-sh.de"
final
name
=
"jenkins"
dir
(
"gitops"
)
{
sh
"git config user.email '${email}'"
sh
"git config user.name '${name}'"
}
}
Void
cloneGitopsRepo
()
{
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-gitea-access-token'
,
passwordVariable:
'TOKEN'
,
usernameVariable:
'USER'
)])
{
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-gitea-access-token'
,
passwordVariable:
'TOKEN'
,
usernameVariable:
'USER'
)])
{
sh
'git clone https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/gitops.git'
sh
'git clone https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/gitops.git'
}
}
configGit
()
}
Void
pushDevGitopsRepo
(){
pushNewGitopsVersion
(
'dev'
)
}
Void
pushTestGitopsRepo
(){
pushNewGitopsVersion
(
'test'
)
}
}
Void
pushNewGitopsVersion
(
String
environment
)
{
Void
pushNewGitopsVersion
(
String
environment
)
{
dir
(
'gitops'
)
{
dir
(
'gitops'
)
{
if
(
sh
(
script:
"git status | grep '${environment}/application/values/user-m
an
a
ge
r-values.yaml'"
,
returnStatus:
true
)
==
1
)
{
if
(
!
hasUserManagerValuesFileCh
ange
d
(
environment
)
)
{
return
return
}
}
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-gitea-access-token'
,
passwordVariable:
'TOKEN'
,
usernameVariable:
'USER'
)])
{
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-gitea-access-token'
,
passwordVariable:
'TOKEN'
,
usernameVariable:
'USER'
)])
{
sh
"git add ${environment}/application/values/user-manager-values.yaml"
sh
"git add ${environment}/application/values/user-manager-values.yaml"
sh
'git config user.email "jenkins@ozg-sh.de"'
sh
'git config user.name "jenkins"'
sh
"git commit -m 'jenkins rollout ${environment} user-manager version ${IMAGE_TAG}'"
sh
"git commit -m 'jenkins rollout ${environment} user-manager version ${IMAGE_TAG}'"
sh
'git push https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/gitops.git'
sh
'git push https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/gitops.git'
}
}
}
}
}
}
Boolean
hasUserManagerValuesFileChanged
(
String
environment
)
{
return
sh
(
script:
"git status | grep '${environment}/application/values/user-manager-values.yaml'"
,
returnStatus:
true
)
==
env
.
SH_SUCCESS_STATUS_CODE
as
Integer
}
String
getPomVersion
(
String
pomFile
){
String
getPomVersion
(
String
pomFile
){
def
pom
=
readMavenPom
file:
pomFile
def
pom
=
readMavenPom
file:
pomFile
...
...
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