Commit 760c4783 authored by Raphael Defosseux's avatar Raphael Defosseux

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

feat(ci): always keeping a copy of CI temp image and also pushing to DockerHub on merged MR; triggering FED OC pipeline as well
Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent d66c73e4
......@@ -67,7 +67,8 @@ pipeline {
"Build RHEL8 UDR Image",
"Static Code Analysis",
"Code Formatting Checker",
"Test with DsTester on Docker environment"
"Test with DsTester on Docker environment",
"Test with DsTester on OC environment"
])
}
......@@ -113,6 +114,10 @@ pipeline {
error "Stopping pipeline!"
}
}
if (params.DockerHubCredentials == null) {
echo '\u26D4 \u001B[31mNo Credentials to push to DockerHub!\u001B[0m'
error "Stopping pipeline!"
}
}
}
}
......@@ -195,6 +200,10 @@ pipeline {
myShCmd('docker build --no-cache --target oai-udr --tag oai-udr:' + udr_tag + ' --file ci-scripts/docker/Dockerfile.ci.ubuntu.18.04 . > archives/udr_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
myShCmd('docker image ls >> archives/udr_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-udr:' + udr_tag + ' oai-udr:' + rhel_udr_tag, rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
}
}
}
......@@ -371,6 +380,55 @@ pipeline {
}
}
}
stage ('Testing in CN-5G-FED OC environment') {
steps {
script {
gitlabCommitStatus(name: "Test with DsTester on OC environment") {
localStatus = build job: params.CN5G_FED_OC_PipelineName,
parameters: [
string(name: 'UDR_TAG', value: String.valueOf(udr_tag)),
string(name: 'UDR_BRANCH', value: String.valueOf(udr_branch))
], propagate: false
localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "OC Federation Test Job is OK"
} else {
echo "OC Federation Test Job is KO"
sh "ci-scripts/fail.sh"
}
}
}
}
post {
always {
script {
copyArtifacts(projectName: params.CN5G_FED_OC_PipelineName,
filter: '*_results_oai_cn5g_oc.html',
selector: lastCompleted())
}
}
}
}
}
}
// 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-udr:develop ${DH_Username}/oai-udr:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker push ${DH_Username}/oai-udr:develop", rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd("docker rmi ${DH_Username}/oai-udr: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)
}
}
}
}
}
}
......
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