Project-level Secure Files API - download using name instead of id
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Proposal
An improvment to the Project-level Secure Files API would be to download file using name e.g.:
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/secure_files/download/myfile.jks --output myfile.jks
Using the download-secure-files tool dose not allow file granularity.
The installer requiers bash.
Using the download-secure-files will:
- Downlod the installer bash script to identify os and architecture
- Downloading a binary
- Downloading the secure-file index
- Downloading all the secure files
An alternativ is to use Project-level Secure Files API and e.g. curl:
build:
stage: build
image:
name: alpine/curl
entrypoint: [""]
script:
- 'curl --request GET --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" $CI_API_V4_URL/projects/$CI_PROJECT_ID/secure_files/1/download/ --output aaa.txt'
- 'curl --request GET --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" $CI_API_V4_URL/projects/$CI_PROJECT_ID/secure_files/2/download/ --output bbb.txt'
to use id of a secure file to download a secure file using
build:
stage: build
image:
name: alpine/curl
entrypoint: [""]
script:
- 'curl --request GET --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" $CI_API_V4_URL/projects/$CI_PROJECT_ID/secure_files/1/download/ --output aaa.txt'
- 'curl --request GET --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" $CI_API_V4_URL/projects/$CI_PROJECT_ID/secure_files/2/download/ --output bbb.txt'
Edited by 🤖 GitLab Bot 🤖