Skip to content
Snippets Groups Projects

BMK-122 Update main.sh, check failures of test singularity and remove images created by singularity

Merged BMK-122 Update main.sh, check failures of test singularity and remove images created by singularity
Merged Domenico Giordano requested to merge BMK-122 into qa
1 file
+ 2
4
Compare changes
  • Side-by-side
  • Inline
+ 20
12
@@ -19,12 +19,10 @@ function fail(){
}
function execute_command(){
date
echo "[execute_command] Executing '$@'"
echo "`date` [execute_command] Executing '$@'"
eval "$@"
status=$?
echo "[execute_command] Return code: ${status}"
date
echo "`date` [execute_command] '$@'\nReturn code: ${status}"
return ${status}
}
@@ -332,14 +330,24 @@ function test_standalone_image_singularity(){
else
singularityregistry="${CIENV_DOCKERREGISTRY}"
theimage="${HEPWL_DOCKERIMAGENAME}":"${HEPWL_DOCKERIMAGETAG}"
echo "[test_standalone_image_singularity] docker tag ${singularityregistry}/${theimage} ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity"
docker tag ${singularityregistry}/${theimage} ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity || fail "[test_standalone_image_singularity] docker tag"
echo $CI_BUILD_TOKEN | docker login -u gitlab-ci-token --password-stdin gitlab-registry.cern.ch || fail "[test_standalone_image_singularity] docker login"
echo "[test_standalone_image_singularity] docker push ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity"
docker push ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity
echo -e "\n[test_standalone_image_singularity] Run WL in singularity (to test the image) via execute_command - started"
execute_command docker run --privileged --network=host -v ${CIENV_JOBDIR}/results:/results ${singularityregistry}/singularity-executor singularity run -B /results:/results docker://${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity $HEPWL_BMKOPTS || fail "[test_standalone_image_singularity] singularity run -B $CIENV_JOBDIR/results:/results ${HEPWL_DOCKERIMAGENAME}:ci_singularity $HEPWL_BMKOPTS"
echo -e "[test_standalone_image_singularity] Run WL in singularity (to test the image) via execute_command - completed\n"
execute_command docker tag ${singularityregistry}/${theimage} ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity || fail "[test_standalone_image_singularity] docker tag"
## This is a sequence of commands in a given scope. In case of failure of one of them, cleanup the test_ci_singularity and fail
(
( echo $CI_BUILD_TOKEN | docker login -u gitlab-ci-token --password-stdin gitlab-registry.cern.ch || fail "[test_standalone_image_singularity] docker login" ) &&
( execute_command docker push ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity || fail "[test_standalone_image_singularity] docker push ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity" ) &&
echo -e "\n[test_standalone_image_singularity] Run WL in singularity (to test the image) via execute_command - started" &&
( execute_command docker run --privileged --network=host -v ${CIENV_JOBDIR}/results:/results ${singularityregistry}/singularity-executor singularity run -B /results:/results docker://${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity $HEPWL_BMKOPTS || fail "[test_standalone_image_singularity] singularity run" )
)
status=$?
## Removing in all cases the singularity test image
docker rmi -f ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity
if [[ $status -ne 0 ]]; then
fail "[test_standalone_image_singularity] Run WL in singularity"
fi
fi
echo "[test_standalone_image_singularity] finished at $(date)"
return 0
Loading