Skip to content
Snippets Groups Projects
Commit ba2eb2eb authored by Domenico Giordano's avatar Domenico Giordano
Browse files

reorganised the sequence of steps in test singularity

parent 4232c9b4
No related branches found
No related tags found
4 merge requests!239Qa,!237merge from qa,!230Huge set of changes to move to new code refactory,!174BMK-122 Update main.sh, check failures of test singularity and remove images created by singularity
This commit is part of merge request !174. Comments created here will be created in the context of that merge request.
...@@ -22,7 +22,7 @@ function execute_command(){ ...@@ -22,7 +22,7 @@ function execute_command(){
echo "`date` [execute_command] Executing '$@'" echo "`date` [execute_command] Executing '$@'"
eval "$@" eval "$@"
status=$? status=$?
echo "`date` [execute_command] Return code: ${status}" echo "`date` [execute_command] '$@'\nReturn code: ${status}"
return ${status} return ${status}
} }
...@@ -330,29 +330,25 @@ function test_standalone_image_singularity(){ ...@@ -330,29 +330,25 @@ function test_standalone_image_singularity(){
else else
singularityregistry="${CIENV_DOCKERREGISTRY}" singularityregistry="${CIENV_DOCKERREGISTRY}"
theimage="${HEPWL_DOCKERIMAGENAME}":"${HEPWL_DOCKERIMAGETAG}" theimage="${HEPWL_DOCKERIMAGENAME}":"${HEPWL_DOCKERIMAGETAG}"
echo "[test_standalone_image_singularity] docker tag ${singularityregistry}/${theimage} ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity"
if ! docker tag ${singularityregistry}/${theimage} ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity ; then execute_command docker tag ${singularityregistry}/${theimage} ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity || fail "[test_standalone_image_singularity] docker tag"
docker rmi -f ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity #BMK-122
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
fi (
if ! echo $CI_BUILD_TOKEN | docker login -u gitlab-ci-token --password-stdin gitlab-registry.cern.ch ; then ( echo $CI_BUILD_TOKEN | docker login -u gitlab-ci-token --password-stdin gitlab-registry.cern.ch || fail "[test_standalone_image_singularity] docker login" ) &&
docker rmi -f ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity #BMK-122 ( execute_command docker push ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity || fail "[test_standalone_image_singularity] docker push ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity" ) &&
fail "[test_standalone_image_singularity] docker login" echo -e "\n[test_standalone_image_singularity] Run WL in singularity (to test the image) via execute_command - started" &&
fi ( 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" )
echo "[test_standalone_image_singularity] docker push ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity" )
if ! docker push ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity ; then status=$?
docker rmi -f ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity #BMK-122
fail "[test_standalone_image_singularity] docker push ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity" ## Removing in all cases the singularity test image
fi docker rmi -f ${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"
if ! 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"; then
docker rmi -f ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity #BMK-122
fail "[test_standalone_image_singularity] Run WL in singularity"
fi
echo -e "[test_standalone_image_singularity] Run WL in singularity (to test the image) via execute_command - completed\n"
if [[ $status -ne 0 ]]; then
fail "[test_standalone_image_singularity] Run WL in singularity"
fi
fi fi
docker rmi -f ${singularityregistry}/${HEPWL_DOCKERIMAGENAME}:test_ci_singularity #BMK-122
echo "[test_standalone_image_singularity] finished at $(date)" echo "[test_standalone_image_singularity] finished at $(date)"
return 0 return 0
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment