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
f6b75c25
Commit
f6b75c25
authored
2 years ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
OZG-3293 gitops rollout
parent
58ab50d6
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
+19
-26
19 additions, 26 deletions
Jenkinsfile
with
19 additions
and
26 deletions
Jenkinsfile
+
19
−
26
View file @
f6b75c25
...
@@ -156,11 +156,11 @@ pipeline {
...
@@ -156,11 +156,11 @@ pipeline {
script
{
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
FAILED_STAGE
=
env
.
STAGE_NAME
checkout
Provisioning
Repo
()
checkout
Gitops
Repo
()
setNew
Provisioning
Version
(
'dev'
)
setNew
Gitops
Version
(
'dev'
)
pushNew
Provisioning
Version
(
'dev'
)
pushNew
Gitops
Version
(
'dev'
)
}
}
}
}
}
}
...
@@ -174,12 +174,11 @@ pipeline {
...
@@ -174,12 +174,11 @@ pipeline {
script
{
script
{
FAILED_STAGE
=
env
.
STAGE_NAME
FAILED_STAGE
=
env
.
STAGE_NAME
checkout
Provisioning
Repo
()
checkout
Gitops
Repo
()
setNewProvisioningVersion
(
'test'
)
setNewGitopsVersion
(
'test'
)
setNewProvisioningVersion
(
'stage'
)
pushNew
Provisioning
Version
(
'test
stage
'
)
pushNew
Gitops
Version
(
'test'
)
}
}
}
}
}
}
...
@@ -247,44 +246,38 @@ String getElementAccessToken() {
...
@@ -247,44 +246,38 @@ String getElementAccessToken() {
}
}
}
}
Void
setNew
Provisioning
Version
(
String
environment
)
{
Void
setNew
Gitops
Version
(
String
environment
)
{
dir
(
"
provisioning
"
)
{
dir
(
"
gitops
"
)
{
def
envFile
=
"
inventories/group_vars/${environment}/versions
"
def
envFile
=
"
${environment}/application/values/user-manager-values.yaml
"
def
envVersions
=
readYaml
file:
envFile
def
envVersions
=
readYaml
file:
envFile
envVersions
.
versions
.
user_manager
.
image
.
tag
=
IMAGE_TAG
envVersions
.
user_manager
.
image
.
tag
=
IMAGE_TAG
envVersions
.
charts
.
user_manager
.
version
=
HELM_CHART_VERSION
envVersions
.
user_manager
.
helm
.
version
=
HELM_CHART_VERSION
writeYaml
file:
envFile
,
data:
envVersions
,
overwrite:
true
writeYaml
file:
envFile
,
data:
envVersions
,
overwrite:
true
}
}
}
}
Void
checkout
Provisioning
Repo
()
{
Void
checkout
Gitops
Repo
()
{
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/provisioning.git'
sh
'git clone https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/gitops.git'
if
(
env
.
BRANCH_NAME
==
'release'
)
{
dir
(
'provisioning'
)
{
sh
'git checkout release'
}
}
}
}
}
}
Void
pushNew
Provisioning
Version
(
String
environment
)
{
Void
pushNew
Gitops
Version
(
String
environment
)
{
dir
(
'
provisioning
'
)
{
dir
(
'
gitops
'
)
{
if
(
sh
(
script:
"git status | grep '
inventories/group_vars/.*/versions
'"
,
returnStatus:
true
)
==
1
)
{
if
(
sh
(
script:
"git status | grep '
${environment}/application/values/user-manager-values.yaml
'"
,
returnStatus:
true
)
==
1
)
{
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
inventories/group_vars/*/versions'
sh
"
git add
${environment}/application/values/user-manager-values.yaml"
sh
'git config user.email "jenkins@ozg.de"'
sh
'git config user.email "jenkins@ozg
-sh
.de"'
sh
'git config user.name "jenkins"'
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/
provisioning
.git'
sh
'git push https://${USER}:${TOKEN}@git.ozg-sh.de/mgm/
gitops
.git'
}
}
}
}
}
}
...
...
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