Namespace src/Github
src/Github
Overview
Directory src/Github
file source src/Github/defaultInstall.sh
Github::downloadReleaseVersion
download specified release software version from github
Arguments
- $1 (releaseUrl:String): eg: https://github.com/kubernetes-sigs/kind/releases/download/v1.0.0/kind-linux-amd64
Environment variables
- CURL_CONNECT_TIMEOUT (number): of seconds before giving up host connection
Exit codes
- 1: on failure
Output on stdout
- the path to the downloaded release
src/Github/extractRepoFromGithubUrl.sh
file source src/Github/extractRepoFromGithubUrl.sh
Github::extractRepoFromGithubUrl
github repository eg: kubernetes-sigs/kind
Arguments
- $1 (githubUrl:String): eg: https://github.com/kubernetes-sigs/kind/releases/download/@latestVersion@/kind-linux-amd64
Exit codes
- 1: if no matching repo found in provided url, 0 otherwise
Output on stdout
- the repo in the form owner/repo
src/Github/getLatestRelease.sh
file source src/Github/getLatestRelease.sh
Github::getLatestRelease
Retrieve the latest version number of a github release using Github API using retry repo arg with fchastanet/bash-tools value would match https://github.com/fchastanet/bash-tools
Arguments
- $1 (repo:String): repository in the format fchastanet/bash-tools
- $2 (resultRef:&String): reference to a variable that will contain the result of the command
Environment variables
- CURL_CONNECT_TIMEOUT (number): of seconds before giving up host connection
Output on stdout
- log messages about retry
src/Github/getLatestVersionFromUrl.sh
file source src/Github/getLatestVersionFromUrl.sh
Github::getLatestVersionFromUrl
Retrieve the latest version number for given github url
Arguments
- $1 (releaseUrl:String): github url from which repository will be extracted
Output on stdout
- the version number retrieved
Output on stderr
- log messages about retry
src/Github/installRelease.sh
file source src/Github/installRelease.sh
Github::installRelease
install binary with the exact version provided using retry
releaseUrl argument: the placeholder @latestVersion@ will be replaced by the provided version
Arguments
- $1 (targetFile:String): target binary file (eg: /usr/local/bin/kind)
- $2 (releaseUrl:String): github release url (eg: https://github.com/kubernetes-sigs/kind/releases/download/@latestVersion@/kind-linux-amd64)
- $3 (exactVersion:String): which exact version to get
- $4 (argVersion:String): the argument used to get the version of the command (default: –version)
- $5 (versionCallback:Function): called to get software version (default: Version::getCommandVersionFromPlainText will call software with argument –version)
- $6 (installCallback:Function): called to install the file retrieved on github (default copy as is and set execution bit)
Environment variables
- CURL_CONNECT_TIMEOUT (number): of seconds before giving up host connection
- VERSION_PLACEHOLDER (a): placeholder to replace in downloadReleaseUrl (default: @latestVersion@)
Output on stdout
- log messages about retry, install, upgrade
src/Github/isReleaseVersionExist.sh
file source src/Github/isReleaseVersionExist.sh
Github::isReleaseVersionExist
check if specified release software version exists in github
Arguments
- $1 (releaseUrl:String): eg: https://github.com/kubernetes-sigs/kind/releases/download/v1.0.0/kind-linux-amd64
Environment variables
- CURL_CONNECT_TIMEOUT (number): of seconds before giving up host connection
Exit codes
- 1: on failure
- 0: if release version exists
src/Github/upgradeRelease.sh
file source src/Github/upgradeRelease.sh
Github::upgradeRelease
upgrade given binary to latest github release using retry
downloadReleaseUrl argument : the placeholder @latestVersion@ will be replaced by the latest release version
Arguments
- $1 (targetFile:String): target binary file (eg: /usr/local/bin/kind)
- $2 (downloadReleaseUrl:String): github release url (eg: https://github.com/kubernetes-sigs/kind/releases/download/@latestVersion@/kind-linux-amd64)
- $3 (softVersionArg:String): parameter to add to existing command to compute current version
- $4 (softVersionCallback:Function): function called to get software version (default: Version::getCommandVersionFromPlainText will call software with argument –version)
- $5 (installCallback:Function): function called to install the file retrieved on github (default copy as is and set execution bit)
- $6 (softVersionCallback:Function): function to call to filter the version retrieved from github (Default: Version::parse)
Environment variables
- SOFT_VERSION_CALLBACK (pass): softVersionCallback by env variable instead of passing it by arg
- INSTALL_CALLBACK (pass): installCallback by env variable instead of passing it by arg
- CURL_CONNECT_TIMEOUT (number): of seconds before giving up host connection
- EXACT_VERSION (if): provided, retrieve exact version instead of the latest
Output on stdout
- log messages about retry, install, upgrade