diff --git a/.github/workflows/os-replace.yml b/.github/workflows/os-replace.yml index fe5940f..2a8a2d7 100644 --- a/.github/workflows/os-replace.yml +++ b/.github/workflows/os-replace.yml @@ -58,7 +58,7 @@ jobs: strategy: matrix: arch: [x86_64] - platform: [openstack, gcp, aws, libvirt, beaker] + platform: [openstack, gcp, aws, azure, libvirt, beaker] include: - arch: aarch64 platform: aws @@ -87,8 +87,8 @@ jobs: pull_request_status_name: "bootc-rhel94-${{ matrix.arch }}-replace-${{ matrix.platform }}" tmt_plan_regex: "${{ matrix.platform }}" tf_scope: private - secrets: "OS_USERNAME=${{ secrets.OS_USERNAME }};OS_PASSWORD=${{ secrets.OS_PASSWORD }};OS_AUTH_URL=${{ secrets.OS_AUTH_URL }};QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};RHEL_REGISTRY_URL=${{ secrets.RHEL_REGISTRY_URL }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }};GCP_SERVICE_ACCOUNT_FILE_B64=${{ secrets.GCP_SERVICE_ACCOUNT_FILE_B64 }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};CERT_URL=${{ secrets.CERT_URL }};RHC_AK=${{ secrets.RHC_AK }};RHC_ORGID=${{ secrets.RHC_ORGID }};BEAKER_KEYTAB_B64=${{ secrets.BEAKER_KEYTAB_B64 }};BEAKER_CLIENT_B64=${{ secrets.BEAKER_CLIENT_B64 }};KRB5_CONF_B64=${{ secrets.KRB5_CONF_B64 }}" - variables: "TEST_OS=rhel-9-4;PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};OS_PROJECT_NAME=${{ secrets.OS_PROJECT_NAME }};OS_USER_DOMAIN_NAME=${{ secrets.OS_USER_DOMAIN_NAME }};OS_PROJECT_DOMAIN_NAME=${{ secrets.OS_PROJECT_DOMAIN_NAME }};GCP_PROJECT=${{ secrets.GCP_PROJECT }};AWS_REGION=${{ secrets.AWS_REGION }};FIRMWARE=${{ matrix.firmware }}" + secrets: "OS_USERNAME=${{ secrets.OS_USERNAME }};OS_PASSWORD=${{ secrets.OS_PASSWORD }};OS_AUTH_URL=${{ secrets.OS_AUTH_URL }};QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};RHEL_REGISTRY_URL=${{ secrets.RHEL_REGISTRY_URL }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }};GCP_SERVICE_ACCOUNT_FILE_B64=${{ secrets.GCP_SERVICE_ACCOUNT_FILE_B64 }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};CERT_URL=${{ secrets.CERT_URL }};RHC_AK=${{ secrets.RHC_AK }};RHC_ORGID=${{ secrets.RHC_ORGID }};BEAKER_KEYTAB_B64=${{ secrets.BEAKER_KEYTAB_B64 }};BEAKER_CLIENT_B64=${{ secrets.BEAKER_CLIENT_B64 }};KRB5_CONF_B64=${{ secrets.KRB5_CONF_B64 }};AZURE_SECRET=${{ secrets.AZURE_SECRET }}" + variables: "TEST_OS=rhel-9-4;PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};OS_PROJECT_NAME=${{ secrets.OS_PROJECT_NAME }};OS_USER_DOMAIN_NAME=${{ secrets.OS_USER_DOMAIN_NAME }};OS_PROJECT_DOMAIN_NAME=${{ secrets.OS_PROJECT_DOMAIN_NAME }};GCP_PROJECT=${{ secrets.GCP_PROJECT }};AWS_REGION=${{ secrets.AWS_REGION }};FIRMWARE=${{ matrix.firmware }};AZURE_SUBSCRIPTION_ID=${{ secrets.AZURE_SUBSCRIPTION_ID }};AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }};AZURE_TENANT=${{ secrets.AZURE_TENANT }}" cs9-replace: needs: pr-info @@ -99,7 +99,7 @@ jobs: strategy: matrix: arch: [x86_64] - platform: [openstack, gcp, aws, libvirt, beaker] + platform: [openstack, gcp, aws, azure, libvirt, beaker] include: - arch: aarch64 platform: aws @@ -128,8 +128,8 @@ jobs: pull_request_status_name: "bootc-cs9-${{ matrix.arch }}-replace-${{ matrix.platform }}" tmt_plan_regex: "${{ matrix.platform }}" tf_scope: private - secrets: "OS_USERNAME=${{ secrets.OS_USERNAME }};OS_PASSWORD=${{ secrets.OS_PASSWORD }};OS_AUTH_URL=${{ secrets.OS_AUTH_URL }};QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};GCP_SERVICE_ACCOUNT_FILE_B64=${{ secrets.GCP_SERVICE_ACCOUNT_FILE_B64 }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};CERT_URL=${{ secrets.CERT_URL }};BEAKER_KEYTAB_B64=${{ secrets.BEAKER_KEYTAB_B64 }};BEAKER_CLIENT_B64=${{ secrets.BEAKER_CLIENT_B64 }};KRB5_CONF_B64=${{ secrets.KRB5_CONF_B64 }}" - variables: "TEST_OS=centos-stream-9;PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};OS_PROJECT_NAME=${{ secrets.OS_PROJECT_NAME }};OS_USER_DOMAIN_NAME=${{ secrets.OS_USER_DOMAIN_NAME }};OS_PROJECT_DOMAIN_NAME=${{ secrets.OS_PROJECT_DOMAIN_NAME }};GCP_PROJECT=${{ secrets.GCP_PROJECT }};AWS_REGION=${{ secrets.AWS_REGION }};FIRMWARE=${{ matrix.firmware }}" + secrets: "OS_USERNAME=${{ secrets.OS_USERNAME }};OS_PASSWORD=${{ secrets.OS_PASSWORD }};OS_AUTH_URL=${{ secrets.OS_AUTH_URL }};QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};GCP_SERVICE_ACCOUNT_FILE_B64=${{ secrets.GCP_SERVICE_ACCOUNT_FILE_B64 }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};CERT_URL=${{ secrets.CERT_URL }};BEAKER_KEYTAB_B64=${{ secrets.BEAKER_KEYTAB_B64 }};BEAKER_CLIENT_B64=${{ secrets.BEAKER_CLIENT_B64 }};KRB5_CONF_B64=${{ secrets.KRB5_CONF_B64 }};AZURE_SECRET=${{ secrets.AZURE_SECRET }}" + variables: "TEST_OS=centos-stream-9;PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};OS_PROJECT_NAME=${{ secrets.OS_PROJECT_NAME }};OS_USER_DOMAIN_NAME=${{ secrets.OS_USER_DOMAIN_NAME }};OS_PROJECT_DOMAIN_NAME=${{ secrets.OS_PROJECT_DOMAIN_NAME }};GCP_PROJECT=${{ secrets.GCP_PROJECT }};AWS_REGION=${{ secrets.AWS_REGION }};FIRMWARE=${{ matrix.firmware }};AZURE_SUBSCRIPTION_ID=${{ secrets.AZURE_SUBSCRIPTION_ID }};AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }};AZURE_TENANT=${{ secrets.AZURE_TENANT }}" cs9-dev-replace: needs: pr-info @@ -140,7 +140,7 @@ jobs: strategy: matrix: arch: [x86_64] - platform: [openstack, gcp, aws, libvirt, beaker] + platform: [openstack, gcp, aws, azure, libvirt, beaker] include: - arch: aarch64 platform: aws @@ -175,8 +175,8 @@ jobs: pull_request_status_name: "bootc-cs9-dev-${{ matrix.arch }}-replace-${{ matrix.platform }}" tmt_plan_regex: "${{ matrix.platform }}" tf_scope: private - secrets: "OS_USERNAME=${{ secrets.OS_USERNAME }};OS_PASSWORD=${{ secrets.OS_PASSWORD }};OS_AUTH_URL=${{ secrets.OS_AUTH_URL }};QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};GCP_SERVICE_ACCOUNT_FILE_B64=${{ secrets.GCP_SERVICE_ACCOUNT_FILE_B64 }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};CERT_URL=${{ secrets.CERT_URL }};BEAKER_KEYTAB_B64=${{ secrets.BEAKER_KEYTAB_B64 }};BEAKER_CLIENT_B64=${{ secrets.BEAKER_CLIENT_B64 }};KRB5_CONF_B64=${{ secrets.KRB5_CONF_B64 }}" - variables: "TEST_OS=centos-stream-9;PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};IMAGE_NAME=centos-bootc-dev;OS_PROJECT_NAME=${{ secrets.OS_PROJECT_NAME }};OS_USER_DOMAIN_NAME=${{ secrets.OS_USER_DOMAIN_NAME }};OS_PROJECT_DOMAIN_NAME=${{ secrets.OS_PROJECT_DOMAIN_NAME }};GCP_PROJECT=${{ secrets.GCP_PROJECT }};AWS_REGION=${{ secrets.AWS_REGION }};FIRMWARE=${{ matrix.firmware }}" + secrets: "OS_USERNAME=${{ secrets.OS_USERNAME }};OS_PASSWORD=${{ secrets.OS_PASSWORD }};OS_AUTH_URL=${{ secrets.OS_AUTH_URL }};QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};QUAY_SECRET=${{ secrets.QUAY_SECRET }};GCP_SERVICE_ACCOUNT_FILE_B64=${{ secrets.GCP_SERVICE_ACCOUNT_FILE_B64 }};AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }};AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }};CERT_URL=${{ secrets.CERT_URL }};BEAKER_KEYTAB_B64=${{ secrets.BEAKER_KEYTAB_B64 }};BEAKER_CLIENT_B64=${{ secrets.BEAKER_CLIENT_B64 }};KRB5_CONF_B64=${{ secrets.KRB5_CONF_B64 }};AZURE_SECRET=${{ secrets.AZURE_SECRET }}" + variables: "TEST_OS=centos-stream-9;PLATFORM=${{ matrix.platform }};ARCH=${{ matrix.arch }};IMAGE_NAME=centos-bootc-dev;OS_PROJECT_NAME=${{ secrets.OS_PROJECT_NAME }};OS_USER_DOMAIN_NAME=${{ secrets.OS_USER_DOMAIN_NAME }};OS_PROJECT_DOMAIN_NAME=${{ secrets.OS_PROJECT_DOMAIN_NAME }};GCP_PROJECT=${{ secrets.GCP_PROJECT }};AWS_REGION=${{ secrets.AWS_REGION }};FIRMWARE=${{ matrix.firmware }};AZURE_SUBSCRIPTION_ID=${{ secrets.AZURE_SUBSCRIPTION_ID }};AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }};AZURE_TENANT=${{ secrets.AZURE_TENANT }}" rhel94-beta-replace: needs: pr-info diff --git a/.tekton/rhel-bootc-integration-tests.yaml b/.tekton/rhel-bootc-integration-tests.yaml index 6ff2d77..f1152ae 100644 --- a/.tekton/rhel-bootc-integration-tests.yaml +++ b/.tekton/rhel-bootc-integration-tests.yaml @@ -38,6 +38,9 @@ spec: - name: RHEL_REGISTRY_URL - name: GCP_PROJECT - name: AWS_REGION + - name: AZURE_SUBSCRIPTION_ID + - name: AZURE_CLIENT_ID + - name: AZURE_TENANT tasks: - name: testing-farm taskRef: @@ -74,3 +77,9 @@ spec: value: $(params.GCP_PROJECT) - name: AWS_REGION value: $(params.AWS_REGION) + - name: AZURE_SUBSCRIPTION_ID + value: $(params.AZURE_SUBSCRIPTION_ID) + - name: AZURE_CLIENT_ID + value: $(params.AZURE_CLIENT_ID) + - name: AZURE_TENANT + value: $(params.AZURE_TENANT) diff --git a/.tekton/testing-farm.yaml b/.tekton/testing-farm.yaml index ba85f04..1ac2ed8 100644 --- a/.tekton/testing-farm.yaml +++ b/.tekton/testing-farm.yaml @@ -29,6 +29,9 @@ spec: - name: RHEL_REGISTRY_URL - name: GCP_PROJECT - name: AWS_REGION + - name: AZURE_SUBSCRIPTION_ID + - name: AZURE_CLIENT_ID + - name: AZURE_TENANT volumes: - name: testing-farm-secret secret: @@ -64,6 +67,12 @@ spec: value: $(params.GCP_PROJECT) - name: AWS_REGION value: $(params.AWS_REGION) + - name: AZURE_SUBSCRIPTION_ID + value: $(params.AZURE_SUBSCRIPTION_ID) + - name: AZURE_CLIENT_ID + value: $(params.AZURE_CLIENT_ID) + - name: AZURE_TENANT + value: $(params.AZURE_TENANT) - name: GCP_SERVICE_ACCOUNT_FILE_B64 valueFrom: secretKeyRef: @@ -99,6 +108,11 @@ spec: secretKeyRef: name: "bootc-workflow-test-secret" key: "RHC_ORGID" + - name: AZURE_SECRET + valueFrom: + secretKeyRef: + name: "bootc-workflow-test-secret" + key: "AZURE_SECRET" script: | #!/usr/bin/env bash @@ -143,6 +157,9 @@ spec: --environment RHEL_REGISTRY_URL="${RHEL_REGISTRY_URL}" \ --environment GCP_PROJECT="${GCP_PROJECT}" \ --environment AWS_REGION="${AWS_REGION}" \ + --environment AZURE_SUBSCRIPTION_ID="${AZURE_SUBSCRIPTION_ID}" \ + --environment AZURE_CLIENT_ID="${AZURE_CLIENT_ID}" \ + --environment AZURE_TENANT="${AZURE_TENANT}" \ --environment CI="RHTAP" \ --environment ARCH="${ARCH}" \ --secret QUAY_USERNAME="${QUAY_USERNAME}" \ @@ -153,6 +170,7 @@ spec: --secret AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY}" \ --secret RHC_AK="${RHC_AK}" \ --secret RHC_ORGID="${RHC_ORGID}" \ + --secret AZURE_SECRET="${AZURE_SECRET}" \ --git-url "${GIT_URL}" \ --git-ref "${GIT_REF}" \ --compose "${COMPOSE}" \ diff --git a/bib-image.sh b/bib-image.sh index 8397ed2..44045b7 100755 --- a/bib-image.sh +++ b/bib-image.sh @@ -138,13 +138,12 @@ localhost [cloud:vars] ansible_connection=local +ansible_python_interpreter=/root/venv/bin/python3 [guest:vars] ansible_user="$SSH_USER" ansible_private_key_file="$SSH_KEY" ansible_ssh_common_args="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" - -[all:vars] ansible_python_interpreter=/usr/bin/python3 EOF diff --git a/os-replace.sh b/os-replace.sh index 96d925d..d219a36 100755 --- a/os-replace.sh +++ b/os-replace.sh @@ -111,6 +111,8 @@ if [[ "$PLATFORM" == "libvirt" ]] && [[ "$LAYERED_IMAGE" != "cloud-init" ]] && [ elif [[ "$PLATFORM" == "aws" ]] && [[ "$LAYERED_IMAGE" != "cloud-init" ]]; then USER_CONFIG="RUN dnf -y install cloud-init && \ ln -s ../cloud-init.target /usr/lib/systemd/system/default.target.wants" +elif [[ "$LAYERED_IMAGE" == "azure" ]]; then + sed -i '/cloud.cfg/d' "$INSTALL_CONTAINERFILE" elif [[ "$LAYERED_IMAGE" == "useradd-ssh" ]]; then sed -i "s|exampleuser|$SSH_USER|g" "$INSTALL_CONTAINERFILE" fi @@ -143,13 +145,12 @@ localhost [cloud:vars] ansible_connection=local +ansible_python_interpreter=/root/venv/bin/python3 [guest:vars] ansible_user="$SSH_USER" ansible_private_key_file="$SSH_KEY" ansible_ssh_common_args="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" - -[all:vars] ansible_python_interpreter=/usr/bin/python3 EOF diff --git a/playbooks/deploy-azure.yaml b/playbooks/deploy-azure.yaml new file mode 100644 index 0000000..f61c3e9 --- /dev/null +++ b/playbooks/deploy-azure.yaml @@ -0,0 +1,153 @@ +--- +- hosts: cloud + gather_facts: false + become: false + vars: + test_os: "{{ lookup('env', 'TEST_OS') | default('centos-stream-9', true) }}" + arch: "{{ lookup('env', 'ARCH') | default('x86_64', true) }}" + ssh_key_pub: "" + inventory_file: "" + download_node: "{{ lookup('env', 'DOWNLOAD_NODE') | default('', true) }}" + rg_image: "bootc-images" + vm_size: + x86_64: Standard_D2ads_v5 + aarch64: Standard_D2pds_v5 + + tasks: + - set_fact: + random_num: "{{ 9999 | random(start=1001) }}" + - set_fact: + rg_name: "bootc-{{ random_num }}" + + - name: Read ssh_key_pub content + command: cat "{{ ssh_key_pub }}" + register: out + + - set_fact: + ssh_pubkey_content: "{{ out.stdout }}" + + - name: List images by resource group + azure_rm_image_info: + resource_group: 'bootc-images' + tags: + - project:bootc + - test_os:{{ test_os }} + - arch:{{ arch }} + register: result_image + + - name: Image name + set_fact: + image: "{{ result_image.images[0].name }}" + + - debug: + var: image + + - name: Create resource group + azure.azcollection.azure_rm_resourcegroup: + name: "{{ rg_name }}" + location: eastus + + - name: Create virtual network + azure.azcollection.azure_rm_virtualnetwork: + resource_group: "{{ rg_name }}" + name: "{{ rg_name }}_vnet" + address_prefixes: "172.30.0.0/16" + + - name: Add subnet + azure.azcollection.azure_rm_subnet: + resource_group: "{{ rg_name }}" + name: "{{ rg_name }}_subnet" + address_prefix: "172.30.30.0/24" + virtual_network: "{{ rg_name }}_vnet" + + - name: Create public IP address + azure.azcollection.azure_rm_publicipaddress: + resource_group: "{{ rg_name }}" + name: "{{ rg_name }}_ip" + allocation_method: Static + register: output_ip_address + + - name: Public IP of VM + set_fact: + instance_ip: "{{ output_ip_address.state.ip_address }}" + + - name: Create Network Security Group that allows SSH + azure.azcollection.azure_rm_securitygroup: + resource_group: "{{ rg_name }}" + name: "{{ rg_name }}_sg" + rules: + - name: SSH + protocol: Tcp + destination_port_range: 22 + access: Allow + priority: 1001 + direction: Inbound + + - name: Create virtual network interface card + azure.azcollection.azure_rm_networkinterface: + resource_group: "{{ rg_name }}" + name: "{{ rg_name }}_nic" + virtual_network: "{{ rg_name }}_vnet" + subnet: "{{ rg_name }}_subnet" + public_ip_name: "{{ rg_name }}_ip" + security_group: "{{ rg_name }}_sg" + + - name: Create VM + azure.azcollection.azure_rm_virtualmachine: + resource_group: "{{ rg_name }}" + name: bootc-{{ test_os }}-{{ random_num }} + vm_size: "{{ vm_size[arch] }}" + priority: Spot + os_type: Linux + storage_container_name: osdisk + network_interface_names: "{{ rg_name }}_nic" + os_disk_size_gb: 64 + boot_diagnostics: + enabled: yes + type: managed + image: + resource_group: "{{ rg_image }}" + name: "{{ image }}" + admin_username: cloud-user + ssh_password_enabled: false + ssh_public_keys: + - path: /home/cloud-user/.ssh/authorized_keys + key_data: "{{ ssh_pubkey_content }}" + register: test_vm + + - debug: + var: test_vm + + - debug: + var: instance_ip + + - name: waits until instance is reachable + wait_for: + host: "{{ instance_ip }}" + port: 22 + search_regex: OpenSSH + delay: 10 + retries: 30 + register: result_ssh_check + until: result_ssh_check is success + + - name: add instance ip into host group guest + add_host: + name: "{{ instance_ip }}" + groups: guest + + - name: Write instance ip to inventory file + community.general.ini_file: + path: "{{ inventory_file }}" + section: guest + option: guest ansible_host + value: "{{ instance_ip }}" + no_extra_spaces: true + + - name: Write resource group to inventory file + community.general.ini_file: + path: "{{ inventory_file }}" + section: cloud:vars + option: rg_name + value: "{{ rg_name }}" + no_extra_spaces: true diff --git a/playbooks/remove.yaml b/playbooks/remove.yaml index d9a41b9..4977a5c 100644 --- a/playbooks/remove.yaml +++ b/playbooks/remove.yaml @@ -71,3 +71,13 @@ - name: "cancel beaker job {{ job_id }}" command: bkr job-cancel "{{ job_id }}" when: platform == "beaker" + + - name: Remove Azure resources + block: + - name: "Delete resource group {{ rg_name }}" + azure.azcollection.azure_rm_resourcegroup: + name: "{{ rg_name }}" + location: eastus + force_delete_nonempty: yes + state: absent + when: platform == "azure" diff --git a/tmt/plans/bib-image.fmf b/tmt/plans/bib-image.fmf index aaf8c73..91d5540 100644 --- a/tmt/plans/bib-image.fmf +++ b/tmt/plans/bib-image.fmf @@ -13,8 +13,12 @@ prepare: - unzip - how: shell script: | + python3 -m venv /root/venv + . /root/venv/bin/activate pip install boto3 botocore openstacksdk - ansible-galaxy collection install openstack.cloud community.general community.libvirt amazon.aws ansible.posix + ansible-galaxy collection install openstack.cloud community.general community.libvirt amazon.aws azure.azcollection ansible.posix + pip3 install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt + deactivate - how: shell script: curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && unzip awscliv2.zip && sudo ./aws/install execute: diff --git a/tmt/plans/os-replace.fmf b/tmt/plans/os-replace.fmf index 2e111a6..f4b6993 100644 --- a/tmt/plans/os-replace.fmf +++ b/tmt/plans/os-replace.fmf @@ -13,8 +13,12 @@ prepare: - unzip - how: shell script: | + python3 -m venv /root/venv + . /root/venv/bin/activate pip install boto3 botocore openstacksdk - ansible-galaxy collection install openstack.cloud community.general community.libvirt amazon.aws ansible.posix + ansible-galaxy collection install openstack.cloud community.general community.libvirt amazon.aws azure.azcollection ansible.posix + pip3 install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt + deactivate - how: shell script: curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && unzip awscliv2.zip && sudo ./aws/install - how: shell @@ -58,6 +62,16 @@ execute: - when: arch != x86_64 and arch != aarch64 enabled: false +/azure: + summary: Run os-replace test on azure + tag: azure + environment+: + PLATFORM: azure + LAYERED_IMAGE: azure + adjust+: + - when: arch != x86_64 and arch != aarch64 + enabled: false + /libvirt: summary: Run os-replace test locally (nested) tag: [libvirt, stable] diff --git a/tools/upload_vhd.sh b/tools/upload_vhd.sh new file mode 100755 index 0000000..ee0c909 --- /dev/null +++ b/tools/upload_vhd.sh @@ -0,0 +1,99 @@ +#!/bin/bash +set -exuo pipefail + +BP=bootc-vhd + +case "$TEST_OS" in +"rhel-9-4") + BASEURL="http://${DOWNLOAD_NODE}/rhel-9/nightly/RHEL-9/latest-RHEL-9.4.0" + ;; +"centos-stream-9") + BASEURL="https://composes.stream.centos.org/production/latest-CentOS-Stream" + ;; +*) + redprint "Variable TEST_OS has to be defined" + exit 1 + ;; +esac + +dnf install -y osbuild-composer composer-cli cockpit-composer +systemctl enable --now osbuild-composer.socket +systemctl enable --now cockpit.socket +systemctl restart osbuild-composer +composer-cli status show +mkdir -p /etc/osbuild-composer/repositories +# shellcheck disable=SC2001 +tee /etc/osbuild-composer/repositories/"$(echo "$TEST_OS" | sed 's/\(.*\)-\(.*\)/\1.\2/')".json >/dev/null </dev/null <