Skip to content

ROX-35008: Add GH action to add VMs to existing OCP clusters#21060

Draft
vikin91 wants to merge 11 commits into
masterfrom
piotr/ROX-35008-action-add-VMs
Draft

ROX-35008: Add GH action to add VMs to existing OCP clusters#21060
vikin91 wants to merge 11 commits into
masterfrom
piotr/ROX-35008-action-add-VMs

Conversation

@vikin91

@vikin91 vikin91 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

Add a self-contained scripts/ci/add-vms/ module with shell scripts that automate adding KubeVirt VMs to an ACS cluster and installing roxagent. Includes a composite GitHub Action and a workflow_dispatch workflow for one-click execution from the Actions UI.

What it does:

  1. Installs OpenShift Virtualization operator (idempotent, enables VSOCK + KVM_EMULATION)
  2. Deploys RHEL VMs with automation SSH keypair stored in a K8s secret
  3. Adopts pre-existing VMs via password fallback (sshpass)
  4. Installs roxagent via Quadlet (container) or native binary method
  5. Prints summary with SSH access instructions

Why:
Manual VM setup for VM scanning development/testing is error-prone and undocumented. This enables any team member to add VMs to a cluster in one command or one click in GitHub Actions.

Architecture: A main orchestrator (add-vms.sh) sources modular scripts for each step. Quadlet files are copied verbatim from the source of truth at compliance/virtualmachines/roxagent/quadlet/. A composite action wraps CI-specific setup (infractl, virtctl, sshpass).

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

  • By running the action in GH:
    1. TODO
  • Manually:
    1. Creating a new VM on existing cluster
    2. Taking over existing VM (created manually) and updating roxagent
QUAY_RHACS_ENG_RO_USERNAME=user QUAY_RHACS_ENG_RO_PASSWORD=xxx \
    scripts/ci/add-vms/add-vms.sh \
        --num-vms 1 \
        --os rhel10 \
        --agent native \
        --ssh-key ~/.ssh/id_ed25519.pub

vikin91 and others added 9 commits June 10, 2026 15:12
Copy roxagent Quadlet unit files from
compliance/virtualmachines/roxagent/quadlet/ into the self-contained
scripts/ci/add-vms/quadlet/ module. These are verbatim copies; the
Image= line in roxagent.container will be overwritten at install time
by install-agent-quadlet.sh.

Partially generated by AI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Installs OpenShift Virtualization (HyperConverged) operator with
VSOCK feature gate and KVM_EMULATION. Idempotent: skips when HCO
is already healthy. Extracted from rhacs-vmvm-dev-scripts/virt.sh.

Partially generated by AI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Creates RHEL VMs on KubeVirt clusters with automation SSH keypair
management, image pull secret creation, and pre-existing VM adoption
via password fallback. Idempotent: skips running VMs, starts stopped
ones, creates missing ones.

Partially generated by AI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Installs roxagent on VMs using the Quadlet (container) method.
Auto-detects the ACS image tag from Central, renders Image= lines
in Quadlet files, and delegates to quadlet/install.sh per VM.
Idempotent: skips when installed Image= already matches.

Partially generated by AI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Builds roxagent binary from source and deploys to VMs via virtctl scp.
Installs systemd oneshot service + timer matching the Quadlet cadence.
Always overwrites (binary has no embedded version). Requires Go.

Partially generated by AI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Single entrypoint that parses arguments, resolves KUBECONFIG,
and orchestrates virt operator install, VM deployment, and agent
installation. Prints summary with SSH access instructions.

Partially generated by AI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Wraps add-vms.sh with CI-specific setup: infractl artifacts download,
virt operator install, virtctl install from cluster ConsoleCLIDownload,
sshpass install, and SSH key preparation. Installs virt operator
before virtctl so the ConsoleCLIDownload resource is available.

Partially generated by AI.

Co-authored-by: Cursor <cursoragent@cursor.com>
One-click GitHub Actions workflow to add VMs to an Infra-managed
ACS cluster and install roxagent. Supports rhel9/rhel10, native
and Quadlet agent types, optional image tag override, and optional
user SSH key.

Partially generated by AI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use ${VAR:-} for AUTOMATION_SSH_PRIVKEY and AUTOMATION_SSH_PUBKEY
in the EXIT trap since they are only set after deploy-vms.sh runs.

Partially generated by AI.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vikin91

vikin91 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

This change is part of the following stack:

Change managed by git-spice.

@openshift-ci

openshift-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 989f4de7-04b9-44b1-ab25-15eb59a8dd55

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch piotr/ROX-35008-action-add-VMs

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

🚀 Build Images Ready

Images are ready for commit fc9f9de. To use with deploy scripts:

export MAIN_IMAGE_TAG=4.12.x-143-gfc9f9defed

vikin91 and others added 2 commits June 10, 2026 16:34
- Exit non-zero when no VMs are accessible instead of printing a
  warning and succeeding (caused green CI with no agent installed)
- Increase SSH retry from 30 (~6 min) to 90 (~15 min) to handle
  fresh VMs where container disk pull + boot + cloud-init is slow
- Stop swallowing wait_for_ssh_and_adopt failures with || true

Partially generated by AI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant