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
@@ -3,7 +3,7 @@
|
||||
import tech.avroid.api.Gitea
|
||||
|
||||
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']
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ properties([
|
||||
script: [$class: 'GroovyScript',
|
||||
script: [sandbox: false, script: """import groovy.json.JsonSlurperClassic
|
||||
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.waitForOrKill(5000)
|
||||
JSONInfo = new JsonSlurperClassic().parseText(sout.toString())
|
||||
@@ -55,30 +55,13 @@ if (isContainsParentJob) {
|
||||
return
|
||||
}
|
||||
|
||||
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
|
||||
tty: true
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 64Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 64Mi
|
||||
"""
|
||||
) {
|
||||
podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"), yaml: getPodTemplate('alpine')) {
|
||||
node(POD_LABEL) {
|
||||
try {
|
||||
stage('Create branch') {
|
||||
currentBuild.description = "Build from ${params.SOURCE_BRANCH_NAME}"
|
||||
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
|
||||
println "Branch name: ${branch}"
|
||||
|
||||
@@ -93,14 +76,16 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
|
||||
if (!result) {
|
||||
println("Branch doesn't create, maybe ${branch} already exists")
|
||||
error()
|
||||
} else if (params.BRANCH_TYPE == 'Release') {
|
||||
stage('Create SharedLib tag') {
|
||||
Gitea sharedLibRepo = new Gitea(this,
|
||||
"${apiRepoURL}/DevOps/jenkins-shared-lib",
|
||||
"${env.JENKINS_GIT_CREDENTIALS_HTTP}")
|
||||
}
|
||||
}
|
||||
|
||||
sharedLibRepo.createTag('master', releaseBranch)
|
||||
}
|
||||
if (params.BRANCH_TYPE == 'Release') {
|
||||
stage('Create SharedLib tag') {
|
||||
Gitea sharedLibRepo = new Gitea(this,
|
||||
"${apiRepoURL}/DevOps/jenkins-shared-lib",
|
||||
"${env.JENKINS_GIT_CREDENTIALS_HTTP}")
|
||||
|
||||
sharedLibRepo.createTag('master', branch)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user