Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve jenkins trigger issues due to variable substitution #32

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions jenkins/maps-server-release.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pipeline {
printContributedVariables: false,
printPostContent: false,
regexpFilterText: '$ref',
regexpFilterExpression: '^(maps-server-release)-[0-9]+$'
regexpFilterExpression: '^(maps-server-release)-[0-9.]+'
)
}
environment {
Expand All @@ -57,7 +57,7 @@ pipeline {
def ref_final = "${GIT_REFERENCE}"
def ref_url = "${REPO_URL}/commit/${GIT_REFERENCE}"
if (env.USER_BUILD_CAUSE.equals('[]') && env.TIMER_BUILD_CAUSE.equals('[]')) {
ref_final = ${ref}
ref_final = "${ref}"
ref_url = "${REPO_URL}/releases/tag/${ref}"
println("Triggered by GitHub: ${ref_url}")

Expand All @@ -68,8 +68,14 @@ pipeline {
currentBuild.description = """User/Timer: <a href="${ref_url}">${ref_url}</a>"""
}

if (ref_final == null || ref_final == '') {
currentBuild.result = 'ABORTED'
error("Missing git reference.")
}

echo("Git checkout ${REPO_URL} on ${ref_final} for maps-server release")
checkout([$class: 'GitSCM', branches: [[name: "${ref_final}" ]], userRemoteConfigs: [[url: "${REPO_URL}"]]])
checkout scm
sh("git checkout ${ref_final}")

def MAPS_PRODUCT = "opensearch-maps-server"
def MAPS_VERSION = sh (
Expand Down