Skip to content
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

Enable dynamic RHCOS tests #1679

Merged
merged 8 commits into from
Jun 24, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
fail-fast: false
matrix:
vm_type:
- rhel
- rhcos
- ubuntu-os
with:
vm_type: ${{ matrix.vm_type }}
Expand All @@ -63,10 +63,10 @@ jobs:
- cos
- flatcar
- fedora-coreos
- rhel
- rhel-sap
- sles
- garden-linux
- rhcos
with:
vm_type: ${{ matrix.vm_type }}
collector-tag: ${{ inputs.collector-tag }}
Expand Down
7 changes: 5 additions & 2 deletions ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ virtual_machines:
rhcos:
project: rhcos-cloud
images:
- rhcos-412-86-202303211731-0-gcp-x86-64
- rhcos-413-86-202303151429-0-gcp-x86-64
- "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.17') }}"
- "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.16') }}"
- "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.15') }}"
- "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.14') }}"
- "{{ lookup('ansible.builtin.pipe', 'scripts/fetch_ocp_rhcos_bootimage.sh 4.12') }}"
username: core
ignition:
ignition:
Expand Down
5 changes: 3 additions & 2 deletions ansible/roles/create-all-vms/tasks/by-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

- set_fact:
vm_hashable_name: "{{ item.1 }}-{{ job_id }}"
vm_image_short: "{{ item.1 | truncate(16, True, '') }}"

- set_fact:
vm_hashed_name: "{{ vm_hashable_name | hash('md5') | truncate(8, True, '') }}"

- set_fact:
arch: "{{ item.0.value.arch | default('amd64') }}"
vm_full_name: "{{ gcp_instance_prefix }}-{{ item.0.key }}-{{ normalized_collection_method }}-{{ vm_hashed_name }}"
vm_full_name: "{{ gcp_instance_prefix }}-{{ item.0.key }}-{{ vm_image_short }}-{{ normalized_collection_method }}-{{ vm_hashed_name }}"

- set_fact:
ibm_env: "{{ s390x.env }}"
Expand All @@ -31,7 +32,7 @@
# still populate the family, since it is used as a label to differentiate
# VMs
vm_family: "{{ item.0.key }}"
vm_image: "{{ item.1 }}"
vm_image: "{{ item.1 | truncate(63, True, '') }}"
vm_platform: "{{ item.0.key }}"
vm_config: "{{ item.1 }}"
vm_collection_method: "{{ collection_method | default('any') | replace('-', '_') }}"
Expand Down
26 changes: 26 additions & 0 deletions ansible/scripts/fetch_ocp_rhcos_bootimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

if [ -z "$1" ]; then
echo "Usage: $0 <ocp-version> [<architectures.path>]"
exit 1
fi

OCP_VERSION=$1

# Json path with architecture and image name, e.g., x86_64.images.gcp.name or s390x.artifacts.ibmcloud.release
JSONPATH=${2:-"x86_64.images.gcp.name"}

URL="https://raw.githubusercontent.com/openshift/installer/release-${OCP_VERSION}/data/data/coreos/rhcos.json"

json_data=$(curl -s "$URL")
if [ -z "$json_data" ]; then
echo "Failed to fetch JSON data from URL: $URL"
exit 1
fi

image_name=$(echo "$json_data" | jq -r ".architectures.${JSONPATH}")
if [ "$image_name" == "null" ]; then
echo "Failed to parse JSON data or path does not exist"
exit 1
fi
echo "$image_name"
Loading