bugfix: add cleanws in pipelines (!20)

Reviewed-on: https://git.avroid.tech/DevOps/jenkins-pipelines/pulls/20
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 17:56:26 +03:00
committed by Aleksandr Vodyanov
parent 7c906923e4
commit 8098ef59be
5 changed files with 162 additions and 128 deletions

View File

@@ -38,6 +38,7 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
''' '''
) { ) {
node(POD_LABEL) { node(POD_LABEL) {
try {
stage('Synchronize NextCloud with Nexus') { stage('Synchronize NextCloud with Nexus') {
container(name: 'linux') { container(name: 'linux') {
NextCloud nextCloud = new NextCloud(this, env.JENKINS_OMP_NEXTCLOUD_URL, env.JENKINS_OMP_NEXTCLOUD_CREDENTIALS) NextCloud nextCloud = new NextCloud(this, env.JENKINS_OMP_NEXTCLOUD_URL, env.JENKINS_OMP_NEXTCLOUD_CREDENTIALS)
@@ -102,4 +103,11 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
} }
} }
} }
catch(err) {
echo 'ERROR: ' + err.getMessage()
currentBuild.result = 'FAILURE'
} finally {
cleanWs()
}
}
} }

View File

@@ -74,6 +74,7 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
""" """
) { ) {
node(POD_LABEL) { node(POD_LABEL) {
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+.*/
@@ -108,4 +109,11 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
build(job: "TAVRO Team/TAVRO/${branch}") build(job: "TAVRO Team/TAVRO/${branch}")
} }
} }
catch(err) {
echo 'ERROR: ' + err.getMessage()
currentBuild.result = 'FAILURE'
} finally {
cleanWs()
}
}
} }

View File

@@ -32,6 +32,7 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
""" """
) { ) {
node(POD_LABEL) { node(POD_LABEL) {
try {
stage('Add PR link to Eva task') { stage('Add PR link to Eva task') {
Map dataJSON = readJSON text: params.DATA_JSON Map dataJSON = readJSON text: params.DATA_JSON
String prLink = dataJSON.pull_request.url String prLink = dataJSON.pull_request.url
@@ -57,4 +58,11 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
} }
} }
} }
catch(err) {
echo 'ERROR: ' + err.getMessage()
currentBuild.result = 'FAILURE'
} finally {
cleanWs()
}
}
} }

View File

@@ -89,6 +89,8 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
} }
} catch (groovy.lang.MissingPropertyException e) { } catch (groovy.lang.MissingPropertyException e) {
println 'This job should run through gitea webhook:\n' + e println 'This job should run through gitea webhook:\n' + e
} finally {
cleanWs()
} }
} }
} }

View File

@@ -32,6 +32,7 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
''' '''
) { ) {
node(POD_LABEL) { node(POD_LABEL) {
try {
stage('Get repository') { stage('Get repository') {
def git = new Git(this, "$env.JENKINS_GIT_CREDENTIALS_SSH") def git = new Git(this, "$env.JENKINS_GIT_CREDENTIALS_SSH")
@@ -57,4 +58,11 @@ podTemplate(workspaceVolume: hostPathWorkspaceVolume(hostPath: "/data"),
} }
} }
} }
catch(err) {
echo 'ERROR: ' + err.getMessage()
currentBuild.result = 'FAILURE'
} finally {
cleanWs()
}
}
} }