testing
This commit is contained in:
parent
5c1cd20efa
commit
6539fe218a
2 changed files with 12 additions and 83 deletions
|
|
@ -44,89 +44,18 @@ jobs:
|
|||
mkdir -p ~/.config/nix
|
||||
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
|
||||
|
||||
- name: Prepare SSH keys and known_hosts for builder and Proxmox
|
||||
- name: Debug Environment
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
# Ensure this key corresponds to PROXMOX_USER
|
||||
echo "${{ secrets.RUNNER_SSH_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
# Add builder and Proxmox host keys to known_hosts
|
||||
ssh-keyscan -H "$NIXOS_BUILER_HOST" >> ~/.ssh/known_hosts
|
||||
ssh-keyscan -H "$PROXMOX_HOST" >> ~/.ssh/known_hosts
|
||||
chmod 600 ~/.ssh/known_hosts
|
||||
|
||||
- name: Test SSH connection to NixOS Builder
|
||||
run: |
|
||||
echo "Testing SSH connection to $NIXOS_BUILER_HOST..."
|
||||
ssh -o StrictHostKeyChecking=yes "$NIXOS_BUILER_USER"@"$NIXOS_BUILER_HOST" "echo 'SSH success. Hostname:' && hostname"
|
||||
|
||||
- name: Test SSH connection to Proxmox Host
|
||||
run: |
|
||||
echo "Testing SSH connection to $PROXMOX_HOST..."
|
||||
ssh -o StrictHostKeyChecking=yes "$PROXMOX_USER"@"$PROXMOX_HOST" "echo 'SSH success. Hostname:' && hostname"
|
||||
|
||||
- name: Build NixOS image
|
||||
id: build_image
|
||||
run: |
|
||||
nix build .#base \
|
||||
--builders "ssh://$NIXOS_BUILER_USER@$NIXOS_BUILER_HOST x86_64-linux ~/.ssh/id_rsa 1 1 kvm" \
|
||||
--max-jobs 0 \
|
||||
--print-out-paths \
|
||||
| cachix push plasmagoat
|
||||
|
||||
# Capture the actual image path from the result symlink for Ansible
|
||||
IMAGE_PATH=$(find result/ -name "*.vma.zst" | head -n 1)
|
||||
if [ -z "$IMAGE_PATH" ]; then
|
||||
echo "Error: No .vma.zst image found after build."
|
||||
exit 1
|
||||
fi
|
||||
echo "image_path_from_build=${IMAGE_PATH}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Run Proxmox Image Deployment
|
||||
run: |
|
||||
chmod +x ./scripts/run_ansible_ci.sh
|
||||
# Execute the script, passing necessary environment variables
|
||||
bash scripts/run_ansible_ci.sh
|
||||
env:
|
||||
# These are passed directly to the `run_ansible_ci.sh` script,
|
||||
# which then uses them to construct Ansible's --extra-vars.
|
||||
# Match these variable names with what `run_ansible_ci.sh` expects.
|
||||
# Note: The `image_path_from_build` comes from the previous step's output.
|
||||
PROXMOX_LOCAL_IMAGE_PATH_FROM_BUILD: ${{ steps.build_image.outputs.image_path_from_build }}
|
||||
|
||||
# Provide VMIDs and names, overriding group_vars if desired.
|
||||
# These will be passed as `--extra-vars` to Ansible.
|
||||
ANSIBLE_EXTRA_VARS: >-
|
||||
backup_template_vmid={{ env.TEMPLATE_VMID | default('9001') }}
|
||||
latest_template_vmid={{ env.LATEST_TEMPLATE_VMID | default('9000') }}
|
||||
proxmox_host={{ env.PROXMOX_HOST }}
|
||||
proxmox_user={{ env.PROXMOX_USER }}
|
||||
remote_image_path_ci={{ steps.build_image.outputs.image_path_from_build }}
|
||||
|
||||
- name: Set VERSION from tag or fallback
|
||||
id: version
|
||||
run: |
|
||||
if [[ "${{ github.ref_type }}" == "tag" ]]; then
|
||||
TAG_NAME="${{ github.ref_name }}"
|
||||
else
|
||||
TAG_NAME="dev-$(date +%Y%m%d)-${GITHUB_SHA::7}"
|
||||
fi
|
||||
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# - name: Parse image filename
|
||||
# id: image
|
||||
# run: |
|
||||
# IMAGE=$(basename ${{ steps.artifact.outputs.download-path }}/*.vma.zst)
|
||||
# echo "Image filename: $IMAGE"
|
||||
# echo "filename=$IMAGE" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# - name: Extract flake metadata
|
||||
# id: meta
|
||||
# run: |
|
||||
# META=$(nix flake metadata --json | jq -r '.locks.nodes.root.inputs | to_entries[] | "* \(.key): \(.value.locked.url) @ \(.value.locked.rev)"')
|
||||
# echo "metadata<<EOF" >> $GITHUB_OUTPUT
|
||||
# echo "$META" >> $GITHUB_OUTPUT
|
||||
# echo "EOF" >> $GITHUB_OUTPUT
|
||||
echo "PATH: $PATH"
|
||||
which bash
|
||||
which curl
|
||||
which git
|
||||
which jq
|
||||
ls -l /var/run/act/actions/https---code.forgejo.org-sheik-forgejo-release@v2.6.0/forgejo-release.sh
|
||||
echo "--- Running forgejo-release.sh with bash -x for more verbose output ---"
|
||||
/bin/bash -x /var/run/act/actions/https---code.forgejo.org-sheik-forgejo-release@v2.6.0/forgejo-release.sh || true
|
||||
# The '|| true' allows the workflow to continue even if this fails
|
||||
shell: bash
|
||||
|
||||
- name: Create Forgejo Release
|
||||
uses: https://code.forgejo.org/sheik/forgejo-release@v2.6.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue