jenkins-pipelines/pipelines/parts/publish-logs.Jenkinsfile
suyash 928e9a9a77 Added BUILD_RT Parameter in publish-log.pipeline
To publish realtime log to mirror.starlingx.windriver.com.
BUILD_RT information is required, so adding this parameter.

Test-Plan:
PASS - Run jenkins job to verify publish-log part.
PASS - Check if package log file exists.

Closes-bug: 2071355
Change-Id: Ibb185df1b4c6ad7f5f488062f4f489744a03a6b8
Signed-off-by: suyash <suyash.srivastava@windriver.com>
2024-07-05 17:47:34 +05:30

77 lines
2.2 KiB
Plaintext

// vim: syn=groovy
//
// Copyright (c) 2022 Wind River Systems, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
library "common@${params.JENKINS_SCRIPTS_BRANCH}"
setBuildDescr()
pipeline {
agent any
options {
timestamps()
}
parameters {
string (
name: 'MASTER_JOB_NAME'
)
string (
name: 'MASTER_BUILD_NUMBER'
)
string (
name: 'JENKINS_SCRIPTS_BRANCH'
)
string (
name: 'BUILD_HOME'
)
string (
name: 'TIMESTAMP'
)
string (
name: 'PUBLISH_TIMESTAMP'
)
booleanParam (
name: 'DRY_RUN'
)
booleanParam (
name: 'BUILD_RT'
)
booleanParam (
name: 'SHELL_XTRACE'
)
}
stages {
stage ("archive-jenkins-logs") {
steps { script {
if (params.BUILD_HOME) {
final String build_conf = "${params.BUILD_HOME}/build.conf"
final String jenkins_api_credentials_id = sh (returnStdout: true,
script: """#!/bin/bash
set -e
if [[ -f "${build_conf}" ]] ; then
source "${build_conf}"
echo -n "\${JENKINS_API_CREDENTIALS_ID}"
fi
"""
);
if (!jenkins_api_credentials_id) {
error ("JENKINS_API_CREDENTIALS_ID is not defined in ${build_conf}")
}
withEnv (["BUILD_HOME=${params.BUILD_HOME}"]) {
withCredentials ([usernameColonPassword (
credentialsId: jenkins_api_credentials_id,
variable: 'JENKINS_API_USERPASS')]) {
sh "${Constants.SCRIPTS_DIR}/publish-logs.sh"
}
}
sh "${Constants.SCRIPTS_DIR}/publish-stx-logs.sh"
}
} }
}
}
}