chore: improvements to e2e workflow (#1235)
* chore: improvements to e2e workflow Signed-off-by: Devin Buhl <devin@buhl.casa> * chore: improve taskfiles Signed-off-by: Devin Buhl <devin@buhl.casa> * chore: update taskfiles Signed-off-by: Devin Buhl <devin@buhl.casa> --------- Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
1 parent
94449b8933
commit
83118cfec3
7 files changed
+46
-40
No files matched your search
@@ -1,9 +1,10 @@
|
|||||||
#shellcheck disable=SC2148,SC2155
|
#shellcheck disable=SC2148,SC2155
|
||||||
export KUBECONFIG="$(expand_path ./kubeconfig)"
|
export KUBECONFIG="$(expand_path ./kubeconfig)"
|
||||||
export SOPS_AGE_KEY_FILE="$(expand_path ./age.key)"
|
export SOPS_AGE_KEY_FILE="$(expand_path ./age.key)"
|
||||||
# ansible
|
# Venv
|
||||||
PATH_add "$(expand_path ./.venv/bin)"
|
PATH_add "$(expand_path ./.venv/bin)"
|
||||||
export VIRTUAL_ENV="$(expand_path ./.venv)"
|
export VIRTUAL_ENV="$(expand_path ./.venv)"
|
||||||
|
# Ann Seabelle
|
||||||
export ANSIBLE_COLLECTIONS_PATH=$(expand_path ./.venv/galaxy)
|
export ANSIBLE_COLLECTIONS_PATH=$(expand_path ./.venv/galaxy)
|
||||||
export ANSIBLE_ROLES_PATH=$(expand_path ./.venv/galaxy/ansible_roles)
|
export ANSIBLE_ROLES_PATH=$(expand_path ./.venv/galaxy/ansible_roles)
|
||||||
export ANSIBLE_VARS_ENABLED="host_group_vars"
|
export ANSIBLE_VARS_ENABLED="host_group_vars"
|
||||||
|
|||||||
@@ -76,23 +76,23 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: brew install go-task
|
run: brew install go-task
|
||||||
|
|
||||||
- name: Run Workstation tasks
|
- name: Run Workstation Brew tasks
|
||||||
if: ${{ github.event_name == 'pull_request' && steps.cache-homebrew-packages.outputs.cache-hit != 'true' }}
|
if: ${{ github.event_name == 'pull_request' && steps.cache-homebrew-packages.outputs.cache-hit != 'true' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: task workstation:brew
|
run: task workstation:brew
|
||||||
|
|
||||||
- name: Initialize Direnv
|
- name: Run Workstation venv tasks
|
||||||
shell: bash
|
shell: bash
|
||||||
run: direnv allow .
|
run: task workstation:venv
|
||||||
|
|
||||||
|
- name: Run Workstation direnv tasks
|
||||||
|
shell: bash
|
||||||
|
run: task workstation:direnv
|
||||||
|
|
||||||
- name: Run Sops Age key task
|
- name: Run Sops Age key task
|
||||||
shell: bash
|
shell: bash
|
||||||
run: task sops:age-keygen
|
run: task sops:age-keygen
|
||||||
|
|
||||||
- name: Run setup-virtual-env task
|
|
||||||
shell: bash
|
|
||||||
run: task setup-virtual-env
|
|
||||||
|
|
||||||
- name: Run init tasks
|
- name: Run init tasks
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -102,25 +102,19 @@ jobs:
|
|||||||
export BOOTSTRAP_AGE_PUBLIC_KEY=$(sed -n 's/# public key: //gp' age.key)
|
export BOOTSTRAP_AGE_PUBLIC_KEY=$(sed -n 's/# public key: //gp' age.key)
|
||||||
envsubst < ./bootstrap/vars/config.yaml | sponge ./bootstrap/vars/config.yaml
|
envsubst < ./bootstrap/vars/config.yaml | sponge ./bootstrap/vars/config.yaml
|
||||||
|
|
||||||
- name: Export Env from config.yaml
|
|
||||||
shell: bash
|
|
||||||
id: config-env
|
|
||||||
run: |
|
|
||||||
echo "distribution=$(yq '.bootstrap_distribution' ./bootstrap/vars/config.yaml)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Run configure task
|
- name: Run configure task
|
||||||
shell: bash
|
shell: bash
|
||||||
run: task configure --yes
|
run: task configure --yes
|
||||||
|
|
||||||
- name: Run Talos tasks
|
- name: Run Talos tasks
|
||||||
if: ${{ steps.config-env.outputs.distribution == 'talos' }}
|
if: ${{ startsWith(matrix.config-files, 'talos') }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
task talos:gensecret --yes
|
task talos:gensecret --yes
|
||||||
task talos:genconfig
|
task talos:genconfig
|
||||||
|
|
||||||
- name: Run Ansible tasks
|
- name: Run Ansible tasks
|
||||||
if: ${{ steps.config-env.outputs.distribution == 'k3s' || steps.config-env.outputs.distribution == 'k0s' }}
|
if: ${{ startsWith(matrix.config-files, 'k0s') || startsWith(matrix.config-files, 'k3s') }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
task ansible:deps force=false
|
task ansible:deps force=false
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ tasks:
|
|||||||
|
|
||||||
deps:
|
deps:
|
||||||
desc: Set up Ansible dependencies
|
desc: Set up Ansible dependencies
|
||||||
deps: [":setup-virtual-env"]
|
deps: [":workstation:venv"]
|
||||||
cmds:
|
cmds:
|
||||||
- .venv/bin/python3 -m pip install --upgrade --requirement "{{.ANSIBLE_PIP_REQUIREMENTS_FILE}}"
|
- .venv/bin/python3 -m pip install --upgrade --requirement "{{.ANSIBLE_PIP_REQUIREMENTS_FILE}}"
|
||||||
- .venv/bin/ansible-galaxy install --role-file "{{.ANSIBLE_REQUIREMENTS_FILE}}" {{if eq .force "true"}}--force{{end}}
|
- .venv/bin/ansible-galaxy install --role-file "{{.ANSIBLE_REQUIREMENTS_FILE}}" {{if eq .force "true"}}--force{{end}}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ tasks:
|
|||||||
cmd: bash {{.KUBECONFORM_SCRIPT}} {{.KUBERNETES_DIR}}
|
cmd: bash {{.KUBECONFORM_SCRIPT}} {{.KUBERNETES_DIR}}
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing kubeconform script", sh: "test -f {{.KUBECONFORM_SCRIPT}}" }
|
- { msg: "Missing kubeconform script", sh: "test -f {{.KUBECONFORM_SCRIPT}}" }
|
||||||
|
- { msg: "Missing kubernetes directory", sh: "test -d {{.KUBERNETES_DIR}}" }
|
||||||
|
|
||||||
.reset:
|
.reset:
|
||||||
internal: true
|
internal: true
|
||||||
|
|||||||
@@ -8,6 +8,26 @@ vars:
|
|||||||
|
|
||||||
tasks:
|
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 {{.ROOT_DIR}}/.venv"
|
||||||
|
- .venv/bin/python3 -m pip install --upgrade pip setuptools wheel
|
||||||
|
- .venv/bin/python3 -m pip install --upgrade --requirement "{{.PIP_REQUIREMENTS_FILE}}"
|
||||||
|
sources:
|
||||||
|
- "{{.PIP_REQUIREMENTS_FILE}}"
|
||||||
|
generates:
|
||||||
|
- "{{.ROOT_DIR}}/.venv/pyvenv.cfg"
|
||||||
|
preconditions:
|
||||||
|
- { msg: "Missing Pip requirements file", sh: "test -f {{.PIP_REQUIREMENTS_FILE}}" }
|
||||||
|
|
||||||
brew:
|
brew:
|
||||||
desc: Install workstation dependencies with Brew
|
desc: Install workstation dependencies with Brew
|
||||||
cmd: brew bundle --file {{.BREWFILE}}
|
cmd: brew bundle --file {{.BREWFILE}}
|
||||||
|
|||||||
@@ -173,8 +173,6 @@ Once you have installed Talos or Debian on your nodes, there are six stages to g
|
|||||||
|
|
||||||
2. Install the most recent version of [direnv](https://direnv.net/), see the [installation docs](https://direnv.net/docs/installation.html) for other supported platforms.
|
2. Install the most recent version of [direnv](https://direnv.net/), see the [installation docs](https://direnv.net/docs/installation.html) for other supported platforms.
|
||||||
|
|
||||||
📍 _After installing `direnv` be sure to **[hook it into your shell](https://direnv.net/docs/hook.html)** and after that is done run `direnv allow` while in your repos' directory._
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Homebrew
|
# Homebrew
|
||||||
brew install direnv
|
brew install direnv
|
||||||
@@ -182,7 +180,11 @@ Once you have installed Talos or Debian on your nodes, there are six stages to g
|
|||||||
yay -S direnv
|
yay -S direnv
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Install **required** CLI tools: [age](https://github.com/FiloSottile/age), [cloudflared](https://github.com/cloudflare/cloudflared), [flux](https://toolkit.fluxcd.io/), [kubeconform](https://github.com/yannh/kubeconform), [kubectl](https://kubectl.docs.kubernetes.io/installation/), [kustomize](https://kubectl.docs.kubernetes.io/installation/), [sops](https://github.com/getsops/sops). [k0sctl](https://github.com/k0sproject/k0sctl) is required for k0s. [talosctl](https://www.talos.dev/latest/learn-more/talosctl/) and [talhelper](https://github.com/budimanjojo/talhelper) is required for Talos.
|
📍 _After `direnv` is installed be sure to **[hook it into your preferred shell](https://direnv.net/docs/hook.html)** and then run `task workstation:direnv`_
|
||||||
|
|
||||||
|
3. Install **required** CLI tools: [age](https://github.com/FiloSottile/age), [cloudflared](https://github.com/cloudflare/cloudflared), [flux](https://toolkit.fluxcd.io/), [kubeconform](https://github.com/yannh/kubeconform), [kubectl](https://kubectl.docs.kubernetes.io/installation/), [kustomize](https://kubectl.docs.kubernetes.io/installation/), [sops](https://github.com/getsops/sops).
|
||||||
|
|
||||||
|
📍 _[k0sctl](https://github.com/k0sproject/k0sctl) is required for k0s. [talosctl](https://www.talos.dev/latest/learn-more/talosctl/) and [talhelper](https://github.com/budimanjojo/talhelper) is required for Talos._
|
||||||
|
|
||||||
📍 _Not using Homebrew or ArchLinux? Make sure to look up how to install the latest version of each of these CLI tools and install them._
|
📍 _Not using Homebrew or ArchLinux? Make sure to look up how to install the latest version of each of these CLI tools and install them._
|
||||||
|
|
||||||
@@ -193,12 +195,12 @@ Once you have installed Talos or Debian on your nodes, there are six stages to g
|
|||||||
go-task workstation:yay
|
go-task workstation:yay
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Setup a Python virual env by running the following task command.
|
4. Setup a Python virual environment by running the following task command.
|
||||||
|
|
||||||
📍 _This commands requires Python 3.11+ to be installed._
|
📍 _This commands requires Python 3.11+ to be installed._
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
task setup-virtual-env
|
task workstation:venv
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Continue on to 🔧 [**Stage 3**](#-stage-3-do-bootstrap-configuration)
|
5. Continue on to 🔧 [**Stage 3**](#-stage-3-do-bootstrap-configuration)
|
||||||
|
|||||||
+6
-18
@@ -37,8 +37,7 @@ tasks:
|
|||||||
default: task -l
|
default: task -l
|
||||||
|
|
||||||
init:
|
init:
|
||||||
desc: Initialize virtual env and configuration files
|
desc: Initialize configuration files
|
||||||
deps: ["setup-virtual-env"]
|
|
||||||
cmds:
|
cmds:
|
||||||
- mkdir -p {{.PRIVATE_DIR}}
|
- mkdir -p {{.PRIVATE_DIR}}
|
||||||
- cp -n {{.BOOTSTRAP_ADDONS_FILE | replace ".yaml" ".sample.yaml"}} {{.BOOTSTRAP_ADDONS_FILE}}
|
- cp -n {{.BOOTSTRAP_ADDONS_FILE | replace ".yaml" ".sample.yaml"}} {{.BOOTSTRAP_ADDONS_FILE}}
|
||||||
@@ -51,33 +50,22 @@ tasks:
|
|||||||
silent: true
|
silent: true
|
||||||
- cmd: echo {{.BOOTSTRAP_ADDONS_FILE}}
|
- cmd: echo {{.BOOTSTRAP_ADDONS_FILE}}
|
||||||
silent: true
|
silent: true
|
||||||
|
status:
|
||||||
|
- test -f "{{.BOOTSTRAP_ADDONS_FILE}}"
|
||||||
|
- test -f "{{.BOOTSTRAP_CONFIG_FILE}}"
|
||||||
|
|
||||||
configure:
|
configure:
|
||||||
desc: Configure repository from bootstrap vars
|
desc: Configure repository from bootstrap vars
|
||||||
prompt: Any conflicting config in the root kubernetes and ansible directories will be overwritten... continue?
|
prompt: Any conflicting config in the root kubernetes and ansible directories will be overwritten... continue?
|
||||||
deps: ["setup-virtual-env"]
|
deps: ["workstation:direnv", "workstation:venv", "sops:age-keygen", "init"]
|
||||||
cmds:
|
cmds:
|
||||||
- task: .template
|
- task: .template
|
||||||
- task: sops:encrypt
|
- task: sops:encrypt
|
||||||
- task: .validate
|
- task: .validate
|
||||||
|
|
||||||
setup-virtual-env:
|
|
||||||
desc: Set up virtual environment
|
|
||||||
cmds:
|
|
||||||
- "{{.PYTHON_BIN}} -m venv {{.ROOT_DIR}}/.venv"
|
|
||||||
- .venv/bin/python3 -m pip install --upgrade pip setuptools wheel
|
|
||||||
- .venv/bin/python3 -m pip install --upgrade --requirement "{{.PIP_REQUIREMENTS_FILE}}"
|
|
||||||
sources:
|
|
||||||
- "{{.PIP_REQUIREMENTS_FILE}}"
|
|
||||||
generates:
|
|
||||||
- "{{.ROOT_DIR}}/.venv/pyvenv.cfg"
|
|
||||||
preconditions:
|
|
||||||
- { msg: "Missing Pip requirements file", sh: "test -f {{.PIP_REQUIREMENTS_FILE}}" }
|
|
||||||
|
|
||||||
.template:
|
.template:
|
||||||
internal: true
|
internal: true
|
||||||
cmds:
|
cmd: ./.venv/bin/makejinja
|
||||||
- ./.venv/bin/makejinja
|
|
||||||
preconditions:
|
preconditions:
|
||||||
- { msg: "Missing virtual environment", sh: "test -d {{.ROOT_DIR}}/.venv" }
|
- { msg: "Missing virtual environment", sh: "test -d {{.ROOT_DIR}}/.venv" }
|
||||||
- { msg: "Missing Makejinja config file", sh: "test -f {{.MAKEJINJA_CONFIG_FILE}}" }
|
- { msg: "Missing Makejinja config file", sh: "test -f {{.MAKEJINJA_CONFIG_FILE}}" }
|
||||||
|
|||||||
Reference in new issue
Block a user