From 0a77ef6605ee6f734c4f6b06139d2386282e1b15 Mon Sep 17 00:00:00 2001 From: "aleksandr.vodyanov" Date: Fri, 29 Mar 2024 16:50:35 +0300 Subject: [PATCH] hotfix/relese_sh_libs_tags_fixed (!22) Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/22 Co-authored-by: aleksandr.vodyanov Co-committed-by: aleksandr.vodyanov --- jobs-dsl/jobs/Release-activity/tavro.groovy | 2 +- pipelines/Release-activity/tavro.groovy | 41 +++++++-------------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/jobs-dsl/jobs/Release-activity/tavro.groovy b/jobs-dsl/jobs/Release-activity/tavro.groovy index dce43f6..574b38c 100644 --- a/jobs-dsl/jobs/Release-activity/tavro.groovy +++ b/jobs-dsl/jobs/Release-activity/tavro.groovy @@ -58,7 +58,7 @@ return branches.sort() url("${JENKINS_GIT_REPOSITORY_URL}/DevOps/jenkins-pipelines.git") credentials("${JENKINS_GIT_CREDENTIALS_HTTP}") } - branch('DO-290--reafactoring_release_activities') + branch('master') } } scriptPath('pipelines/Release-activity/tavro.groovy') diff --git a/pipelines/Release-activity/tavro.groovy b/pipelines/Release-activity/tavro.groovy index 3ad81be..85b1851 100644 --- a/pipelines/Release-activity/tavro.groovy +++ b/pipelines/Release-activity/tavro.groovy @@ -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) } }