-
Notifications
You must be signed in to change notification settings - Fork 2.2k
OSAC-854: add nightly vmaas snapshot build job #79377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| approvers: | ||
| - osac-cicd | ||
| reviewers: | ||
| - osac-cicd |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "path": "osac-project/cluster-tool/snapshot-vmaas/osac-project-cluster-tool-snapshot-vmaas-workflow.yaml", | ||
| "owners": { | ||
| "approvers": [ | ||
| "osac-cicd" | ||
| ], | ||
| "reviewers": [ | ||
| "osac-cicd" | ||
| ] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| workflow: | ||
| as: osac-project-cluster-tool-snapshot-vmaas | ||
| steps: | ||
| cluster_profile: packet-assisted | ||
| allow_best_effort_post_steps: true | ||
| pre: | ||
| - ref: ofcir-acquire | ||
| - ref: assisted-ofcir-setup | ||
| - chain: assisted-common-pre | ||
| - ref: osac-project-installer | ||
| test: | ||
| - ref: osac-project-cluster-tool-snapshot | ||
| post: | ||
| - ref: osac-project-gather | ||
| - ref: ofcir-gather | ||
| - ref: ofcir-release | ||
| env: | ||
| CLUSTERTYPE: "assisted_large_el9" | ||
| documentation: |- | ||
| Provisions a baremetal cluster via assisted-installer, installs OSAC, | ||
| then snapshots the cluster using cluster-tool and pushes the snapshot | ||
| OCI image to a container registry. Used as a nightly job to keep the | ||
| snapshot current for presubmit cluster-tool boot jobs. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| approvers: | ||
| - osac-cicd | ||
| reviewers: | ||
| - osac-cicd |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o nounset | ||
| set -o errexit | ||
| set -o pipefail | ||
|
|
||
| echo "************ cluster-tool snapshot ************" | ||
| echo "CLUSTER_TOOL_COMMIT: ${CLUSTER_TOOL_COMMIT}" | ||
| echo "SNAPSHOT_REGISTRY: ${SNAPSHOT_REGISTRY}" | ||
| echo "SNAPSHOT_TAG: ${SNAPSHOT_TAG}" | ||
| echo "-------------------------------------------" | ||
|
|
||
| FLAVOR_NAME="${SNAPSHOT_TAG}" | ||
| QUAY_USER=$(cat /var/run/vault/osac-quay-creds/user) | ||
|
|
||
| QUAY_PASS=$(cat /var/run/vault/osac-quay-creds/password) | ||
|
|
||
| timeout -s 9 90m ssh -F "${SHARED_DIR}/ssh_config" ci_machine bash -s \ | ||
| "${CLUSTER_TOOL_COMMIT}" \ | ||
| "${SNAPSHOT_REGISTRY}" \ | ||
| "${SNAPSHOT_TAG}" \ | ||
| "${FLAVOR_NAME}" \ | ||
| "${QUAY_USER}" \ | ||
| "${QUAY_PASS}" \ | ||
| <<'REMOTE_EOF' | ||
| set -euo pipefail | ||
|
|
||
| COMMIT="$1" | ||
| REGISTRY="$2" | ||
| TAG="$3" | ||
| FLAVOR="$4" | ||
| QUAY_USER="$5" | ||
| QUAY_PASS="$6" | ||
|
|
||
| echo "=== Installing cluster-tool ===" | ||
| curl -fsSL "https://raw.githubusercontent.com/omer-vishlitzky/cluster-tool/${COMMIT}/cluster-tool" \ | ||
| -o /usr/local/bin/cluster-tool | ||
| chmod +x /usr/local/bin/cluster-tool | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a plan to move cluster-tool to the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. once it stabilizes, yes. |
||
|
|
||
| echo "=== Setting up cluster-tool ===" | ||
| python3 /usr/local/bin/cluster-tool connect ci --host local --data-path /home/cluster-tool | ||
|
|
||
| echo "=== Discovering cluster ID ===" | ||
| CLUSTER_ID=$(virsh list --name | grep test-infra-cluster | sed 's/test-infra-cluster-//;s/-master-0//' | head -1) | ||
| [[ -z "${CLUSTER_ID}" ]] && echo "ERROR: No running test-infra cluster found" && exit 1 | ||
| echo "Found cluster ID: ${CLUSTER_ID}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: This cluster ID discovery depends on the assisted-installer VM naming convention (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is constant set by assisted-test-infra |
||
|
|
||
| echo "=== Creating snapshot ===" | ||
| python3 /usr/local/bin/cluster-tool snapshot --name "${FLAVOR}" --source "${CLUSTER_ID}" | ||
|
|
||
| echo "=== Authenticating to registry ===" | ||
| printf '%s' "${QUAY_PASS}" | podman login "$(echo "${REGISTRY}" | cut -d/ -f1)" \ | ||
| -u "${QUAY_USER}" --password-stdin | ||
|
|
||
| echo "=== Pushing snapshot ===" | ||
| python3 /usr/local/bin/cluster-tool push "${FLAVOR}" --registry "${REGISTRY}" --tag "${TAG}" | ||
|
|
||
| echo "=== Snapshot push complete ===" | ||
| REMOTE_EOF | ||
|
|
||
| echo "Snapshot step finished successfully." | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "path": "osac-project/cluster-tool/snapshot/osac-project-cluster-tool-snapshot-ref.yaml", | ||
| "owners": { | ||
| "approvers": [ | ||
| "osac-cicd" | ||
| ], | ||
| "reviewers": [ | ||
| "osac-cicd" | ||
| ] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| ref: | ||
| as: osac-project-cluster-tool-snapshot | ||
| from: dev-scripts | ||
| grace_period: 10m | ||
| timeout: 2h0m0s | ||
| commands: osac-project-cluster-tool-snapshot-commands.sh | ||
| resources: | ||
| requests: | ||
| cpu: 100m | ||
| memory: 200Mi | ||
| credentials: | ||
| - namespace: test-credentials | ||
| name: osac-quay-creds | ||
| mount_path: /var/run/vault/osac-quay-creds | ||
| env: | ||
| - name: CLUSTER_TOOL_COMMIT | ||
| default: "main" | ||
| documentation: cluster-tool git ref to download (branch, tag, or commit) | ||
| - name: SNAPSHOT_REGISTRY | ||
| default: "quay.io/rh-ee-ovishlit/cluster-flavors" | ||
| documentation: Container registry and repository to push the snapshot to | ||
| - name: SNAPSHOT_TAG | ||
| default: "osac-vmaas" | ||
| documentation: Tag for the pushed snapshot image | ||
| documentation: |- | ||
| Snapshots a running OSAC cluster using cluster-tool and pushes the | ||
| resulting OCI image to a container registry. Expects the cluster to | ||
| have been provisioned by assisted-installer and OSAC installed via | ||
| osac-project-installer in a prior step. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/release
Length of output: 171
🏁 Script executed:
Repository: openshift/release
Length of output: 899
🏁 Script executed:
Repository: openshift/release
Length of output: 43
🏁 Script executed:
Repository: openshift/release
Length of output: 3880
🏁 Script executed:
Repository: openshift/release
Length of output: 976
🏁 Script executed:
Repository: openshift/release
Length of output: 43
🏁 Script executed:
Repository: openshift/release
Length of output: 2382
Add integrity verification for downloaded
cluster-toolbinary.Lines [35-37] download and execute a binary from a mutable GitHub ref (
mainby default) without checksum verification. This poses a supply-chain risk, particularly in a step with mounted credentials that could be compromised if the tool is hijacked.Add SHA256 verification before execution:
Suggested hardening
curl -fsSL "https://raw.githubusercontent.com/omer-vishlitzky/cluster-tool/${COMMIT}/cluster-tool" \ -o /usr/local/bin/cluster-tool +echo "${CLUSTER_TOOL_SHA256} /usr/local/bin/cluster-tool" | sha256sum -c - chmod +x /usr/local/bin/cluster-toolNote: Requires defining
CLUSTER_TOOL_SHA256as an environment variable in the step reference.🤖 Prompt for AI Agents