Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eingang-manager
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
eingang-manager
Commits
5c2711f0
Commit
5c2711f0
authored
2 years ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
OZG-3293 argocd rollout
parent
8c0c95c3
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
+44
-14
44 additions, 14 deletions
Jenkinsfile
with
44 additions
and
14 deletions
Jenkinsfile
+
44
−
14
View file @
5c2711f0
...
...
@@ -10,6 +10,7 @@ pipeline {
RELEASE_REGEX
=
/\d+.\d+.\d+/
SNAPSHOT_REGEX
=
/\d+.\d+.\d+-SNAPSHOT/
FAILED_STAGE
=
""
SH_SUCCESS_STATUS_CODE
=
0
}
options
{
...
...
@@ -149,12 +150,11 @@ pipeline {
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
c
heckout
GitopsRepo
()
c
lone
GitopsRepo
()
setNewAfmAdapterVersion
(
'dev'
)
setNewFsAdapterVersion
(
'dev'
)
setNewDevAdapterVersion
()
pushNew
Gitops
Version
(
'dev'
)
pushNew
Dev
Version
()
}
}
}
...
...
@@ -167,12 +167,11 @@ pipeline {
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
c
heckout
GitopsRepo
()
c
lone
GitopsRepo
()
setNewAfmAdapterVersion
(
'test'
)
setNewFsAdapterVersion
(
'test'
)
setNewTestAdapterVersion
()
pushNew
Gitops
Version
(
'test'
)
pushNew
Test
Version
()
}
}
}
...
...
@@ -239,6 +238,16 @@ String getElementAccessToken() {
}
}
Void
setNewDevAdapterVersion
()
{
setNewAfmAdapterVersion
(
'dev'
)
setNewFsAdapterVersion
(
'dev'
)
}
Void
setNewTestAdapterVersion
()
{
setNewAfmAdapterVersion
(
'test'
)
setNewFsAdapterVersion
(
'test'
)
}
Void
setNewAfmAdapterVersion
(
String
environment
)
{
dir
(
"gitops"
)
{
def
envFile
=
"${environment}/application/values/afm-adapter-values.yaml"
...
...
@@ -263,28 +272,49 @@ Void setNewFsAdapterVersion(String environment) {
}
}
Void
pushNewDevVersion
()
{
pushNewGitopsVersion
(
'dev'
)
}
Void
pushNewTestVersion
()
{
pushNewGitopsVersion
(
'test'
)
}
Void
pushNewGitopsVersion
(
String
environment
)
{
dir
(
'gitops'
)
{
if
(
sh
(
script:
"git status | grep '${environment}/application/values/.*-a
dapter
-v
alues
.yaml'"
,
returnStatus:
true
)
==
1
)
{
if
(
!
hasA
dapter
V
alues
FileChanged
()
)
{
return
}
withCredentials
([
usernamePassword
(
credentialsId:
'jenkins-gitea-access-token'
,
passwordVariable:
'TOKEN'
,
usernameVariable:
'USER'
)])
{
sh
"git add ${environment}/application/values/fs-adapter-values.yaml"
sh
"git add ${environment}/application/values/afm-adapter-values.yaml"
sh
"git add ${environment}/application/values/*-adapter-values.yaml"
sh
'git config user.email "jenkins@ozg-sh.de"'
sh
'git config user.name "jenkins"'
sh
"git commit -m 'jenkins rollout ${environment} afm-adapter fs-adapter version ${IMAGE_TAG}'"
sh
'git push https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/gitops.git'
}
}
}
Void
checkoutGitopsRepo
()
{
Boolean
hasAdapterValuesFileChanged
(
String
environment
)
{
return
sh
(
script:
"git status | grep '${environment}/application/values/.*-adapter-values.yaml'"
,
returnStatus:
true
)
==
env
.
SH_SUCCESS_STATUS_CODE
as
Integer
}
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'
)])
{
sh
'git clone https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/gitops.git'
}
configGit
()
}
Void
tagAndPushDockerImage
(
String
imageName
,
String
newTag
){
...
...
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