Compare commits
7 Commits
51c2543d73
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b109026213 | ||
|
|
5e9ccebe4f | ||
|
|
b3943566b5 | ||
|
|
418f39d0b9 | ||
|
|
632f47c4a1 | ||
| f1f8f212b5 | |||
| 012a87eddc |
24
Makefile
24
Makefile
@@ -42,10 +42,28 @@ vscodium:
|
|||||||
cp vscodium/keybindings.json ~/.config/VSCodium/User/keybindings.json
|
cp vscodium/keybindings.json ~/.config/VSCodium/User/keybindings.json
|
||||||
|
|
||||||
toolbox create --image $(REPOSITORY):latest vscodium-setup-temp
|
toolbox create --image $(REPOSITORY):latest vscodium-setup-temp
|
||||||
toolbox run --container vscodium-setup-temp bash $(PWD)/vscodium/extensions.bash
|
toolbox run --container=vscodium-setup-temp codium --install-extension="tamasfe.even-better-toml"
|
||||||
|
toolbox run --container=vscodium-setup-temp codium --install-extension="samuelcolvin.jinjahtml"
|
||||||
|
toolbox run --container=vscodium-setup-temp codium --install-extension="yzhang.markdown-all-in-one"
|
||||||
|
toolbox run --container=vscodium-setup-temp codium --install-extension="streetsidesoftware.code-spell-checker"
|
||||||
|
toolbox run --container=vscodium-setup-temp codium --install-extension="github.vscode-github-actions"
|
||||||
|
toolbox run --container=vscodium-setup-temp codium --install-extension="redhat.vscode-yaml"
|
||||||
|
toolbox run --container=vscodium-setup-temp codium --install-extension="ms-python.debugpy"
|
||||||
|
toolbox run --container=vscodium-setup-temp codium --install-extension="ms-python.python"
|
||||||
|
toolbox run --container=vscodium-setup-temp codium --install-extension="detachhead.basedpyright"
|
||||||
|
toolbox run --container=vscodium-setup-temp codium --install-extension="opentofu.vscode-opentofu"
|
||||||
|
toolbox run --container=vscodium-setup-temp codium --install-extension="golang.go"
|
||||||
|
toolbox run --container=vscodium-setup-temp codium --update-extensions
|
||||||
podman stop vscodium-setup-temp
|
podman stop vscodium-setup-temp
|
||||||
podman rm vscodium-setup-temp
|
podman rm vscodium-setup-temp
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: act-runner
|
||||||
install: toolbox shell vscodium;
|
act-runner:
|
||||||
|
systemctl enable libvirtd --now
|
||||||
|
mkdir --parents ~/.local/share/act-runner
|
||||||
|
cp act-runner/act-runner.bu ~/.local/share/act-runner/act-runner.bu
|
||||||
|
bash act-runner/rebuild.bash $(HOME)/.local/share/act-runner
|
||||||
|
|
||||||
|
.PHONY: install
|
||||||
|
install: toolbox shell vscodium act-runner;
|
||||||
|
|
||||||
|
|||||||
131
act-runner/act-runner.bu
Normal file
131
act-runner/act-runner.bu
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
---
|
||||||
|
variant: fcos
|
||||||
|
version: 1.6.0
|
||||||
|
|
||||||
|
passwd:
|
||||||
|
users:
|
||||||
|
- name: root
|
||||||
|
ssh_authorized_keys: []
|
||||||
|
|
||||||
|
- name: core
|
||||||
|
groups:
|
||||||
|
- docker
|
||||||
|
ssh_authorized_keys_local:
|
||||||
|
- core_ssh_keys.pub
|
||||||
|
|
||||||
|
systemd:
|
||||||
|
units:
|
||||||
|
- name: docker-image-prune.service
|
||||||
|
enabled: false
|
||||||
|
contents: |
|
||||||
|
[Unit]
|
||||||
|
Description=Remove unused images from Docker
|
||||||
|
Wants=docker.socket
|
||||||
|
After=docker.socket
|
||||||
|
After=docker.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=docker image prune --force --all --filter 'reference!="catthehacker/ubuntu"'
|
||||||
|
ExecStart=docker builder prune --force
|
||||||
|
RemainAfterExit=no
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
|
- name: docker-image-prune.timer
|
||||||
|
enabled: true
|
||||||
|
contents: |
|
||||||
|
[Unit]
|
||||||
|
Description=Start docker-image-prune every day
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnBootSec=30min
|
||||||
|
OnUnitActiveSec=1d
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
|
|
||||||
|
storage:
|
||||||
|
files:
|
||||||
|
- path: /etc/hostname
|
||||||
|
mode: 0644
|
||||||
|
overwrite: true
|
||||||
|
contents:
|
||||||
|
local: hostname
|
||||||
|
|
||||||
|
- path: /etc/ssh/sshd_config.d/99-custom.conf
|
||||||
|
mode: 0644
|
||||||
|
user:
|
||||||
|
name: root
|
||||||
|
group:
|
||||||
|
name: root
|
||||||
|
contents:
|
||||||
|
inline: |
|
||||||
|
UseDNS no
|
||||||
|
PermitRootLogin no
|
||||||
|
AllowUsers core@*
|
||||||
|
AuthenticationMethods publickey
|
||||||
|
HostKey /etc/ssh/ssh_host_rsa_key
|
||||||
|
HostKey /etc/ssh/ssh_host_ed25519_key
|
||||||
|
HostKey /etc/ssh/ssh_host_ecdsa_key
|
||||||
|
|
||||||
|
- path: /etc/ssh/ssh_host_rsa_key
|
||||||
|
mode: 0600
|
||||||
|
overwrite: true
|
||||||
|
user:
|
||||||
|
name: root
|
||||||
|
group:
|
||||||
|
name: root
|
||||||
|
contents:
|
||||||
|
local: host_keys/ssh_rsa
|
||||||
|
|
||||||
|
- path: /etc/ssh/ssh_host_rsa_key.pub
|
||||||
|
mode: 0644
|
||||||
|
overwrite: true
|
||||||
|
user:
|
||||||
|
name: root
|
||||||
|
group:
|
||||||
|
name: root
|
||||||
|
contents:
|
||||||
|
local: host_keys/ssh_rsa.pub
|
||||||
|
|
||||||
|
- path: /etc/ssh/ssh_host_ed25519_key
|
||||||
|
mode: 0600
|
||||||
|
overwrite: true
|
||||||
|
user:
|
||||||
|
name: root
|
||||||
|
group:
|
||||||
|
name: root
|
||||||
|
contents:
|
||||||
|
local: host_keys/ssh_ed25519
|
||||||
|
|
||||||
|
- path: /etc/ssh/ssh_host_ed25519_key.pub
|
||||||
|
mode: 0644
|
||||||
|
overwrite: true
|
||||||
|
user:
|
||||||
|
name: root
|
||||||
|
group:
|
||||||
|
name: root
|
||||||
|
contents:
|
||||||
|
local: host_keys/ssh_ed25519.pub
|
||||||
|
|
||||||
|
- path: /etc/ssh/ssh_host_ecdsa_key
|
||||||
|
mode: 0600
|
||||||
|
overwrite: true
|
||||||
|
user:
|
||||||
|
name: root
|
||||||
|
group:
|
||||||
|
name: root
|
||||||
|
contents:
|
||||||
|
local: host_keys/ssh_ecdsa
|
||||||
|
|
||||||
|
- path: /etc/ssh/ssh_host_ecdsa_key.pub
|
||||||
|
mode: 0644
|
||||||
|
overwrite: true
|
||||||
|
user:
|
||||||
|
name: root
|
||||||
|
group:
|
||||||
|
name: root
|
||||||
|
contents:
|
||||||
|
local: host_keys/ssh_ecdsa.pub
|
||||||
106
act-runner/rebuild.bash
Normal file
106
act-runner/rebuild.bash
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "ERROR: Specify config path"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONFIG_PATH="${1}"
|
||||||
|
|
||||||
|
if [ ! -f "${CONFIG_PATH}/act-runner.bu" ]; then
|
||||||
|
echo "ERROR: Config path ${CONFIG_PATH} must include the act-runner.bu file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
NAME="${HOSTNAME}-act-runner"
|
||||||
|
STREAM="stable"
|
||||||
|
BUTANE_CONFIG="${CONFIG_PATH}/act-runner.bu"
|
||||||
|
VCPUS="8"
|
||||||
|
RAM_MB="16132"
|
||||||
|
DISK_GB="100"
|
||||||
|
SSH_KEY="${HOME}/.ssh/_${HOSTNAME}_act_runner_ed25519"
|
||||||
|
|
||||||
|
IGNITION_PATH="${CONFIG_PATH}/${NAME}.ign"
|
||||||
|
IMAGE_PATH="${CONFIG_PATH}/${NAME}.qcow2"
|
||||||
|
DOWNLOAD_PATH="$(mktemp -d)"
|
||||||
|
KVM="qemu:///session"
|
||||||
|
|
||||||
|
if ! systemctl is-active libvirtd --quiet; then
|
||||||
|
systemctl start libvirtd
|
||||||
|
fi
|
||||||
|
|
||||||
|
all_vms=$(virsh --connect="${KVM}" list --all)
|
||||||
|
|
||||||
|
if [[ $all_vms == *"${NAME}"* ]]; then
|
||||||
|
running_vms=$(virsh --connect="$KVM" list)
|
||||||
|
if [[ $running_vms == *"${NAME}"* ]]; then
|
||||||
|
echo "Shutting down VM ${NAME}..."
|
||||||
|
virsh --connect="${KVM}" destroy "${NAME}"
|
||||||
|
fi
|
||||||
|
echo "Destroying VM ${NAME}..."
|
||||||
|
virsh --connect="${KVM}" undefine --domain="${NAME}" --remove-all-storage --managed-save
|
||||||
|
echo "Deleting image ${IMAGE_PATH}..."
|
||||||
|
rm -rf "${IMAGE_PATH}"
|
||||||
|
echo "Deleting ignition file ${IGNITION_PATH}..."
|
||||||
|
rm "${IGNITION_PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
podman run \
|
||||||
|
--rm \
|
||||||
|
-v "${DOWNLOAD_PATH}:/data:z" \
|
||||||
|
-w /data \
|
||||||
|
quay.io/coreos/coreos-installer:release \
|
||||||
|
download -s "${STREAM}" -p qemu -f qcow2.xz --decompress
|
||||||
|
|
||||||
|
download_image=$(command ls "${DOWNLOAD_PATH}"/*.qcow2)
|
||||||
|
|
||||||
|
mv "${download_image}" "${IMAGE_PATH}"
|
||||||
|
|
||||||
|
echo "${HOSTNAME}-act-runner" >"${CONFIG_PATH}/hostname"
|
||||||
|
|
||||||
|
if [ ! -f "${SSH_KEY}" ]; then
|
||||||
|
ssh-keygen -q -f "${SSH_KEY}" -t ed25519 -C "${USERNAME}@${HOSTNAME}-act-runner" -N ''
|
||||||
|
fi
|
||||||
|
cp "${SSH_KEY}.pub" "${CONFIG_PATH}/core_ssh_keys.pub"
|
||||||
|
|
||||||
|
mkdir --parents "${CONFIG_PATH}/host_keys"
|
||||||
|
|
||||||
|
key_formats=(
|
||||||
|
"rsa"
|
||||||
|
"ed25519"
|
||||||
|
"ecdsa"
|
||||||
|
)
|
||||||
|
|
||||||
|
for key in "${key_formats[@]}"; do
|
||||||
|
if [ ! -f "${CONFIG_PATH}/host_keys/ssh_${key}" ]; then
|
||||||
|
ssh-keygen -q \
|
||||||
|
-f "${CONFIG_PATH}/host_keys/ssh_${key}" \
|
||||||
|
-t "${key}" \
|
||||||
|
-C "${HOSTNAME}-act-runner" \
|
||||||
|
-N ''
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
podman run \
|
||||||
|
--interactive \
|
||||||
|
--rm \
|
||||||
|
-v "${CONFIG_PATH}:/data:z" \
|
||||||
|
quay.io/coreos/butane:release \
|
||||||
|
--pretty --strict --files-dir=/data < "${BUTANE_CONFIG}" > "${IGNITION_PATH}"
|
||||||
|
|
||||||
|
chcon --verbose --type svirt_home_t "${IGNITION_PATH}"
|
||||||
|
|
||||||
|
virt-install \
|
||||||
|
--connect="${KVM}" \
|
||||||
|
--name="${NAME}" \
|
||||||
|
--vcpus="${VCPUS}" \
|
||||||
|
--memory="${RAM_MB}" \
|
||||||
|
--os-variant="fedora-coreos-${STREAM}" \
|
||||||
|
--import \
|
||||||
|
--noautoconsole \
|
||||||
|
--graphics=none \
|
||||||
|
--disk="size=${DISK_GB},backing_store=${IMAGE_PATH}" \
|
||||||
|
--network bridge=virbr0 \
|
||||||
|
--qemu-commandline="-fw_cfg name=opt/com.coreos/config,file=${IGNITION_PATH}"
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
alias fuck='sudo $(history -p \!\!)'
|
alias fuck='sudo $(history -p \!\!)'
|
||||||
alias cls='clear'
|
alias cls='clear'
|
||||||
alias ls='/usr/bin/ls -lshF --color --group-directories-first --time-style=long-iso'
|
alias ls='/usr/bin/ls -lshF --color --group-directories-first --time-style=long-iso'
|
||||||
alias gmtime='/usr/bin/date -u --iso-8601=seconds'
|
alias gmtime='command -u --iso-8601=seconds'
|
||||||
alias date='/usr/bin/date --iso-8601=seconds'
|
alias date='command --iso-8601=seconds'
|
||||||
alias whatismyip='curl https://icanhazip.com/'
|
alias whatismyip='curl https://icanhazip.com/'
|
||||||
alias uuid="python3 -c 'import uuid; print(uuid.uuid4());'"
|
alias uuid="python3 -c 'import uuid; print(uuid.uuid4());'"
|
||||||
alias epoch="python3 -c 'import time; print(time.time());'"
|
alias epoch="command date +%s"
|
||||||
alias uptime="command uptime --pretty"
|
alias uptime="command uptime --pretty"
|
||||||
alias doc='cd ~/Documents'
|
alias doc='cd ~/Documents'
|
||||||
alias dn='cd ~/Downloads'
|
alias dn='cd ~/Downloads'
|
||||||
@@ -15,4 +15,5 @@ alias psync="poetry install --sync"
|
|||||||
alias code='codium'
|
alias code='codium'
|
||||||
alias ssh='ssh -F ~/.ssh/config'
|
alias ssh='ssh -F ~/.ssh/config'
|
||||||
alias whereami='echo $LOCATION'
|
alias whereami='echo $LOCATION'
|
||||||
alias gg='dev'
|
alias gg='dev'
|
||||||
|
alias bk='cd -'
|
||||||
|
|||||||
32
shell/scripts.d/50-act.sh
Normal file
32
shell/scripts.d/50-act.sh
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
function start-act-runner() {
|
||||||
|
if ! systemctl is-active libvirtd --quiet; then
|
||||||
|
systemctl start libvirtd
|
||||||
|
fi
|
||||||
|
|
||||||
|
running_vms=$(virsh --connect=qemu:///session list)
|
||||||
|
if [[ "$running_vms" != *"${HOSTNAME}-act-runner"* ]]; then
|
||||||
|
echo "Sarting ACT runner '${HOSTNAME}-act-runner'..."
|
||||||
|
virsh --connect=qemu:///session start --domain="${HOSTNAME}-act-runner" && sleep 15
|
||||||
|
fi
|
||||||
|
|
||||||
|
_configure_act_alias
|
||||||
|
}
|
||||||
|
|
||||||
|
function _configure_act_alias() {
|
||||||
|
if systemctl is-active libvirtd --quiet; then
|
||||||
|
running_vms=$(virsh --connect=qemu:///session list)
|
||||||
|
if [[ "$running_vms" = *"${HOSTNAME}-act-runner"* ]]; then
|
||||||
|
export ACT_RUNNER_MAC=$(virsh --connect="qemu:///session" domiflist "${HOSTNAME}-act-runner" | awk '{ print $5 }' | tail -2 | head -1)
|
||||||
|
export ACT_RUNNER_IP=$(arp -a | grep $ACT_RUNNER_MAC | awk '{ print $2 }' | sed 's/[()]//g')
|
||||||
|
export ACT_SOURCE_IP="$(echo $ACT_RUNNER_IP | cut -d '.' -f -3).1"
|
||||||
|
export ACT_DOCKER_HOST="ssh://core@$ACT_RUNNER_IP:22"
|
||||||
|
alias act='DOCKER_HOST=$ACT_DOCKER_HOST act --rm --secret=GITHUB_TOKEN=$(gh auth token) --platform="ubuntu-latest=docker.io/catthehacker/ubuntu:full-latest" --platform="ubuntu-24.04=docker.io/catthehacker/ubuntu:full-latest" --container-options="--privileged" --artifact-server-path=$(mktemp --directory) --artifact-server-addr=$ACT_SOURCE_IP --cache-server-path=$(mkdir --parents /tmp/act-cache && echo /tmp/act-cache) --cache-server-addr=$ACT_SOURCE_IP'
|
||||||
|
else
|
||||||
|
alias act='echo ERROR: local act runner is not active, use "start-act-runner" to start it'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
alias act='echo ERROR: local act runner is not running, use "start-act-runner" to start it'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_configure_act_alias
|
||||||
@@ -27,6 +27,7 @@ RUN dnf install --assumeyes \
|
|||||||
google-cloud-sdk-gke-gcloud-auth-plugin \
|
google-cloud-sdk-gke-gcloud-auth-plugin \
|
||||||
jq \
|
jq \
|
||||||
kubectl \
|
kubectl \
|
||||||
|
kustomize \
|
||||||
libacl-devel \
|
libacl-devel \
|
||||||
libffi-devel \
|
libffi-devel \
|
||||||
libpq-devel \
|
libpq-devel \
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ function get_latest() {
|
|||||||
function do_install() {
|
function do_install() {
|
||||||
local name
|
local name
|
||||||
name="${1}"
|
name="${1}"
|
||||||
|
|
||||||
local url
|
local url
|
||||||
url="${2}"
|
url="${2}"
|
||||||
|
|
||||||
local working
|
local working
|
||||||
working=$(mktemp -d)
|
working=$(mktemp -d)
|
||||||
|
|
||||||
@@ -72,4 +72,4 @@ cosign=$(get_latest sigstore/cosign)
|
|||||||
do_install cosign "https://github.com/sigstore/cosign/releases/download/${cosign}/cosign-${cosign:1}-1.x86_64.rpm"
|
do_install cosign "https://github.com/sigstore/cosign/releases/download/${cosign}/cosign-${cosign:1}-1.x86_64.rpm"
|
||||||
|
|
||||||
codium=$(get_latest VSCodium/vscodium)
|
codium=$(get_latest VSCodium/vscodium)
|
||||||
do_install codium "https://github.com/VSCodium/vscodium/releases/download/${codium}/codium-${codium}-el8.x86_64.rpm"
|
do_install codium "https://github.com/VSCodium/vscodium/releases/download/${codium}/codium-${codium}-el8.x86_64.rpm"
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
EXTENSIONS=(
|
|
||||||
"gamunu.opentofu"
|
|
||||||
"tamasfe.even-better-toml"
|
|
||||||
"samuelcolvin.jinjahtml"
|
|
||||||
"yzhang.markdown-all-in-one"
|
|
||||||
"streetsidesoftware.code-spell-checker"
|
|
||||||
"github.vscode-github-actions"
|
|
||||||
"redhat.vscode-yaml"
|
|
||||||
"ms-python.debugpy"
|
|
||||||
"ms-python.python"
|
|
||||||
"detachhead.basedpyright"
|
|
||||||
)
|
|
||||||
|
|
||||||
for ext in "${EXTENSIONS[@]}"; do
|
|
||||||
codium --install-extension "$ext" --force
|
|
||||||
done
|
|
||||||
Reference in New Issue
Block a user