I need to compile a CMake based C++ project using GCC. It depends on MKL, and for successful Cmake configuration, compilation and test execution, I need run the following comands beforehand
source /opt/intel/bin/compilervars.sh -arch intel64
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
In order to run this with Azure pipelines I have a container which I am able to run based on the documentation from https://learn.microsoft.com/en-us/azure/devops/pipelines/process/container-phases?view=azure-devops.
Normally the above mentioned setup scripts would be called during container startup (https://hub.docker.com/layers/vvtk/vvcoreazurelinuxdockeragent/latest/images/sha256-c5e3775546ee90a111c9ae700306eb4cd1ebc710686bda5011633c4e5e883e13?context=repo) however it seems (as also described in https://stackoverflow.com/a/63643979/15128314 this startup CMD
command is not execute since Azure pipelines do not actually call docker run
As a result I am forced to replicate this into multiple steps of my pipeline job (basically each of config, build and test), since these env vars are also not persistent across the different steps. How can I solve this more efficiently? The pipeline looks horrible ..
- script: |
source /opt/intel/bin/compilervars.sh -arch intel64
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
(more cmds here)
displayName: config_Linux_x64_Release
- script: |
source /opt/intel/bin/compilervars.sh -arch intel64
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
(more cmds here)
displayName: build_Linux_x64_Release
- script: |
source /opt/intel/bin/compilervars.sh -arch intel64
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
(more cmds here)
displayName: test_Linux_x64_Release