Ensure that build and test stage run on the same architecture

I am running several runners on different architectures to check a parallel HPC code. There are two stages, build where the code is built with different compilers and compiler options. One of these executables is then used in the test stage to run a testsuite. I now would like to ensure that the test stage (which takes the executable as an artifact from the build stage) is run on a runner on the same architecture.
The first approach was to modifiy dynamically (with the Runners API) the runners’ tags in the build stage to mark the runner on which the build was done. Then the test stage needs this tag to run. In a cleanup stage theses additional tags are removed again.
This worked as long as only one pipeline is processed at the same time.The problems start with more than one pipeline. One can add the CI_PIPELINE_ID to the dynamic runners tags, but I cannot dynamically change the tags in the .gitlab-ci.yml file for the test stage. And unfortunately, gitlab does not understand variables in the tags part of a job definition. If something like

stage: test

would work, the problem is solved.
Are there any other possibilities to achieve the same goal?

did you have the answer to your question? dynamic runner tags

I do not have an answer, yet. But I did not check the latest gitlab version, perhaps this problem has been solved there.