-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTaskfile.yml
71 lines (65 loc) · 2.01 KB
/
Taskfile.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
# https://taskfile.dev
---
version: "3"
includes:
work: ~/code/work/Taskfile.yml
tasks:
default:
desc: List all global tasks
cmds:
- task -g --list
silent: true
# NOTE: tasks below should, if proven useful, be graduated to shell/bin.
# Try keeping this file relatively clean.
get-set-context:
# usage example:
# $ task get-set-context -- staging
#
# first requires something like:
# gcloud auth login
# gcloud config set project xxx
# gcloud components install gke-gcloud-auth-plugin
#
# note: use kubectx to just select between existing contexts
desc: Get and set kubernetes context
cmds:
- gcloud container clusters get-credentials {{ .CLUSTER }}
--zone {{ .CLOUDSDK_COMPUTE_ZONE }}
--project {{ .CLOUDSDK_CORE_PROJECT }}
- kubectl config use-context gke_{{ .CLOUDSDK_CORE_PROJECT }}_{{ .CLOUDSDK_COMPUTE_ZONE }}_{{ .CLUSTER }}
- kubectl config current-context
vars:
CLUSTER:
# get the first argument
sh: echo {{.CLI_ARGS}} | awk '{print $1}'
silent: false
describe-pod:
# example use:
# task describe-pod -- myservice
# note that you can skip the trailing identifier
desc: Describe pod and pipe to fzf
cmds:
- echo '{{.VALUE}}'
vars:
POD:
sh: kubectl get pods | grep {{.CLI_ARGS}} | head -n 1 | awk '{print $1}'
VALUE:
# echo the chosen entry in fzf
sh: echo $(kubectl describe pod {{.POD}} | fzf --reverse)
silent: false
decode-secret:
# example use:
# task decode-secret -- mysecret mykey
desc: Decode base64-encoded secret
cmds:
- echo 'Secret is {{.SECRET}}'
- echo 'Key is {{.KEY}}'
- kubectl get secrets {{.SECRET}} -o jsonpath='{.data}' | jq -r '.'"{{.KEY}}" | base64 --decode
vars:
SECRET:
# get the first argument
sh: echo {{.CLI_ARGS}} | awk '{print $1}'
KEY:
# get the second argument
sh: echo {{.CLI_ARGS}} | awk '{print $2}'
silent: false