From a56bf3f0eee33cf9fc66e9633d8f9a3db7b42fa7 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 26 May 2020 18:30:15 +0500 Subject: [PATCH] Install GitHUB CLI on Ubuntu (#851) * Install GitHub CLI on linux images * Install latest release * remove unneeded sudo * Remove help cli options * Add helper doc * Resolve comments Co-authored-by: Sergey Dolin --- images/linux/scripts/installers/github-cli.sh | 26 +++++++++++++++++++ images/linux/ubuntu1604.json | 1 + images/linux/ubuntu1804.json | 1 + 3 files changed, 28 insertions(+) create mode 100644 images/linux/scripts/installers/github-cli.sh diff --git a/images/linux/scripts/installers/github-cli.sh b/images/linux/scripts/installers/github-cli.sh new file mode 100644 index 000000000..5cc430948 --- /dev/null +++ b/images/linux/scripts/installers/github-cli.sh @@ -0,0 +1,26 @@ +#!/bin/bash +################################################################################ +## File: github-cli.sh +## Desc: Installs GitHub CLI +## Must be run as non-root user after homebrew +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install GitHub CLI +url=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | jq -r '.assets[].browser_download_url|select(contains("linux") and contains("amd64") and contains(".deb"))') +wget $url +apt install ./gh_*_linux_amd64.deb +rm gh_*_linux_amd64.deb + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! gh --version; then + echo "GitHub CLI was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "GitHub CLI $(gh --version|awk 'FNR==1 {print $3}')" diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index a493a3302..9ead9a30c 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -197,6 +197,7 @@ "{{template_dir}}/scripts/installers/gcc.sh", "{{template_dir}}/scripts/installers/gfortran.sh", "{{template_dir}}/scripts/installers/git.sh", + "{{template_dir}}/scripts/installers/github-cli.sh", "{{template_dir}}/scripts/installers/google-chrome.sh", "{{template_dir}}/scripts/installers/google-cloud-sdk.sh", "{{template_dir}}/scripts/installers/haskell.sh", diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 89a024d34..13d379907 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -200,6 +200,7 @@ "{{template_dir}}/scripts/installers/gcc.sh", "{{template_dir}}/scripts/installers/gfortran.sh", "{{template_dir}}/scripts/installers/git.sh", + "{{template_dir}}/scripts/installers/github-cli.sh", "{{template_dir}}/scripts/installers/google-chrome.sh", "{{template_dir}}/scripts/installers/google-cloud-sdk.sh", "{{template_dir}}/scripts/installers/haskell.sh",