Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
approvers:
- osac-cicd
options: {}
reviewers:
- osac-cicd
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

echo "************ osac-installer-component commands ************"
echo "--- Running with the following parameters ---"
echo "E2E_NAMESPACE: ${E2E_NAMESPACE}"
echo "E2E_KUSTOMIZE_OVERLAY: ${E2E_KUSTOMIZE_OVERLAY}"
echo "E2E_VM_TEMPLATE: ${E2E_VM_TEMPLATE}"
echo "OSAC_INSTALLER_IMAGE: ${OSAC_INSTALLER_IMAGE}"
echo "COMPONENT_IMAGE: ${COMPONENT_IMAGE}"
echo "COMPONENT_IMAGE_NAME: ${COMPONENT_IMAGE_NAME}"
echo "AAP_EE_IMAGE_OVERRIDE: ${AAP_EE_IMAGE_OVERRIDE:-}"
Comment on lines +7 to +15
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To truly test the components we need to import their up-to-date code as well and use it as the submodules

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/openshift/release/pull/78716/changes#diff-839c036529a0e9487a73ea19a77185c047e760dc067deb3bf024386833287641R47-R58
here we build a modified osac-installer image: FROM osac-installer starts from the promoted baseline (all components at their pinned versions), then COPY config/ overlays the PR's
manifests over the osac-operator submodule. Lines 49-50 (of this file) build the PR's container image. The step registry in #78715 patches base/kustomization.yaml at runtime to point the image tag to
this CI-built image. So both the manifests and the running binary come from the PR, while everything else stays at the released versions.

echo "-------------------------------------------"

base64 -d /var/run/osac-installer-aap/license > /tmp/license.zip

timeout -s 9 10m scp -F "${SHARED_DIR}/ssh_config" /tmp/license.zip ci_machine:/tmp/license.zip

timeout -s 9 120m ssh -F "${SHARED_DIR}/ssh_config" ci_machine bash - << EOF|& sed -e 's/.*auths\{0,1\}".*/*** PULL_SECRET ***/g'

export KUBECONFIG=\$(find \${KUBECONFIG} -type f -print -quit)

oc annotate sc lvms-vg1 storageclass.kubernetes.io/is-default-class=true --overwrite

echo "Waiting for OpenShift Virtualization to be ready..."
oc wait --for=condition=Available hyperconverged/kubevirt-hyperconverged -n openshift-cnv --timeout=900s

cat <<NADEOF | oc apply -f -
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
name: default
namespace: openshift-ovn-kubernetes
spec:
config: '{"cniVersion": "0.4.0", "name": "ovn-kubernetes", "type": "ovn-k8s-cni-overlay"}'
NADEOF

podman run --authfile /root/pull-secret --rm --network=host \
-v \${KUBECONFIG}:/root/.kube/config:z \
-v /root/pull-secret:/installer/overlays/${E2E_KUSTOMIZE_OVERLAY}/files/quay-pull-secret.json:z \
-v /tmp/license.zip:/installer/overlays/${E2E_KUSTOMIZE_OVERLAY}/files/license.zip:z \
-e INSTALLER_NAMESPACE=${E2E_NAMESPACE} \
-e INSTALLER_KUSTOMIZE_OVERLAY=${E2E_KUSTOMIZE_OVERLAY} \
-e INSTALLER_VM_TEMPLATE=${E2E_VM_TEMPLATE} \
-e COMPONENT_IMAGE=${COMPONENT_IMAGE} \
-e COMPONENT_IMAGE_NAME=${COMPONENT_IMAGE_NAME} \
-e AAP_EE_IMAGE_OVERRIDE=${AAP_EE_IMAGE_OVERRIDE:-} \
${OSAC_INSTALLER_IMAGE} sh -c '
set -euo pipefail

COMPONENT_REGISTRY=\${COMPONENT_IMAGE%:*}
COMPONENT_TAG=\${COMPONENT_IMAGE##*:}

echo "Overriding image \${COMPONENT_IMAGE_NAME} -> \${COMPONENT_IMAGE}"
cd /installer/base

if ! grep -Fq "name: \${COMPONENT_IMAGE_NAME}" kustomization.yaml; then
echo "ERROR: image name \${COMPONENT_IMAGE_NAME} not found in /installer/base/kustomization.yaml" >&2
cat kustomization.yaml >&2
exit 1
fi

if grep -A1 "name: \${COMPONENT_IMAGE_NAME}" kustomization.yaml | grep -q "newName:"; then
sed -i "\#name: \${COMPONENT_IMAGE_NAME}#,/newTag:/{
s|newName:.*|newName: \${COMPONENT_REGISTRY}|
s|newTag:.*|newTag: \${COMPONENT_TAG}|
}" kustomization.yaml
else
sed -i "\#name: \${COMPONENT_IMAGE_NAME}#{
a\\ newName: \${COMPONENT_REGISTRY}
n
s|newTag:.*|newTag: \${COMPONENT_TAG}|
}" kustomization.yaml
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.

if ! grep -Fq "\${COMPONENT_REGISTRY}" kustomization.yaml || ! grep -Fq "newTag: \${COMPONENT_TAG}" kustomization.yaml; then
echo "ERROR: kustomize image override failed — expected \${COMPONENT_REGISTRY}:\${COMPONENT_TAG}" >&2
cat kustomization.yaml >&2
exit 1
fi

