Question:Is there a way to get all files embedded in gitlab snippets using curl command?
Using the following command I only get the first file.
Since the snippet gathers 3 files I would like to download them all.
curl -O "https://gitlab.com/-/snippets/2264390/raw"
Answer:Use the snippets API to get the list of all the files and URLs.
SNIPPET_ID=2264390 curl "https://gitlab.com/api/v4/snippets/$SNIPPET_ID" | jq -r .files.raw_url
You could pipe that output to
https://gitlab.com/-/snippets/2264390/raw/main/grafana.service https://gitlab.com/-/snippets/2264390/raw/main/install-grafana-loki-promtail.sh https://gitlab.com/-/snippets/2264390/raw/main/loki-config.yaml https://gitlab.com/-/snippets/2264390/raw/main/loki.service https://gitlab.com/-/snippets/2264390/raw/main/promtail-config.yaml https://gitlab.com/-/snippets/2264390/raw/main/promtail.service
xargsand curl them as well, if you wanted.
If you were open to using something other than
curlsnippets work mostly like any other repository and can be cloned with HTTPS/SSH.
git clone https://gitlab.com/snippets/2264390
If you have better answer, please add a comment about this, thank you!