diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index c741d77dec..822eba4efa 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -41,7 +41,7 @@ jobs: fail-fast: false matrix: vm_type: - - rhel + - rhcos - ubuntu-os with: vm_type: ${{ matrix.vm_type }} @@ -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 }} diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index a1abea1c85..c78c3a03c0 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -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: diff --git a/ansible/roles/create-all-vms/tasks/by-image.yml b/ansible/roles/create-all-vms/tasks/by-image.yml index 523542c2be..01a6898551 100644 --- a/ansible/roles/create-all-vms/tasks/by-image.yml +++ b/ansible/roles/create-all-vms/tasks/by-image.yml @@ -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 }}" @@ -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('-', '_') }}" diff --git a/ansible/scripts/fetch_ocp_rhcos_bootimage.sh b/ansible/scripts/fetch_ocp_rhcos_bootimage.sh new file mode 100755 index 0000000000..7f04c5bc95 --- /dev/null +++ b/ansible/scripts/fetch_ocp_rhcos_bootimage.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Usage: $0 []" + 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"