if [ -n "\${AAP_EE_IMAGE_OVERRIDE}" ]; then
overlay_file="/installer/overlays/\${INSTALLER_KUSTOMIZE_OVERLAY}/kustomization.yaml"
if ! grep -q "AAP_EE_IMAGE=" "\${overlay_file}"; then
echo "ERROR: AAP_EE_IMAGE entry not found in \${overlay_file}" >&2
exit 1
fi
echo "Overriding AAP_EE_IMAGE -> \${COMPONENT_IMAGE}"
sed -i "s|AAP_EE_IMAGE=.*|AAP_EE_IMAGE=\${COMPONENT_IMAGE}|" "\${overlay_file}"
fi

cd /installer
sh scripts/setup.sh
'

EOF
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"path": "osac-project/installer/component/osac-project-installer-component-ref.yaml",
"owners": {
"approvers": [
"osac-cicd"
],
"reviewers": [
"osac-cicd"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ref:
as: osac-project-installer-component
from: dev-scripts
dependencies:
- name: osac-installer
env: OSAC_INSTALLER_IMAGE
- name: component-image
env: COMPONENT_IMAGE
grace_period: 10m
timeout: 3h0m0s
commands: osac-project-installer-component-commands.sh
resources:
requests:
cpu: 100m
memory: 200Mi
credentials:
- namespace: test-credentials
name: osac-installer-aap
mount_path: /var/run/osac-installer-aap
env:
- name: E2E_NAMESPACE
default: "osac-e2e-ci"
documentation: The namespace to use for the e2e tests
- name: E2E_KUSTOMIZE_OVERLAY
default: "vmaas-ci"
documentation: The kustomize overlay to use for the e2e tests
- name: E2E_VM_TEMPLATE
default: "osac.templates.ocp_virt_vm"
documentation: The template to use for the e2e tests
- name: COMPONENT_IMAGE_NAME
documentation: The image name in base/kustomization.yaml to replace (e.g. ghcr.io/osac-project/fulfillment-service)
- name: AAP_EE_IMAGE_OVERRIDE
default: ""
documentation: If non-empty, also override AAP_EE_IMAGE in the overlay kustomization to use COMPONENT_IMAGE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
approvers:
- osac-cicd
options: {}
reviewers:
- osac-cicd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"path": "osac-project/ofcir/baremetal/component/osac-project-ofcir-baremetal-component-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-ofcir-baremetal-component
steps:
cluster_profile: packet-assisted
allow_best_effort_post_steps: true
allow_skip_on_success: true
pre:
- ref: ofcir-acquire
- ref: assisted-ofcir-setup
- chain: assisted-common-pre
- ref: osac-project-installer-component
test:
- ref: osac-project-baremetal-test
post:
- ref: ofcir-gather
- ref: ofcir-release
env:
CLUSTERTYPE: "assisted_medium_el9"
documentation: |-
This workflow executes the common end-to-end osac-test-infra test suite on a cluster
provisioned by running assisted-installer on a packet server. Unlike the base workflow,
this variant overrides a single component image with a CI-built version from a PR,
enabling E2E validation of component repo changes before merge.
Comment on lines +19 to +23
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Document required consumer inputs for this workflow variant.

The description says this overrides a component image, but it doesn’t state that consuming jobs must provide the component-image dependency mapping and COMPONENT_IMAGE_NAME. Without that, the pre step can fail or run without the intended override.

Suggested doc update
   documentation: |-
     This workflow executes the common end-to-end osac-test-infra test suite on a cluster
     provisioned by running assisted-installer on a packet server. Unlike the base workflow,
     this variant overrides a single component image with a CI-built version from a PR,
     enabling E2E validation of component repo changes before merge.
+    Consuming jobs must map the `component-image` dependency and set `COMPONENT_IMAGE_NAME`
+    to the exact `name:` entry in `/installer/base/kustomization.yaml`.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
documentation: |-
This workflow executes the common end-to-end osac-test-infra test suite on a cluster
provisioned by running assisted-installer on a packet server. Unlike the base workflow,
this variant overrides a single component image with a CI-built version from a PR,
enabling E2E validation of component repo changes before merge.
documentation: |-
This workflow executes the common end-to-end osac-test-infra test suite on a cluster
provisioned by running assisted-installer on a packet server. Unlike the base workflow,
this variant overrides a single component image with a CI-built version from a PR,
enabling E2E validation of component repo changes before merge.
Consuming jobs must map the `component-image` dependency and set `COMPONENT_IMAGE_NAME`
to the exact `name:` entry in `/installer/base/kustomization.yaml`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@ci-operator/step-registry/osac-project/ofcir/baremetal/component/osac-project-ofcir-baremetal-component-workflow.yaml`
around lines 19 - 23, Update the workflow documentation to explicitly list the
required consumer inputs: callers must supply a dependency mapping named
"component-image" and set the environment variable "COMPONENT_IMAGE_NAME" (used
by the pre step that performs the image override), and note the expected
format/value (CI-built image reference) and failure behavior if omitted;
reference the workflow variant description and the pre step that performs the
override so consumers know to provide these inputs when invoking this variant.