Variable expansion needed in `ref` keyword for `needs`
### Summary According to https://docs.gitlab.com/ee/ci/yaml/#artifact-downloads-between-pipelines-in-the-same-project, it is possible to download parent-artifacts into child pipeline(s) by using the needs: keyword. This does not seem to work for me. Update: This is due to variable expansion not being supported here for the ref: ```yaml job: needs: - project: ${CI_PROJECT_PATH} job: stage1 ref: ${CI_COMMIT_REF_NAME} artifacts: true ``` ### Steps to reproduce - have a parent pipeline that creates an artifact, e.g. a textfile and make it an artifact - have a child pipeline that attempts to simply display the content of the textfile it tries to obtain by using the needs: keyword as shown in the documentation - wonder about the "no such file" error message ![Bildschirmfoto_2020-02-05_um_15.30.33](/uploads/32d51618a124c3ff958ae719f25ca045/Bildschirmfoto_2020-02-05_um_15.30.33.png) ### Example Project https://gitlab.com/svenXY/pipelines (**branch: parent-child-artifact**) ### What is the current *bug* behavior? The artifact is not downloaded, in fact, there isn't even any notion of any attempt at doing so - I would at least expect some error message if downloading artifacts fails ### What is the expected *correct* behavior? The artifact files downloaded, either as a zip archive or as they have been created by the job in the parent pipeline In any case, I'd expect some output lines that some artifact (name, ...) is attempted to be downloaded. ### Relevant logs and/or screenshots #### the parent pipeline job: ``` Running with gitlab-runner 12.7.1 (003fe500) on docker-auto-scale ed2dce3a Using Docker executor with image ruby:2.5 ... 00:43 Pulling docker image ruby:2.5 ... Using docker image sha256:2a14e515b3071e903c110bc60285cfb8ed3b3fe4602ab8838ed3dca20e831628 for ruby:2.5 ... Running on runner-ed2dce3a-project-16611439-concurrent-0 via runner-ed2dce3a-srm-1580912007-8092cdd7... 00:05 $ eval "$CI_PRE_CLONE_SCRIPT" 00:01 Fetching changes with git depth set to 50... Initialized empty Git repository in /builds/svenXY/pipelines/.git/ Created fresh repository. From https://gitlab.com/svenXY/pipelines * [new ref] refs/pipelines/115215520 -> refs/pipelines/115215520 * [new branch] parent-child-artifact -> origin/parent-child-artifact Checking out 741402c2 as parent-child-artifact... Skipping Git submodules setup $ echo 'stage 1' 00:02 stage 1 $ echo 'stage 1' > my_artifact.txt Uploading artifacts... 00:02 my_artifact.txt: found 1 matching files Uploading artifacts to coordinator... ok id=426847018 responseStatus=201 Created token=Na_DG8L3 Job succeeded ``` #### the child pipeline job ``` Running with gitlab-runner 12.7.1 (003fe500) on docker-auto-scale 0277ea0f Using Docker executor with image ruby:2.5 ... 00:34 Pulling docker image ruby:2.5 ... Using docker image sha256:2a14e515b3071e903c110bc60285cfb8ed3b3fe4602ab8838ed3dca20e831628 for ruby:2.5 ... Running on runner-0277ea0f-project-16611439-concurrent-0 via runner-0277ea0f-srm-1580911977-b98a6dd0... 00:05 $ eval "$CI_PRE_CLONE_SCRIPT" 00:02 Fetching changes with git depth set to 50... Initialized empty Git repository in /builds/svenXY/pipelines/.git/ Created fresh repository. From https://gitlab.com/svenXY/pipelines * [new ref] refs/pipelines/115215953 -> refs/pipelines/115215953 * [new branch] parent-child-artifact -> origin/parent-child-artifact Checking out 741402c2 as parent-child-artifact... Skipping Git submodules setup $ echo 'Deployment' 00:01 Deployment $ cat my_artifact.txt cat: my_artifact.txt: No such file or directory ERROR: Job failed: exit code 1 ``` ### Output of checks This bug happens on GitLab.com
issue