diff --git a/pipelines/Release-activity/tavro.groovy b/pipelines/Release-activity/tavro.groovy index ea8e364..7e212aa 100644 --- a/pipelines/Release-activity/tavro.groovy +++ b/pipelines/Release-activity/tavro.groovy @@ -17,8 +17,7 @@ properties([ buildDiscarder(logRotator(artifactNumToKeepStr: '10', numToKeepStr: '10')), disableConcurrentBuilds(), - parameters( - [ + parameters([ choice( name: 'BRANCH_TYPE', choices: ['Release', 'RC', 'Smoke'], @@ -42,11 +41,9 @@ branches.add(branch.name) } return branches.sort() """]], - ], - string(name: 'VERSION', defaultValue: '', description: 'Release version eg. (1.4 for release and 1.4.1 for another branches)'), -] - - ) + ], + string(name: 'VERSION', defaultValue: '', description: 'Release version eg. (1.4 for release and 1.4.1 for another branches)'), + ]) ]) // Check if job triggered by parent job @@ -76,30 +73,39 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"), memory: 64Mi """ ) { - node(POD_LABEL) { - stage('Create branch') { - currentBuild.description = "Build from ${params.SOURCE_BRANCH_NAME}" + node(POD_LABEL) { + 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}") - branch = params.BRANCH_TYPE.toLowerCase() + params.VERSION + Gitea tavroRepo = new Gitea(this, apiRepoURL, "${env.JENKINS_GIT_CREDENTIALS_HTTP}") + branch = params.BRANCH_TYPE.toLowerCase() + params.VERSION + println "Branch name: ${branch}" - if (!params.VERSION.matches(versionPattern) || \ + if (!params.VERSION.matches(versionPattern) || \ (params.BRANCH_TYPE == 'Release' && params.VERSION.matches(/^\d+\.\d+\.\d+.*/))) { - println('You must specify correct version, see description!') - error() - } + println('You must specify correct version, see description!') + error() + } + + Boolean result = tavroRepo.createBranch(params.SOURCE_BRANCH_NAME, branch) - Boolean result = tavroRepo.createBranch(params.SOURCE_BRANCH_NAME, branch) + 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}") - if (!result) { - println("Branch doesn't create, maybe ${branch} already exists") - error() - } - } + sharedLibRepo.createTag('master', releaseBranch) + } + } + } - stage('Run build') { - sleep(5) - build(job: "TAVRO Team/TAVRO/${branch}") - } - } + stage('Run build') { + sleep(5) + build(job: "TAVRO Team/TAVRO/${branch}") + } + } }