fix: add task for updating from the upstream template

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl committed 2023-11-29 16:07:50 -05:00
1 parent fe56fa0653
commit c749ff8f90
2 files changed
+21

No files matched your search

+2
View File
@@ -10,3 +10,5 @@ kubeconfig
*.key
# Ansible
.venv*
# Taskfile
.tasks
+19
View File
@@ -28,6 +28,7 @@ tasks:
deps:
desc: Create a Python virtual env and install required packages
summary: task {{.TASK}}
cmds:
- "{{.PYTHON_BIN}} -m venv {{.ROOT_DIR}}/.venv"
- .venv/bin/python3 -m pip install --upgrade pip setuptools wheel
@@ -36,6 +37,7 @@ tasks:
init:
desc: Initialize configuration files
summary: task {{.TASK}}
dir: "{{.BOOTSTRAP_DIR}}"
cmds:
- cp -n vars/addons.sample.yaml vars/addons.yaml
@@ -54,6 +56,7 @@ tasks:
configure:
desc: Configure repository from Ansible vars
summary: task {{.TASK}}
# TODO: Only prompt when directories exist
# https://github.com/go-task/task/issues/1330
prompt: Any conflicting config in the root kubernetes and ansible directories will be overwritten... continue?
@@ -61,3 +64,19 @@ tasks:
cmd: ansible-playbook configure.yaml
env:
ANSIBLE_DISPLAY_SKIPPED_HOSTS: "false"
update-template:
desc: Update from the upstream flux-cluster-template repository
summary: task {{.TASK}}
cmds:
- mkdir -p $(dirname {{.shafile}})
- touch {{.shafile}}
- git remote get-url template >/dev/null 2>&1 || git remote add template git@github.com:onedr0p/flux-cluster-template
- git fetch --all
- git cherry-pick --no-commit --allow-empty $(cat {{.shafile}})..template/main
- git ls-remote template HEAD | awk '{ print $1}' > {{.shafile}}
vars:
shafile: "{{.ROOT_DIR}}/.tasks/.latest-template.sha"
preconditions:
- { msg: "Git repository not up-to-date", sh: "git diff --exit-code" }
- { msg: "Git repository not up-to-date", sh: "git diff --cached --exit-code" }