diff --git a/projects/clr/hipamd/Jenkinsfile b/projects/clr/hipamd/Jenkinsfile index ee3a301dd3..280ea9b5ad 100644 --- a/projects/clr/hipamd/Jenkinsfile +++ b/projects/clr/hipamd/Jenkinsfile @@ -156,7 +156,7 @@ def docker_build_inside_image( def build_image, String inside_args, String platf //////////////////////////////////////////////////////////////////////// // This builds a fresh docker image FROM a clean base image, with no build dependencies included // Uploads the new docker image to internal artifactory -def docker_upload_artifactory( String hcc_ver, String from_image, String source_hip_rel, String build_dir_rel ) +def docker_upload_install_image( String hcc_ver, String from_image, String source_hip_rel, String build_dir_rel ) { def hip_install_image = null String image_name = "hip-${hcc_ver}-ubuntu-16.04" @@ -194,15 +194,33 @@ def docker_upload_artifactory( String hcc_ver, String from_image, String source_ hip_install_image.push( 'latest' ) } } - - // Lots of images with tags are created above; no apparent way to delete images:tags with docker global variable - // run bash script to clean images:tags after successful pushing - sh "docker images | grep \"${artifactory_org}/${image_name}\" | awk '{print \$1 \":\" \$2}' | xargs docker rmi" } catch( err ) { currentBuild.result = 'SUCCESS' } + + // Do not treat failures to push to docker-hub as a build fail + try + { + // Only push changes to the master branch to docker-hub + if( env.BRANCH_NAME.toLowerCase( ).startsWith( 'docker' ) ) + { + docker.withRegistry('https://hub.docker.com', 'docker-hub-cred' ) + { + hip_install_image.push( "${env.BUILD_NUMBER}" ) + hip_install_image.push( 'latest' ) + } + } + } + catch( err ) + { + currentBuild.result = 'SUCCESS' + } + + // Lots of images with tags are created above; no apparent way to delete images:tags with docker global variable + // run bash script to clean images:tags after successful pushing + sh "docker images | grep \"${artifactory_org}/${image_name}\" | awk '{print \$1 \":\" \$2}' | xargs docker rmi" } } @@ -242,7 +260,7 @@ parallel hcc_ctu: docker_build_inside_image( hip_build_image, inside_args, hcc_ver, '', build_config, source_hip_rel, build_hip_rel ) // After a successful build, upload a docker image of the results - docker_upload_artifactory( hcc_ver, from_image, source_hip_rel, build_hip_rel ) + docker_upload_install_image( hcc_ver, from_image, source_hip_rel, build_hip_rel ) } }, hcc_1_6: @@ -276,7 +294,7 @@ hcc_1_6: docker_build_inside_image( hip_build_image, inside_args, hcc_ver, '', build_config, source_hip_rel, build_hip_rel ) // After a successful build, upload a docker image of the results - docker_upload_artifactory( hcc_ver, from_image, source_hip_rel, build_hip_rel ) + docker_upload_install_image( hcc_ver, from_image, source_hip_rel, build_hip_rel ) } }, nvcc: