move tasks to mise
This commit is contained in:
parent
ebda39966b
commit
77e7e13f05
3 changed files with 8 additions and 8 deletions
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#MISE description="Build the qemu image and import it to Incus"
|
||||||
|
|
||||||
# Function to check if a command was successful
|
# Function to check if a command was successful
|
||||||
check_command() {
|
check_command() {
|
||||||
|
@ -9,11 +10,11 @@ check_command() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build the qemu image and get the path
|
# Build the qemu image and get the path
|
||||||
qemuImageBuildPath=$(nix build .#nixosConfigurations.fj-lxc-vm-x86_64.config.system.build.qemuImage --print-out-paths)
|
qemuImageBuildPath=$(nix build .#nixosConfigurations.lxc-vm-x86_64.config.system.build.qemuImage --print-out-paths)
|
||||||
check_command "Building qemu image"
|
check_command "Building qemu image"
|
||||||
|
|
||||||
# Build the metadata and get the path
|
# Build the metadata and get the path
|
||||||
metadataBuildPath=$(nix build .#nixosConfigurations.fj-lxc-vm-x86_64.config.system.build.metadata --print-out-paths)
|
metadataBuildPath=$(nix build .#nixosConfigurations.lxc-vm-x86_64.config.system.build.metadata --print-out-paths)
|
||||||
check_command "Building metadata"
|
check_command "Building metadata"
|
||||||
|
|
||||||
# Set the paths for the metadata and qemu image
|
# Set the paths for the metadata and qemu image
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#MISE description="Launch the instance and push the forgejo repo token to it so it can check in."
|
||||||
|
|
||||||
INCUS_PROFILE="forgejo-runner"
|
INCUS_PROFILE="forgejo-runner"
|
||||||
|
|
||||||
|
@ -6,7 +7,7 @@ INSTANCE_NAME=$(incus launch nixos-gen/custom/fj-lxc-vm-x86_64 -p ${INCUS_PROFIL
|
||||||
echo "The captured instance name is: $INSTANCE_NAME"
|
echo "The captured instance name is: $INSTANCE_NAME"
|
||||||
|
|
||||||
# Call the push_token.sh script with the new instance name
|
# Call the push_token.sh script with the new instance name
|
||||||
./push_token.sh "$INSTANCE_NAME"
|
"$MISE_TASK_DIR"/push_token.sh "$INSTANCE_NAME"
|
||||||
echo "Pushing token to instance"
|
echo "Pushing token to instance"
|
||||||
|
|
||||||
echo "Process completed successfully"
|
echo "Process completed successfully"
|
|
@ -15,22 +15,20 @@ fi
|
||||||
INCUS_INSTANCE="$1" # Use the provided instance name
|
INCUS_INSTANCE="$1" # Use the provided instance name
|
||||||
|
|
||||||
# Set variables
|
# Set variables
|
||||||
OP_ITEM_NAME="forgejo-runner" # Name of the 1Password item containing the runner token
|
|
||||||
OP_VAULT_NAME="forgejo-runner" # Name of the 1Password vault
|
|
||||||
TOKEN_FILE="tokenfile" # Name of the temporary file to store the token
|
TOKEN_FILE="tokenfile" # Name of the temporary file to store the token
|
||||||
INCUS_PATH="/var/lib/gitea-runner/default/$TOKEN_FILE"
|
INCUS_PATH="/var/lib/gitea-runner/default/$TOKEN_FILE"
|
||||||
|
|
||||||
# Check if OP_SESSION environment variable exists, if not, sign in
|
# Check if OP_SESSION environment variable exists, if not, sign in
|
||||||
if [ -z "${OP_SESSION:-}" ]; then
|
if [ -z "${OP_SESSION:-}" ]; then
|
||||||
echo "Not logged in to 1Password CLI. Attempting to sign in..."
|
echo "Not logged in to 1Password CLI. Attempting to sign in..."
|
||||||
if ! eval $(op signin); then
|
if ! eval "$(op signin)"; then
|
||||||
echo "Failed to sign in to 1Password CLI. Please sign in manually using 'op signin'" >&2
|
echo "Failed to sign in to 1Password CLI. Please sign in manually using 'op signin'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Retrieve the token from 1Password
|
# Retrieve the token from 1Password using op:// format
|
||||||
TOKEN=$(op item get "$OP_ITEM_NAME" --vault "$OP_VAULT_NAME" --fields runner_token)
|
TOKEN=$(op read "op://forgejo-runner/forgejo-runner/runner_token")
|
||||||
|
|
||||||
if [ -z "$TOKEN" ]; then
|
if [ -z "$TOKEN" ]; then
|
||||||
echo "Failed to retrieve token from 1Password" >&2
|
echo "Failed to retrieve token from 1Password" >&2
|
Loading…
Reference in a new issue