~aleteoryx/muditaos

ref: 547437718fb982303a5680521830d7cff7a2e50f muditaos/doc/download_assets.md -rw-r--r-- 2.8 KiB
54743771 — Marek Niepieklo [CP-1048] Database instance mix-up in predefinedQuotesDB backup code 4 years ago

#Download Assets

Building update packages requires external assets located on external repositories releases pages, in specific versions for specified products. The tool automates downloading such assets.

#How to use download_asset.py

The tool can be used to:

  • list releases from the repository from the Mudita organization
  • download selected assets from the repositories from the Mudita organization via GitHub API
  • download selected asset release from the repositories to get asset files via GitHub API and tar library

The tool uses argparse to provide CLI and the best user experience. Please see download_asset.py --help for up to date parameters use and documentation

#GitHub API token

To use GitHub API your GitHub login and special token (API password) are required. This token can by generated on "User" -> Settings page in section Developer settings -> Personal acces tokens section. For more info please refer to the Github help page about adding tokens: Creating a personal access token

#Scopes

When you generate a token you can set "Scopes" for which the token will work. For downloading assets, we need a ":repo" scope with all sub-scopes.

Note: Tokens are displayed only during their creation, so this is the only moment you can copy them. If you forget to do this, you will have to generate a new token.

Note: With token added please double check it's working before issuing not working toolkit as most of the problems lies with no, or improper configuration.

#Storing settings

The download_assets.py file can have login and password passed through parameters, or this data can be stored in your current git repository configuration.

Adding GitHub login to:

git config --add user.githublogin <login>

Adding API Token:

git config --add user.apitoken

Checking the values:

git config user.githublogin
git config user.apitoken

#Testing for proper asset download configuration

  1. check if you have token configured
git config user.apitoken

if not please add the token ( see doc: documentation

  1. check if you have access to the PureUpdater repository in read mode
curl -o /dev/null -H "Authorization: token $(git config user.apitoken)" "https://api.github.com/repos/mudita/PureUpdater"

if not Then please either fix your token access or request access to the PureUpdater

  1. Check if you can list releases on repository:
python3 ./tools/download_asset.py github --repository PureUpdater list

if not Then fix your token, or request access to PureUpdater