mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 05:07:02 +00:00
* Fix kubectl installation * Fix kubectl installation * Add --client flag * Fix for ubuntu 16.04 * Move kubectl apt packages installation to basic.sh * Combined separated scripts for kubectl installation to one * Minor fix * Remove apt-transport-https package from basic.sh * Delete helm init
39 lines
1.4 KiB
Bash
39 lines
1.4 KiB
Bash
#!/bin/bash
|
|
################################################################################
|
|
## File: kubernetes-tools.sh
|
|
## Desc: Installs kubectl, helm
|
|
################################################################################
|
|
|
|
# Source the helpers for use with the script
|
|
source $HELPER_SCRIPTS/document.sh
|
|
source $HELPER_SCRIPTS/apt.sh
|
|
|
|
## Install kubectl
|
|
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
|
|
touch /etc/apt/sources.list.d/kubernetes.list
|
|
|
|
# Based on https://kubernetes.io/docs/tasks/tools/install-kubectl/, package is xenial for both OS versions.
|
|
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list
|
|
apt-get update
|
|
apt-get install -y kubectl
|
|
|
|
# Install Helm
|
|
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
|
|
|
|
# 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 ! command -v kubectl; then
|
|
echo "kubectl was not installed"
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v helm; then
|
|
echo "helm was not installed"
|
|
exit 1
|
|
fi
|
|
|
|
# Document what was added to the image
|
|
echo "Lastly, documenting what we added to the metadata file"
|
|
DocumentInstalledItem "kubectl ($(kubectl version --client --short |& head -n 1))"
|
|
DocumentInstalledItem "helm ($(helm version --short |& head -n 1))"
|