Skip to content

Commit

Permalink
Merge MR 'feat: add GL Runner mgmt script' into 'main'
Browse files Browse the repository at this point in the history
See merge request el-capitano/dotfiles!456
  • Loading branch information
tmeijn committed Jan 8, 2025
2 parents fc5bf9f + 2ac52e6 commit 72e4b34
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 6 deletions.
2 changes: 2 additions & 0 deletions chezmoi/.chezmoi.toml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ args = [
"-c",
"cp {{ "{{ .Target }}" }} {{ "{{ .Target }}" }}.base && code --new-window --wait --merge {{ "{{ .Destination }}" }} {{ "{{ .Target }}" }} {{ "{{ .Target }}" }}.base {{ "{{ .Source }}" }}",
]
[diff]
pager = "diffnav"
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ chmod +x aqua-installer

rm './aqua-installer'

echo "Setting Aqua environment variables..."
export AQUA_ROOT_DIR="${XDG_DATA_HOME:-$HOME/.local/share/aquaproj-aqua}"
export PATH="${AQUA_ROOT_DIR}/bin:$PATH"
export AQUA_GLOBAL_CONFIG=${AQUA_GLOBAL_CONFIG:-${XDG_CONFIG_HOME:-$HOME/.config}/aquaproj-aqua/aqua.yaml}
export AQUA_GENERATE_WITH_DETAIL=true

echo "Installing global tools with Aqua..."
aqua install --all
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ echo ""
echo "Installing Git as Mise needs that as dependency"
sudo apt install git -y

curl https://mise.run/ | sh
wget -qO- https://mise.run/ | sh

echo "Installing dependencies for building Python..."
sudo apt-get update
Expand Down
36 changes: 35 additions & 1 deletion chezmoi/ansible/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
- gnome-tweaks
- graphviz
- gtk2-engines-murrine
- incus
- jc
- kitty # Our terminal!
- nala
Expand Down Expand Up @@ -173,6 +172,41 @@
- docker.service
- containerd.service

- name: "[BLOCK] Add repo, install and configure Incus"
block:
- name: Add Incus's official GPG key
ansible.builtin.apt_key:
url: https://pkgs.zabbly.com/key.asc
keyring: /etc/apt/keyrings/zabbly.asc
state: present
- name: Add Incus repository
ansible.builtin.apt_repository:
repo: >-
Enabled: yes
Types: deb
URIs: https://pkgs.zabbly.com/incus/stable
Suites: noble
Components: main
Architectures: {{ arch_mapping[ansible_architecture] | default(ansible_architecture) }}
Signed-By: /etc/apt/keyrings/zabbly.asc
filename: incus
state: present
- name: Install Incus and related packages
ansible.builtin.apt:
pkg:
- incus
state: present
update_cache: true
- name: Add incus-admin group
ansible.builtin.group:
name: incus-admin
state: present
- name: Add user to incus-admin group
ansible.builtin.user:
name: "{{ ansible_user }}"
groups: incus-admin
append: true

# === NOTE: This is currently not working on Ubuntu Asahi
# - name: "[BLOCK] Add repo, install and configure Firefox"
# block:
Expand Down
6 changes: 6 additions & 0 deletions chezmoi/dot_bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ export PATH="$HOME/.cargo/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/bin:$PATH"

# Add Aqua variables
export AQUA_ROOT_DIR="${XDG_DATA_HOME:-$HOME/.local/share/aquaproj-aqua}"
export PATH="${AQUA_ROOT_DIR}/bin:$PATH"
export AQUA_GLOBAL_CONFIG=${AQUA_GLOBAL_CONFIG:-${XDG_CONFIG_HOME:-$HOME/.config}/aquaproj-aqua/aqua.yaml}
export AQUA_GENERATE_WITH_DETAIL=true

# Activate Mise: https://github.com/jdx/mise.
if command -v mise &> /dev/null; then
eval "$(mise activate bash)"
Expand Down
12 changes: 12 additions & 0 deletions chezmoi/dot_config/aquaproj-aqua/aqua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,15 @@ packages:
- name: itaysk/kubectl-neat@v2.0.4
description: Clean up Kubernetes yaml and json output to make it readable
link: https://github.com/itaysk/kubectl-neat
- name: Lifailon/lazyjournal@0.6.0
description: TUI for journalctl, file system logs, as well Docker and Podman containers for quick viewing and filtering with fuzzy find, regex support (like fzf and grep) and coloring the output, written in Go with the gocui library
link: https://github.com/Lifailon/lazyjournal
- name: robinovitch61/kl@v0.5.0
description: An interactive Kubernetes log viewer for your terminal
link: https://github.com/robinovitch61/kl
- name: Canop/rhit@v2.0.3
description: A nginx log explorer
link: https://github.com/Canop/rhit
- name: Automattic/harper/harper-ls@v0.14.0
description: The Grammar Checker for Developers
link: https://github.com/Automattic/harper
4 changes: 0 additions & 4 deletions chezmoi/dot_config/fish/conf.d/20_aliases.fish
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ alias tfplan='terraform plan -out=plan.tfplan'
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
alias cb='flatpak run app.getclipboard.Clipboard'

# Provision Hetzner GitLab Runners using scheduled pipelines trigger
alias gl_runner_up='glab -R el-capitano/operations/hetzner-cloud-runners schedule run 2691862'
alias gl_runner_down='glab -R el-capitano/operations/hetzner-cloud-runners schedule run 383558'
30 changes: 30 additions & 0 deletions chezmoi/dot_config/fish/functions/gl_runner.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# set -g gl_runner_optspec 'b/backend=' no-plan

function gl_runner --description 'Manage the Hetzner Cloud Runner.'
set -l up_schedule_id '2691862'
set -l down_schedule_id '383558'
set -l project_path 'el-capitano/operations/hetzner-cloud-runners'

if test -z $argv
echo "No command given: set either 'up' or 'down'"
return 1
end

set -l action $argv[1]

if test $action = "up"
echo "Starting runner..."
glab -R $project_path schedule run $up_schedule_id
else if test $action = "down"
echo "Stopping runner..."
glab -R $project_path schedule run $down_schedule_id

else
echo "Unknown command, set either 'up' or 'down'"
return 1
end


sleep 5 # Pipeline creation is async, so we wait...
glab -R $project_path ci status -b main --live --compact
end

0 comments on commit 72e4b34

Please sign in to comment.