Skip to content

Commit

Permalink
fix: add task for updating from the upstream template
Browse files Browse the repository at this point in the history
Signed-off-by: Devin Buhl <[email protected]>
  • Loading branch information
onedr0p committed Nov 29, 2023
1 parent fe56fa0 commit c749ff8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ kubeconfig
*.key
# Ansible
.venv*
# Taskfile
.tasks
19 changes: 19 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -54,10 +56,27 @@ 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?
dir: "{{.BOOTSTRAP_DIR}}"
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 [email protected]: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" }

0 comments on commit c749ff8

Please sign in to comment.