Jenkinsfile-GitLab-Container: declare pipeline variables
Did you forget the `def` keyword? WorkflowScript seems to be setting a field named JOB_TIMESTAMP (to a value of type String) which could lead to memory leaks or other issues. Did you forget the `def` keyword? WorkflowScript seems to be setting a field named MR_NUMBER (to a value of type String) which could lead to memory leaks or other issues.
This commit is contained in:
@@ -34,9 +34,7 @@ pipeline {
|
|||||||
stage ("Verify Parameters") {
|
stage ("Verify Parameters") {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"'
|
env.JOB_TIMESTAMP = sh(returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"').trim()
|
||||||
JOB_TIMESTAMP = JOB_TIMESTAMP.trim()
|
|
||||||
|
|
||||||
echo '\u2705 \u001B[32mVerify Parameters\u001B[0m'
|
echo '\u2705 \u001B[32mVerify Parameters\u001B[0m'
|
||||||
def allParametersPresent = true
|
def allParametersPresent = true
|
||||||
|
|
||||||
@@ -872,11 +870,7 @@ pipeline {
|
|||||||
// ---- Slave Job functions
|
// ---- Slave Job functions
|
||||||
|
|
||||||
def triggerSlaveJob (jobName, gitlabStatusName) {
|
def triggerSlaveJob (jobName, gitlabStatusName) {
|
||||||
if ("MERGE".equals(env.gitlabActionType)) {
|
def MR_NUMBER = "MERGE".equals(env.gitlabActionType) ? env.gitlabMergeRequestIid : 'develop'
|
||||||
MR_NUMBER = env.gitlabMergeRequestIid
|
|
||||||
} else {
|
|
||||||
MR_NUMBER = 'develop'
|
|
||||||
}
|
|
||||||
// Workaround for the "cancelled" GitLab pipeline notification
|
// Workaround for the "cancelled" GitLab pipeline notification
|
||||||
// The slave job is triggered with the propagate false so the following commands are executed
|
// The slave job is triggered with the propagate false so the following commands are executed
|
||||||
// Its status is now PASS/SUCCESS from a stage pipeline point of view
|
// Its status is now PASS/SUCCESS from a stage pipeline point of view
|
||||||
@@ -947,7 +941,7 @@ def finalizeSlaveJob(jobName) {
|
|||||||
filter: 'test_results*.html',
|
filter: 'test_results*.html',
|
||||||
selector: lastCompleted())
|
selector: lastCompleted())
|
||||||
if (fileExists(fileName)) {
|
if (fileExists(fileName)) {
|
||||||
sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' ${fileName}"
|
sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${env.JOB_TIMESTAMP}#' ${fileName}"
|
||||||
} else {
|
} else {
|
||||||
sh "echo \"could not copy results from ${jobName}, please check pipeline ${BUILD_URL}\" > ${fileName}"
|
sh "echo \"could not copy results from ${jobName}, please check pipeline ${BUILD_URL}\" > ${fileName}"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user