Download Gitlab Artifacts using API for different jobs

I am trying to download job artifacts using REST API.

I was going thorough the documentation of gitlab and found out there is this API

GET /projects/:id/jobs/artifacts/:ref_name/download?job=name

that can give us latest successful build from the particular job. I was able to download the dev build.

To give you more context about this, there are multiple jobs setups for dev, stage and production environment. But the issue is that I am only able to dev environment build. Whenever I am using staging job name in the API, it is giving me 404. Ideally it should let me download the latest build available in staging job but that is happening. And this is happening for android and iOS both. What could be the possible issue here? Do we have to change something in the repo that can allow us to download all the type of builds?

YAML File

build:
  needs: [ lint,detekt ]
  variables:
    BUILD_VARIANT: devRelease

build:tmus-prod-release-apk:
  when: manual
  variables:
    BUILD_VARIANT: productionRelease

Versions

  • GitLab Runner, Running with gitlab-runner 16.10.0
1 Like
  • Verify Staging Job Uploads Artifacts: - Check the staging job’s script or configuration for commands like artifacts: paths that specify what files to upload as artifacts.
  • Confirm Job Name: - Carefully review the staging job name in GitLab and use the exact name in the API request.

Hello @warner.

  1. I am able to see the artifacts and download them manually from GUI. It is same what we have in dev environment.
  2. I cross checked the job name multiple times, It is happening with both android and iOS repo. I even tried with URL encoding,
    But nothing works out for me.