hotfix/relese_sh_libs_tags_fixed (!22)
Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/22 Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Co-committed-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
This commit is contained in:
committed by
Aleksandr Vodyanov
parent
8098ef59be
commit
0a77ef6605
@@ -58,7 +58,7 @@ return branches.sort()
|
|||||||
url("${JENKINS_GIT_REPOSITORY_URL}/DevOps/jenkins-pipelines.git")
|
url("${JENKINS_GIT_REPOSITORY_URL}/DevOps/jenkins-pipelines.git")
|
||||||
credentials("${JENKINS_GIT_CREDENTIALS_HTTP}")
|
credentials("${JENKINS_GIT_CREDENTIALS_HTTP}")
|
||||||
}
|
}
|
||||||
branch('DO-290--reafactoring_release_activities')
|
branch('master')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scriptPath('pipelines/Release-activity/tavro.groovy')
|
scriptPath('pipelines/Release-activity/tavro.groovy')
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import tech.avroid.api.Gitea
|
import tech.avroid.api.Gitea
|
||||||
|
|
||||||
String branch
|
String branch
|
||||||
String apiRepoURL = "${env.JENKINS_GIT_REPOSITORY_URL}/api/v1/repos/TAVRO/TAVRO"
|
String apiRepoURL = "${env.JENKINS_GIT_REPOSITORY_URL}/api/v1/repos"
|
||||||
List parentJobs = ['jobs-dsl']
|
List parentJobs = ['jobs-dsl']
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ properties([
|
|||||||
script: [$class: 'GroovyScript',
|
script: [$class: 'GroovyScript',
|
||||||
script: [sandbox: false, script: """import groovy.json.JsonSlurperClassic
|
script: [sandbox: false, script: """import groovy.json.JsonSlurperClassic
|
||||||
def sout = new StringBuffer(), serr = new StringBuffer()
|
def sout = new StringBuffer(), serr = new StringBuffer()
|
||||||
def proc = 'curl --connect-timeout 15 -u ${gitLogin}:${gitPass} ${apiRepoURL}/branches'.execute()
|
def proc = 'curl --connect-timeout 15 -u ${gitLogin}:${gitPass} ${apiRepoURL}/TAVRO/TAVRO/branches'.execute()
|
||||||
proc.consumeProcessOutput(sout, serr)
|
proc.consumeProcessOutput(sout, serr)
|
||||||
proc.waitForOrKill(5000)
|
proc.waitForOrKill(5000)
|
||||||
JSONInfo = new JsonSlurperClassic().parseText(sout.toString())
|
JSONInfo = new JsonSlurperClassic().parseText(sout.toString())
|
||||||
@@ -55,30 +55,13 @@ if (isContainsParentJob) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
|
podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"), yaml: getPodTemplate('alpine')) {
|
||||||
yaml: """
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Pod
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: linux
|
|
||||||
image: ${env.JENKINS_DOCKER_REGISTRY}/docker-hub-proxy/library/alpine:3.18.5
|
|
||||||
tty: true
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 64Mi
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 64Mi
|
|
||||||
"""
|
|
||||||
) {
|
|
||||||
node(POD_LABEL) {
|
node(POD_LABEL) {
|
||||||
try {
|
try {
|
||||||
stage('Create branch') {
|
stage('Create branch') {
|
||||||
currentBuild.description = "Build from ${params.SOURCE_BRANCH_NAME}"
|
currentBuild.description = "Build from ${params.SOURCE_BRANCH_NAME}"
|
||||||
String versionPattern = (params.BRANCH_TYPE == 'Release') ? /^\d+\.\d+.*/ : /^\d+\.\d+\.\d+.*/
|
String versionPattern = (params.BRANCH_TYPE == 'Release') ? /^\d+\.\d+.*/ : /^\d+\.\d+\.\d+.*/
|
||||||
Gitea tavroRepo = new Gitea(this, apiRepoURL, "${env.JENKINS_GIT_CREDENTIALS_HTTP}")
|
Gitea tavroRepo = new Gitea(this, "${apiRepoURL}/TAVRO/TAVRO", "${env.JENKINS_GIT_CREDENTIALS_HTTP}")
|
||||||
branch = params.BRANCH_TYPE.toLowerCase() + params.VERSION
|
branch = params.BRANCH_TYPE.toLowerCase() + params.VERSION
|
||||||
println "Branch name: ${branch}"
|
println "Branch name: ${branch}"
|
||||||
|
|
||||||
@@ -93,14 +76,16 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
|
|||||||
if (!result) {
|
if (!result) {
|
||||||
println("Branch doesn't create, maybe ${branch} already exists")
|
println("Branch doesn't create, maybe ${branch} already exists")
|
||||||
error()
|
error()
|
||||||
} else if (params.BRANCH_TYPE == 'Release') {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.BRANCH_TYPE == 'Release') {
|
||||||
stage('Create SharedLib tag') {
|
stage('Create SharedLib tag') {
|
||||||
Gitea sharedLibRepo = new Gitea(this,
|
Gitea sharedLibRepo = new Gitea(this,
|
||||||
"${apiRepoURL}/DevOps/jenkins-shared-lib",
|
"${apiRepoURL}/DevOps/jenkins-shared-lib",
|
||||||
"${env.JENKINS_GIT_CREDENTIALS_HTTP}")
|
"${env.JENKINS_GIT_CREDENTIALS_HTTP}")
|
||||||
|
|
||||||
sharedLibRepo.createTag('master', releaseBranch)
|
sharedLibRepo.createTag('master', branch)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user