Skip to content

Commit

Permalink
Add latest url update toggle on distribution workflows (#2881)
Browse files Browse the repository at this point in the history
* Add latest url update toggle on distribution workflows

Signed-off-by: Peter Zhu <[email protected]>

* Tweak gradle check

Signed-off-by: Peter Zhu <[email protected]>

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored Nov 10, 2022
1 parent 449cee4 commit ed8f598
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
8 changes: 5 additions & 3 deletions jenkins/gradle/gradle-check.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,16 @@ pipeline {
fi
"""

def agent_name = params.AGENT_LABEL.tokenize('-')[2]

if (env.USER_BUILD_CAUSE.equals('[]') && env.TIMER_BUILD_CAUSE.equals('[]')) {
def pr_url = "${pr_to_clone_url}".replace(".git", "/pull/${pr_number}")
println("Triggered by GitHub: ${pr_to_clone_url}")
if ("$pr_number" == "Null") {
currentBuild.description = """<a href="${pr_to_clone_url}">Others</a>: ${pr_title}<br>runner: ${AGENT_LABEL}"""
currentBuild.description = """runner: ${agent_name}<br><a href="${pr_to_clone_url}">Others</a>: ${pr_title}"""
}
else {
currentBuild.description = """<a href="${pr_url}">PR #${pr_number}</a>: ${pr_title}<br>runner: ${AGENT_LABEL}"""
currentBuild.description = """runner: ${agent_name}<br><a href="${pr_url}">PR #${pr_number}</a>: ${pr_title}"""
}

runGradleCheck(
Expand All @@ -107,7 +109,7 @@ pipeline {
else {
println("Triggered by User or Triggered by Timer")
def repo_url = "${GIT_REPO_URL}".replace(".git", "/commit")
currentBuild.description = """git: <a href="${GIT_REPO_URL}">${GIT_REPO_URL}</a><br>ref: <a href="${repo_url}/${GIT_REFERENCE}">${GIT_REFERENCE}</a><br>runner: ${AGENT_LABEL}"""
currentBuild.description = """runner: ${agent_name}<br>git: <a href="${GIT_REPO_URL}">${GIT_REPO_URL}</a><br>ref: <a href="${repo_url}/${GIT_REFERENCE}">${GIT_REFERENCE}</a>"""

runGradleCheck(
gitRepoUrl: "${GIT_REPO_URL}",
Expand Down
13 changes: 10 additions & 3 deletions jenkins/opensearch-dashboards/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ pipeline {
description: 'Build docker image or not with options.',
choices: ['build_docker', 'build_docker_with_build_number_tag', 'do_not_build_docker'],
)
booleanParam(
name: 'UPDATE_LATEST_URL',
description: 'Update latest url so /latest/ is pointed to this build',
defaultValue: true
)
booleanParam(
name: 'PUBLISH_NOTIFICATION',
description: 'Publish the status of this build job or not.',
Expand Down Expand Up @@ -614,9 +619,11 @@ pipeline {
}
steps {
script {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH
)
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH
)
}
}
}
}
Expand Down
13 changes: 10 additions & 3 deletions jenkins/opensearch/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ pipeline {
description: 'Build docker image or not with options.',
choices: ['build_docker', 'build_docker_with_build_number_tag', 'do_not_build_docker'],
)
booleanParam(
name: 'UPDATE_LATEST_URL',
description: 'Update latest url so /latest/ is pointed to this build',
defaultValue: true
)
booleanParam(
name: 'PUBLISH_NOTIFICATION',
description: 'Publish the status of this build job or not.',
Expand Down Expand Up @@ -786,9 +791,11 @@ pipeline {
}
steps {
script {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH
)
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH
)
}
}
}
}
Expand Down

0 comments on commit ed8f598

Please sign in to comment.