Files
home-cluster/.taskfiles/Workstation/Taskfile.yaml
T
2024-02-02 18:02:14 -05:00

71 lines
2.8 KiB
YAML

---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
ARCHFILE: "{{.ROOT_DIR}}/.taskfiles/Workstation/Archfile"
BREWFILE: "{{.ROOT_DIR}}/.taskfiles/Workstation/Brewfile"
GENERIC_BIN_DIR: "{{.ROOT_DIR}}/.bin"
tasks:
direnv:
desc: Run direnv hooks
cmd: direnv allow .
status:
- "[[ $(direnv status --json | jq '.state.foundRC.allowed') == 0 ]]"
- "[[ $(direnv status --json | jq '.state.loadedRC.allowed') == 0 ]]"
venv:
desc: Set up virtual environment
cmds:
- "{{.PYTHON_BIN}} -m venv {{.VIRTUAL_ENV}}"
- '{{.VIRTUAL_ENV}}/bin/python3 -m pip install --upgrade pip setuptools wheel'
- '{{.VIRTUAL_ENV}}/bin/python3 -m pip install --upgrade --requirement "{{.PIP_REQUIREMENTS_FILE}}"'
sources:
- "{{.PIP_REQUIREMENTS_FILE}}"
generates:
- "{{.VIRTUAL_ENV}}/pyvenv.cfg"
preconditions:
- { msg: "Missing Pip requirements file", sh: "test -f {{.PIP_REQUIREMENTS_FILE}}" }
brew:
desc: Install workstation dependencies with Brew
cmd: brew bundle --file {{.BREWFILE}}
preconditions:
- { msg: "Missing Homebrew", sh: "command -v brew" }
- { msg: "Missing Brewfile", sh: "test -f {{.BREWFILE}}" }
arch:
desc: Install Arch workstation dependencies with Paru Or Yay
cmd: "{{.helper}} -Syu --needed --noconfirm --noprogressbar $(cat {{.ARCHFILE}} | xargs)"
vars:
helper:
sh: "command -v yay || command -v paru"
preconditions:
- { msg: "Missing Archfile", sh: "test -f {{.ARCHFILE}}" }
generic-linux:
desc: Install CLI tools into the projects .bin directory using curl
dir: "{{.GENERIC_BIN_DIR}}"
platforms: ["linux/amd64", "linux/arm64"]
cmds:
- for:
- budimanjojo/talhelper?as=talhelper&type=script
- cloudflare/cloudflared?as=cloudflared&type=script
- FiloSottile/age?as=age&type=script
- fluxcd/flux2?as=flux&type=script
- getsops/sops?as=sops&type=script
- jqlang/jq?as=jq&type=script
- kubernetes-sigs/kustomize?as=kustomize&type=script
- siderolabs/talos?as=talosctl&type=script
- yannh/kubeconform?as=kubeconform&type=script
- mikefarah/yq?as=yq&type=script
cmd: curl -fsSL "https://i.jpillora.com/{{.ITEM}}" | bash
- cmd: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
platforms: ["linux/amd64"]
- cmd: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl"
platforms: ["linux/arm64"]
- cmd: chmod +x kubectl
- cmd: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | USE_SUDO="false" HELM_INSTALL_DIR="." bash