[DO-502] add_vault_restore_policy (!43)
Co-authored-by: Rustam Tagaev <rustam.tagaev@avroid.tech> Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/43 Reviewed-by: Denis Patrakeev <denis.patrakeev@avroid.team> Co-authored-by: Rustam Tagaev <rustam.tagaev@avroid.team> Co-committed-by: Rustam Tagaev <rustam.tagaev@avroid.team>
This commit is contained in:
committed by
Denis Patrakeev
parent
2eac82a73c
commit
a8d13a4475
@@ -24,7 +24,7 @@ Map projects = [
|
||||
],
|
||||
'DevOps/ansible': [
|
||||
[
|
||||
'branches': [],
|
||||
'branches': ['master'],
|
||||
'jobs': [
|
||||
[job: 'Automation/DevOps/vault-policies-and-roles-update']
|
||||
]
|
||||
@@ -32,27 +32,23 @@ Map projects = [
|
||||
]
|
||||
]
|
||||
|
||||
podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
|
||||
yaml: """
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
spec:
|
||||
containers:
|
||||
- name: linux
|
||||
image: ${env.JENKINS_DOCKER_REGISTRY}/docker-hub-proxy/library/alpine:3.18.5
|
||||
command:
|
||||
- sleep
|
||||
args:
|
||||
- 99d
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 64Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 64Mi
|
||||
"""
|
||||
) {
|
||||
String getBranch(Map fullJSON) {
|
||||
String branch = ''
|
||||
String refHead = 'refs/heads/'
|
||||
String refTags = 'refs/tags/'
|
||||
|
||||
if (fullJSON.ref != null && fullJSON.ref.contains(refHead)) {
|
||||
branch = fullJSON.ref.split(refHead).last()
|
||||
} else if (fullJSON.ref != null && fullJSON.ref.contains(refTags)) {
|
||||
branch = fullJSON.ref.split(refTags).last()
|
||||
} else if (fullJSON.ref != null) {
|
||||
branch = fullJSON.ref
|
||||
}
|
||||
|
||||
return branch
|
||||
}
|
||||
|
||||
podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"), yaml: getPodTemplate('alpine')) {
|
||||
node(POD_LABEL) {
|
||||
stage('Run job') {
|
||||
try {
|
||||
@@ -60,24 +56,17 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
|
||||
String projectName = fullJSON.repository.full_name
|
||||
currentBuild.description = "Repo: ${fullJSON.repository.full_name}"
|
||||
currentBuild.displayName = "#${env.BUILD_ID} Skip"
|
||||
|
||||
//info for Debug
|
||||
//println(fullJSON)
|
||||
if (fullJSON.ref) {
|
||||
String branch = ''
|
||||
currentBuild.description = "Repo: ${fullJSON.repository.full_name} $branch"
|
||||
String refHead = 'refs/heads/'
|
||||
String refTags = 'refs/tags/'
|
||||
if (projects[projectName]) {
|
||||
String branch = getBranch(fullJSON)
|
||||
|
||||
if (fullJSON.ref.contains(refHead)) {
|
||||
branch = fullJSON.ref.split(refHead).last()
|
||||
} else {
|
||||
branch = fullJSON.ref.split(refTags).last()
|
||||
}
|
||||
currentBuild.description = "Repo: ${fullJSON.repository.full_name} $branch"
|
||||
|
||||
// Check project in map and start to work with it
|
||||
projects[projectName].each { Map project ->
|
||||
currentBuild.displayName = "#${env.BUILD_ID} Run for branches"
|
||||
currentBuild.displayName = "#${env.BUILD_ID} Run for all branches"
|
||||
|
||||
project.jobs.each { Map job ->
|
||||
build job: job.job,
|
||||
parameters: [
|
||||
|
||||
Reference in New Issue
Block a user