Commit 49ccc592 authored by Raphael Defosseux's avatar Raphael Defosseux

feat(ci): always keeping a copy of CI temp image and also pushing to DockerHub on merged MR

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@openairinterface.org>
parent 451c60f3
...@@ -114,6 +114,10 @@ pipeline { ...@@ -114,6 +114,10 @@ pipeline {
error "Stopping pipeline!" error "Stopping pipeline!"
} }
} }
if (params.DockerHubCredentials == null) {
echo '\u26D4 \u001B[31mNo Credentials to push to DockerHub!\u001B[0m'
error "Stopping pipeline!"
}
} }
} }
} }
...@@ -197,6 +201,10 @@ pipeline { ...@@ -197,6 +201,10 @@ pipeline {
myShCmd('docker build --no-cache --target oai-smf --tag oai-smf:' + smf_tag + ' --file ci-scripts/docker/Dockerfile.ci.ubuntu.18.04 . > archives/smf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker build --no-cache --target oai-smf --tag oai-smf:' + smf_tag + ' --file ci-scripts/docker/Dockerfile.ci.ubuntu.18.04 . > archives/smf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
} }
myShCmd('docker image ls >> archives/smf_docker_image_build.log', rem_u18_host_flag, rem_u18_host_user, rem_u18_host) myShCmd('docker image ls >> archives/smf_docker_image_build.log', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
// We will keep also the TMP image in U18 case.
if ("MERGE".equals(env.gitlabActionType)) {
myShCmd('docker image tag oai-smf:' + smf_tag + ' oai-smf:' + rhel_smf_tag, rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
} }
} }
} }
...@@ -403,6 +411,25 @@ pipeline { ...@@ -403,6 +411,25 @@ pipeline {
} }
} }
} }
// For the moment it is Docker-Hub, but we might have a new one internally.
stage ('Pushing Image to Official Registry') {
steps {
script {
// Only in case of push to target branch!
if ("PUSH".equals(env.gitlabActionType)) {
withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.DockerHubCredentials}", usernameVariable: 'DH_Username', passwordVariable: 'DH_Password']
]) {
myShCmd("echo ${DH_Password} | docker login --username ${DH_Username} --password-stdin", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker image tag oai-smf:develop ${DH_Username}/oai-smf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker push ${DH_Username}/oai-smf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker rmi ${DH_Username}/oai-smf:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker logout", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
}
}
}
}
} }
post { post {
success { success {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment