Downloading from gitlab

We use gitlab to post internal releases of archives. I want to be able to automate the process of downloading these artifacts. Here it is using the glab CLI.

export REPO=https://gitlab.com/YourCompany/sw-eng/product-manifest
 
glab auth login --stdin < ~/.token
glab release list -R $REPO
glab release view item/5.4.3.2 -R $REPO
glab release download item/5.4.3.2 -R $REPO   --asset-name=sw-eng_5.4.3.2-product-subclass_binary-datestamp.tar.xz

Note that each of these commands can be done with the glab api subcommand instead, but the path needs to be escaped.

export REPO=YourCompany%2Fsw-eng%2Fproduct-manifest
glab api "$REPO/releases"
glab api "$REPO/releases/item%2F5.4.3.2"

This last one gives you the URLs for direct download. You want to save them to a file via redirection.

glab api "https://gitlab.com/api/v4/projects/99999999/packages/generic/sw_release/1.2.3.4/eng_1.2.3.4-product-name-version-version.tar.xz" > eng_1.2.3.4-product-name-version-version.tar.xz

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.