forked from robertbeal/k8s-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
111 lines (103 loc) · 4.43 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: "k8s toolbox"
description: "A suite of common tools for k8s usage"
inputs:
versions:
description: "A publicly curl-able json file for all toolbox application versions"
required: false
kubectl:
description: "Version of kubectl to use"
required: false
kube-config:
description: "Base 64 encoded ~/.kube/config for kubectl"
required: true
kops:
description: "Version of kops to use"
required: false
helm:
description: "Version of helm to use"
required: false
render:
description: "Version of render to use"
required: false
default: "v0.2.0"
aws-iam-authenticator:
description: "Version of aws iam authenticator to use"
required: false
default: "1.12.10/2019-08-14"
argo:
description: "Version of argo to use"
required: false
runs:
using: "composite"
steps:
- name: dependencies
run: sudo apt-get install -y jq
shell: bash
- name: versions
run: |
if [ -n "${{ inputs.versions }}" ]; then
curl --retry 5 --retry-delay 2 --fail -sL "${{ inputs.versions }}" > ~/versions.json
else
jq -n \
--arg kubectl "$(curl --retry 5 --retry-delay 2 --fail -sL https://api.github.com/repos/kubernetes/kubernetes/releases/latest | jq -r -e '.tag_name')" \
--arg kops "$(curl --retry 5 --retry-delay 2 --fail -sL https://api.github.com/repos/kubernetes/kops/releases/latest | jq -r -e '.tag_name')" \
--arg helm "$(curl --retry 5 --retry-delay 2 --fail -sL https://api.github.com/repos/helm/helm/releases/latest | jq -r -e '.tag_name')" \
--arg argo "$(curl --retry 5 --retry-delay 2 --fail -sL https://api.github.com/repos/argoproj/argo/releases/latest | jq -r -e '.tag_name')" \
'{kubectl: $kubectl, kops: $kops, helm: $helm, argo: $argo}' > ~/versions.json
fi
shell: bash
- name: kubetcl
run: |
version="$(jq -e -r .kubectl ~/versions.json)"
if [ -n "${{ inputs.kubectl }}" ]; then
version="${{ inputs.kubectl }}"
fi
echo "Installing kubectl $version..."
sudo curl --retry 5 --retry-delay 2 --fail -sL -o /usr/local/bin/kubectl "https://storage.googleapis.com/kubernetes-release/release/$version/bin/linux/amd64/kubectl"
sudo chmod +x /usr/local/bin/kubectl
mkdir -p $HOME/.kube
echo "${{ inputs.kube-config }}" | base64 -d > $HOME/.kube/config
shell: bash
- name: kops
run: |
version="$(jq -e -r .kops ~/versions.json)"
if [ -n "${{ inputs.kops }}" ]; then
version="${{ inputs.kops }}"
fi
echo "Installing kops $version..."
sudo curl --retry 5 --retry-delay 2 --fail -sL -o /usr/local/bin/kops "https://github.com/kubernetes/kops/releases/download/$version/kops-linux-amd64"
sudo chmod +x /usr/local/bin/kops
shell: bash
- name: helm
run: |
version="$(jq -e -r .helm ~/versions.json)"
if [ -n "${{ inputs.helm }}" ]; then
version="${{ inputs.helm }}"
fi
echo "Installing helm $version..."
wget -q "https://get.helm.sh/helm-$version-linux-amd64.tar.gz" -O - | tar -xzO linux-amd64/helm > $HOME/helm
sudo mv $HOME/helm /usr/local/bin/helm
sudo chmod +x /usr/local/bin/helm
shell: bash
- name: render
run: |
sudo curl --retry 5 --retry-delay 2 --fail -sL -o /usr/local/bin/render "https://github.com/VirtusLab/render/releases/download/${{ inputs.render }}/render-linux-amd64"
sudo chmod +x /usr/local/bin/render
shell: bash
- name: aws iam authenticator
run: |
sudo curl --retry 5 --retry-delay 2 --fail -sL -o /usr/local/bin/aws-iam-authenticator "https://amazon-eks.s3-us-west-2.amazonaws.com/${{ inputs.aws-iam-authenticator }}/bin/linux/amd64/aws-iam-authenticator"
sudo chmod +x /usr/local/bin/aws-iam-authenticator
shell: bash
- name: argo
run: |
version="$(jq -e -r .argo ~/versions.json)"
if [ -n "${{ inputs.argo }}" ]; then
version="${{ inputs.argo }}"
fi
echo "Installing argo $version..."
curl --retry 5 --retry-delay 2 -sLO https://github.com/argoproj/argo-workflows/releases/download/$version/argo-linux-amd64.gz
gunzip argo-linux-amd64.gz
sudo mv ./argo-linux-amd64 /usr/local/bin/argo
sudo chmod +x /usr/local/bin/argo
shell: bash