Skip to content

Commit

Permalink
Update the gradle check with docker command checks (opensearch-projec…
Browse files Browse the repository at this point in the history
…t#4178)

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored Oct 26, 2023
1 parent ba60041 commit aa05541
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions jenkins/gradle/gradle-check.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* compatible open source license.
*/

lib = library(identifier: 'jenkins@1.1.2', retriever: modernSCM([
lib = library(identifier: 'jenkins@5.3.0', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))
Expand Down Expand Up @@ -105,7 +105,8 @@ pipeline {

echo("Build Cause: ${BUILD_CAUSE}")
withCredentials([usernamePassword(credentialsId: CREDENTIAL_ID, usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) {
def dockerLogin = sh(returnStdout: true, script: "set +x && echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin").trim()

def dockerLogin = sh(returnStdout: true, script: "set +x && (echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin) || echo docker error").trim()

if (!env.BUILD_CAUSE.contains('Started by user') && !env.BUILD_CAUSE.contains('Started by timer')) {
def pr_url = "${pr_to_clone_url}".replace(".git", "/pull/${pr_number}")
Expand Down Expand Up @@ -133,7 +134,7 @@ pipeline {
)
}

sh("docker logout")
sh("docker logout || echo docker error")
}
}
}
Expand All @@ -157,7 +158,7 @@ pipeline {
always {
script {
postCleanup()
sh "docker logout && docker image prune -f --all"
sh "(docker logout && docker image prune -f --all) || echo docker error"
}
}
}
Expand Down

0 comments on commit aa05541

Please sign in to comment.