diff --git a/.github/workflows/release-vsphere-template.yaml b/.github/workflows/release-vsphere-template.yaml index 88323bbac..0d5e1f722 100644 --- a/.github/workflows/release-vsphere-template.yaml +++ b/.github/workflows/release-vsphere-template.yaml @@ -10,7 +10,7 @@ jobs: build-e2e: strategy: fail-fast: false - max-parallel: 3 + max-parallel: 10 matrix: include: - os: "redhat 8.4" @@ -22,7 +22,7 @@ jobs: - os: "redhat 8.4" buildConfig: "offline-fips" - os: "ubuntu 20.04" - buildConfig: "offline" + buildConfig: "basic" - os: "rocky 9.1" buildConfig: "offline" - os: "flatcar" diff --git a/.github/workflows/vsphere-e2e.yaml b/.github/workflows/vsphere-e2e.yaml index a11b40450..a4ae3ad15 100644 --- a/.github/workflows/vsphere-e2e.yaml +++ b/.github/workflows/vsphere-e2e.yaml @@ -12,7 +12,7 @@ jobs: rune2e: strategy: fail-fast: false - max-parallel: 5 + max-parallel: 8 matrix: include: - os: "redhat 7.9" @@ -33,8 +33,12 @@ jobs: buildConfig: "offline-fips" - os: "ubuntu 20.04" buildConfig: "offline" + - os: "ubuntu 20.04" + buildConfig: "basic" - os: "rocky 9.1" buildConfig: "offline" + - os: "rocky 9.1" + buildConfig: "basic" - os: "flatcar" buildConfig: "basic" runs-on: diff --git a/ansible/roles/providers/tasks/main.yml b/ansible/roles/providers/tasks/main.yml index 8be5634c3..448cf3640 100644 --- a/ansible/roles/providers/tasks/main.yml +++ b/ansible/roles/providers/tasks/main.yml @@ -30,3 +30,8 @@ - include_tasks: misc.yml when: packer_builder_type and packer_builder_type != "" + +- include_tasks: vmware-redhat.yaml + when: + - packer_builder_type is search('vmware') or packer_builder_type is search('vsphere') + - ansible_os_family == "RedHat" diff --git a/ansible/roles/providers/tasks/vmware-redhat.yaml b/ansible/roles/providers/tasks/vmware-redhat.yaml new file mode 100644 index 000000000..428d43abf --- /dev/null +++ b/ansible/roles/providers/tasks/vmware-redhat.yaml @@ -0,0 +1,52 @@ +- name: Get package facts + ansible.builtin.package_facts: + manager: "auto" + +- name: Set cloud-init version + ansible.builtin.set_fact: + cloud_init_version: "{{ ansible_facts.packages['cloud-init'][0].version }}" + +# this program used by ds-identify to determine whether or not the +# VMwareGuestInfo datasource is useable. +- name: Directly install GuestInfo + when: cloud_init_version is version('21.3', '<') + block: + + - name: Copy vmware guestinfo datasource + copy: + src: "{{ item }}" + dest: /tmp/ + owner: root + group: root + mode: 0755 + with_items: + - cloud-init-vmware.sh + - DataSourceVMwareGuestInfo.py + + - name: Create ds-check program to verify VMwareGuestInfo datasource + copy: + src: files/dscheck_VMwareGuestInfo.sh + dest: /usr/bin/dscheck_VMwareGuestInfo + owner: root + group: root + mode: 0755 + + - name: Execute cloud-init-vmware.sh + shell: bash -o errexit -o pipefail /tmp/cloud-init-vmware.sh + environment: + VMWARE_DS_PATH: '/tmp/DataSourceVMwareGuestInfo.py' + + - name: Remove cloud-init-vmware.sh + file: + path: /tmp/cloud-init-vmware.sh + state: absent + + # sets the datasource_list to VMwareGuestInfo for all OS + # ensure that VMwareGuestInfo overrides existing datasource drop-ins if it exists. + - name: Copy cloud-init config file for vmware + copy: + src: files/etc/cloud/cloud.cfg.d/99-DataSourceVMwareGuestInfo.cfg + dest: /etc/cloud/cloud.cfg.d/99-DataSourceVMwareGuestInfo.cfg + owner: root + group: root + mode: 0644 diff --git a/ansible/roles/providers/tasks/vmware.yml b/ansible/roles/providers/tasks/vmware.yml index 3b65a2f01..80b0225b5 100644 --- a/ansible/roles/providers/tasks/vmware.yml +++ b/ansible/roles/providers/tasks/vmware.yml @@ -25,6 +25,7 @@ - cloud-initramfs-dyn-netconf when: ansible_os_family == "Debian" + - name: Install cloud-init packages yum: name: "{{ packages }}" @@ -58,36 +59,6 @@ packages: "cloud-init cloud-utils python3-netifaces" when: ansible_os_family == "VMware Photon OS" -# pip on CentOS needs to be upgraded, but since it's still -# Python 2.7, need < 21.0 -- name: Upgrade pip - pip: - name: pip<21.0 - extra_args: "{{ '--no-index --find-links=' + pip_packages_remote_filesystem_repo_path if offline_mode_enabled }}" - state: forcereinstall - when: ansible_os_family == "RedHat" and ansible_distribution_major_version == '7' - -- name: Copy vmware guestinfo datasource - copy: - src: "{{ item }}" - dest: /tmp/ - owner: root - group: root - mode: 0755 - with_items: - - cloud-init-vmware.sh - - DataSourceVMwareGuestInfo.py - when: ansible_os_family != "Flatcar" - -- name: Copy cloud-init config file for vmware - copy: - src: files/etc/cloud/cloud.cfg.d/99-DataSourceVMwareGuestInfo.cfg - dest: /etc/cloud/cloud.cfg.d/99-DataSourceVMwareGuestInfo.cfg - owner: root - group: root - mode: 0644 - when: ansible_os_family != "Flatcar" - - name: Remove subiquity-disable-cloudinit-networking.cfg file: path: /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg @@ -100,29 +71,6 @@ state: absent when: ansible_os_family != "Flatcar" -# this program used by ds-identify to determine whether or not the -# VMwareGuestInfo datasource is useable. -- name: Create ds-check program to verify VMwareGuestInfo datasource - copy: - src: files/dscheck_VMwareGuestInfo.sh - dest: /usr/bin/dscheck_VMwareGuestInfo - owner: root - group: root - mode: 0755 - when: ansible_os_family != "Flatcar" - -- name: Execute cloud-init-vmware.sh - shell: bash -o errexit -o pipefail /tmp/cloud-init-vmware.sh - environment: - VMWARE_DS_PATH: '/tmp/DataSourceVMwareGuestInfo.py' - when: ansible_os_family != "Flatcar" - -- name: Remove cloud-init-vmware.sh - file: - path: /tmp/cloud-init-vmware.sh - state: absent - when: ansible_os_family != "Flatcar" - - name: >- Remove cloud-init /etc/cloud/cloud.cfg.d/99-disable-networking-config.cfg file: @@ -166,15 +114,15 @@ when: ('ufw.service' in ansible_facts.services) and (ansible_os_family == "Debian") # See https://kb.vmware.com/s/article/82229 -# From systemd docs: -# "If a valid D-Bus machine ID is already configured for the system, +# From systemd docs: +# "If a valid D-Bus machine ID is already configured for the system, # the D-Bus machine ID is copied and used to initialize the machine ID in /etc/machine-id" # This needs to be reset/truncated as well on Ubuntu. - name: Truncate D-Bus machine-id file: path: /var/lib/dbus/machine-id state: absent - when: ansible_os_family == "Debian" + when: ansible_os_family == "Debian" - name: Link D-Bus machine-id to /etc/machine-id file: diff --git a/magefile.go b/magefile.go index 4da43ec28..a157935b9 100644 --- a/magefile.go +++ b/magefile.go @@ -140,14 +140,14 @@ func RunE2e(buildOS, buildConfig, buildInfra string, dryRun bool) error { } } - if buildOS == "flatcar" && buildInfra == ova { - flatcarOverride := "packer-ova-flatcar-override.yaml" - flatcarOverrideFlag := fmt.Sprintf("--overrides=%s", flatcarOverride) - overrideFlagForCmd = append(overrideFlagForCmd, flatcarOverrideFlag) - fmt.Printf("making flatcar override %s \n", flatcarOverride) + if buildConfig == basic && buildInfra == ova { + basicOverride := "packer-ova-basic-override.yaml" + basicOverrideFlag := fmt.Sprintf("--overrides=%s", basicOverride) + overrideFlagForCmd = append(overrideFlagForCmd, basicOverrideFlag) + fmt.Printf("making basic override %s \n", basicOverride) // TODO: @faiq - move this to mage - if err := sh.RunV("make", flatcarOverride); err != nil { - return fmt.Errorf("failed to override for flatcar ova %s %v", flatcarOverride, err) + if err := sh.RunV("make", basicOverride); err != nil { + return fmt.Errorf("failed to override for basic ova %s %v", basicOverride, err) } } @@ -391,18 +391,19 @@ func downloadAirgappedArtifacts(buildOS, buildConfig string) error { if err := fetchPipPackages(artifactsDir); err != nil { return fmt.Errorf("failed to fetch pip packages %w", err) } - if buildConfig == offlineNvidia { + isGPU := buildConfig == offlineNvidia + if isGPU { if err := fetchNvidiaRunFile(); err != nil { return fmt.Errorf("failed to fetch nvidiaRunFile %w", err) } } - if err := createOSBundle(buildOS, kubeVersion, artifactsDir, isFips); err != nil { + if err := createOSBundle(buildOS, kubeVersion, artifactsDir, isFips, isGPU); err != nil { return fmt.Errorf("failed to fetch OS bundle %w", err) } return nil } -func createOSBundle(osName, kubernetesVersion, downloadDir string, fips bool) error { +func createOSBundle(osName, kubernetesVersion, downloadDir string, fips, gpu bool) error { osInfo := strings.Replace(osName, " ", "-", 1) args := []string{ "create-package-bundle", fmt.Sprintf("--os=%s", osInfo), @@ -411,6 +412,12 @@ func createOSBundle(osName, kubernetesVersion, downloadDir string, fips bool) er if fips { args = append(args, "--fips=true") } + if osName == "redhat 8.8" || osName == "redhat 8.6" { + args = append(args, "--enable-eus-repos=true") + } + if gpu { + args = append(args, "--fetch-kernel-headers=true") + } return sh.RunV(wrapperCmd, args...) } diff --git a/test/infra/Makefile b/test/infra/Makefile index 9f796a3bd..c469e8e0c 100644 --- a/test/infra/Makefile +++ b/test/infra/Makefile @@ -77,8 +77,8 @@ packer-aws-offline-override.yaml: infra.aws.create install-envsubst packer-ova-offline-override.yaml: infra.vsphere.create install-envsubst @$(INFRA_MODULES_DIR)/vsphere/export.sh $@ -packer-ova-flatcar-override.yaml: install-envsubst - "${ENVSUBST_ASSETS}"/envsubst < "$(INFRA_MODULES_DIR)"/vsphere/packer-vsphere-flatcar.yaml.tmpl > $@ +packer-ova-basic-override.yaml: install-envsubst + "${ENVSUBST_ASSETS}"/envsubst < "$(INFRA_MODULES_DIR)"/vsphere/packer-vsphere-basic.yaml.tmpl > $@ .PHONY: infra.aws.destroy infra.aws.destroy: ## Destroy infrastructure diff --git a/test/infra/vsphere/packer-vsphere-flatcar.yaml.tmpl b/test/infra/vsphere/packer-vsphere-basic.yaml.tmpl similarity index 100% rename from test/infra/vsphere/packer-vsphere-flatcar.yaml.tmpl rename to test/infra/vsphere/packer-vsphere-basic.yaml.tmpl