[DO-290] add tag for shared libs (!19)

Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/19
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
Co-committed-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
This commit is contained in:
aleksandr.vodyanov
2024-02-27 15:04:42 +03:00
committed by Aleksandr Vodyanov
parent 358a1e1f51
commit 7c906923e4

View File

@@ -17,8 +17,7 @@ properties([
buildDiscarder(logRotator(artifactNumToKeepStr: '10', buildDiscarder(logRotator(artifactNumToKeepStr: '10',
numToKeepStr: '10')), numToKeepStr: '10')),
disableConcurrentBuilds(), disableConcurrentBuilds(),
parameters( parameters([
[
choice( choice(
name: 'BRANCH_TYPE', name: 'BRANCH_TYPE',
choices: ['Release', 'RC', 'Smoke'], choices: ['Release', 'RC', 'Smoke'],
@@ -44,9 +43,7 @@ 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 // Check if job triggered by parent job
@@ -82,6 +79,7 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
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, "${env.JENKINS_GIT_CREDENTIALS_HTTP}")
branch = params.BRANCH_TYPE.toLowerCase() + params.VERSION 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+.*/))) { (params.BRANCH_TYPE == 'Release' && params.VERSION.matches(/^\d+\.\d+\.\d+.*/))) {
@@ -94,6 +92,14 @@ 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') {
stage('Create SharedLib tag') {
Gitea sharedLibRepo = new Gitea(this,
"${apiRepoURL}/DevOps/jenkins-shared-lib",
"${env.JENKINS_GIT_CREDENTIALS_HTTP}")
sharedLibRepo.createTag('master', releaseBranch)
}
} }
} }