Download artifact after job ends in GitLab

I have two jobs in my Pipeline, one that creates an Android application apk and saves it in artifacts, and a second one that calls an external API to notify it with the new artifacts.

This is a part of my gitlab-ci.yaml

assembleProdRelease:
  stage: prod_release
  script:
    - ./gradlew assembleProdRelease
  artifacts:
    paths:
      - app/build/outputs/apk/

  only:
    - prod

    
updateReleaseMgmt:
  stage: update_release_mgmt
  before_script:
    - ''
  script:
    - JOBNAME=assemble"${CI_COMMIT_REF_NAME^}"Release
    - |
     curl --header "Content-Type: application/json" --request PUT --data '{"download_link": "https://xxxxxxxxxxxxx/api/v4/projects/30/jobs/artifacts/'$CI_COMMIT_REF_NAME'/download?job='$JOBNAME'", "access_token": "xxxxxxx", "branch": "$CI_COMMIT_REF_NAME"}' http://xxxxxxxxx/releases

When a request is sent to my API and I download the artifacts, it gets the content of the previous pipeline ran, how I can fix and download the artifacts of the current pipeline?

Iā€™m not sure, @alterEgo123 but this comment looks relevant to you.

2 Likes