Upstream pipeline archive utilised in downstream artifact download

The issue is as follows.

Triggering a downstream pipeline cannot download artifacts from the current upstream pipeline

here is the yaml examples

Upstream:

#Trigger stage-----------------------------------------------------------------------------------------------------
trigger-artifacts:
  stage: trigger
  script:
    - echo $CI_PROJECT_NAME
    - echo $CI_PIPELINE_ID
    - echo $CI_COMMIT_REF_NAME
    - echo $CI_COMMIT_SHA
    - echo $CI_JOB_TOKEN
    - echo "Hello World" >> test.txt
  artifacts:
    paths:
      [test.txt]
    expire_in: 1 week

trigger-repository:
  #do not pass this pipeline variables to the spawned pipeline
  #inherit:
    #variables: false 
  #Set a variable so the spawned pipeline can determine is has been spawned from another pipeline
  variables:
    PARENT_TRIGGER: $CI_PROJECT_NAME
    PARENT_PIPELINE_ID: $CI_PIPELINE_ID
    PARENT_BRANCH: $CI_COMMIT_REF_NAME
    PARENT_SHA: $CI_COMMIT_SHA
  #Trigger other pipeline
  trigger: 
    project: ACS_Peripherals/plcprojects
    #wait for pipeline to run
    strategy: depend 
    #This is for testing and should be commented out
    branch: triiger_pipeline_ref
  stage: trigger
  when: manual

Downstream:

download-cicd-test-trigger:
  script:
    - ls
  needs:
    - project: $PARENT_PIPELINE_ID
      job: trigger-artifacts
      ref: $PARENT_BRANCH
      artifacts: true
  stage: setup
  rules: 
    - if: '$PARENT_TRIGGER == "cicd"'

This always fails with the following:
image

Obviously I wait until the job trigger-artifact has completed before triggering the downstream pipeline manually. As you can see this is a reproduction case for testing purposes.

If I change the following I can download the master archive everytime
ref: master

I want to download the current artifact from the current branch running that triggered the downstream

Whats should ref be?

I have looked through a lot of forum, stack overflow, and the documentation. The documentation states this can be done

ref: $ARTIFACTS_DOWNLOAD_REF

What is $ARTIFACTS_DOWNLOAD_REF? I would expect this to be $CI_COMMIT_REF_NAME

Please help

I believe you should use “trigger-repository” as a needs:job: in dowstream project, instead of “trigger-artifacts”