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

chore: improve GHA testing #4

Merged
merged 21 commits into from
Aug 22, 2023
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
19 changes: 13 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
name: test base images
env:
PRODUCT_VERSION: "1.8.6"
on:
pull_request:
types: [ labeled ]
types:
- labeled
- opened
- synchronize
jobs:
base_image_tests:
runs-on:
- self-hosted
- small
strategy:
max-parallel: 3
fail-fast: false
matrix:
os: ["ubuntu", "rocky", "centos", "rhel"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Setup requirements
if: contains(github.event.pull_request.labels.*.name, 'integration_test')
run: |
sudo apt-get update && sudo apt-get -y install xorriso
curl -L -o - "https://github.com/vmware/govmomi/releases/latest/download/govc_$(uname -s)_$(uname -m).tar.gz" | sudo tar -C /usr/local/bin -xvzf - govc
- name: Run integration tests for ${{ matrix.os }}
run: make ${{ matrix.os }}-test
if: ${{ github.event.label.name == 'integration_test' }}
if: contains(github.event.pull_request.labels.*.name, 'integration_test')
env:
VSPHERE_USERNAME: ${{ secrets.VSPHERE_SRE_USERNAME }}
VSPHERE_PASSWORD: ${{ secrets.VSPHERE_SRE_PASSWORD }}
Expand All @@ -31,4 +37,5 @@ jobs:
PKR_VAR_vsphere_datastore: ${{ secrets.VSPHERE_DATASTORE }}
PKR_VAR_vsphere_network: ${{ secrets.VSPHERE_NETWORK }}
PKR_VAR_vsphere_resource_pool: ${{ secrets.VSPHERE_RESOURCE_POOL }}

RHN_SUBSCRIPTION_ORG: ${{ secrets.RHN_SUBSCRIPTION_ORG }}
RHN_SUBSCRIPTION_KEY: ${{ secrets.RHN_SUBSCRIPTION_KEY }}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ ubuntu-release: ubuntu-release-20 ubuntu-release-22

rocky: manifests/d2iq-base-RockyLinux-8.7$(NAME_POSTFIX).json manifests/d2iq-base-RockyLinux-9.1$(NAME_POSTFIX).json
rocky-test-87: manifests/tests/d2iq-base-RockyLinux-8.7$(NAME_POSTFIX).json.clean
rocky-test-87-clean: ubuntu-test-20 manifests/d2iq-base-RockyLinux-8.7$(NAME_POSTFIX).json.clean
rocky-test-87-clean: rocky-test-87 manifests/d2iq-base-RockyLinux-8.7$(NAME_POSTFIX).json.clean
rocky-test-91: manifests/tests/d2iq-base-RockyLinux-9.1$(NAME_POSTFIX).json.clean
rocky-test-91-clean: ubuntu-test-20 manifests/d2iq-base-RockyLinux-9.1$(NAME_POSTFIX).json.clean
rocky-test-91-clean: rocky-test-91 manifests/d2iq-base-RockyLinux-9.1$(NAME_POSTFIX).json.clean
rocky-test: rocky-test-87-clean rocky-test-91-clean
rocky-release-87: rocky-test-87 release/d2iq-base-RockyLinux-8.7$(NAME_POSTFIX)
rocky-release-91: rocky-test-91 release/d2iq-base-RockyLinux-9.1$(NAME_POSTFIX)
Expand Down
87 changes: 87 additions & 0 deletions bootfiles/rocky/rocky-vault.ks
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
cdrom
# Use text mode install
text

# License agreement
eula --agreed

# System language
lang en_US.UTF-8

# Keyboard layout
keyboard --vckeymap=us --xlayouts='us'

# repo setup
url --url=http://dl.rockylinux.org/vault/rocky/${distribution_version}/BaseOS/x86_64/os/
repo --name=AppStream --baseurl=http://dl.rockylinux.org/vault/rocky/${distribution_version}/AppStream/x86_64/os/

# Network information
network --bootproto=dhcp --device=link --activate

### Lock the root account
rootpw --lock

firewall --disabled

# SELinux configuration
selinux --permissive

# Do not configure the X Window System
skipx

# System timezone
timezone UTC

# Add a user named builder
user --name=${ssh_username}
sshkey --username=${ssh_username} "${public_key}"

# System bootloader configuration
bootloader --location=mbr

# Clear the Master Boot Record
zerombr

clearpart --all --initlabel
part / --fstype="ext4" --grow --asprimary --label=slash --ondisk=sda

%packages --excludedocs
# dnf group info minimal-environment
@^minimal-environment
@core
openssh-server
sed
sudo
python3
open-vm-tools

# Exclude unnecessary firmwares
-iwl*firmware
%end

# Enable/disable the following services
services --enabled=sshd

%post --logfile=/mnt/sysimage/root/ks-post.log --erroronfail
# Disable quiet boot and splash screen
sed --follow-symlinks -i "s/ rhgb quiet//" /etc/default/grub
sed --follow-symlinks -i "s/ rhgb quiet//" /boot/grub2/grubenv
# Passwordless sudo for the user '${ssh_username}'
echo "${ssh_username} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/${ssh_username}
chmod 440 /etc/sudoers.d/${ssh_username}

# Remove the package cache
dnf makecache
dnf install epel-release -y
dnf makecache
dnf install -y sudo open-vm-tools perl cloud-init cloud-utils-growpart

# Disable swap
swapoff -a
rm -f /swapfile
sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
sed -i '/^\(HWADDR\|UUID\)=/d' /etc/sysconfig/network-scripts/ifcfg-* || true
%end

# Reboot after successful installation
reboot
2 changes: 1 addition & 1 deletion images/base-RHEL-79.pkrvar.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ distribution="RHEL"
distribution_version="7"
# very specific for D2iQ internal setup. Please use PKR_VAR_iso_path_entry to match your setup. See README.md
iso_paths= [
"[ovh-nfs-services-only] isos/rhel-server-7.9-x86_64-dvd.iso"
"[ovh-nfs-vsphere-services] isos/rhel-server-7.9-x86_64-dvd.iso"
]
iso_checksum="2cb36122a74be084c551bc7173d2d38a1cfb75c8ffbc1489c630c916d1b31b25"
2 changes: 1 addition & 1 deletion images/base-RHEL-84.pkrvar.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ distribution="RHEL"
distribution_version="8"
# very specific for D2iQ internal setup. Please use PKR_VAR_iso_path_entry to match your setup. See README.md
iso_paths= [
"[ovh-nfs-services-only] isos/rhel-8.4-x86_64-dvd.iso"
"[ovh-nfs-vsphere-services] isos/rhel-8.4-x86_64-dvd.iso"
]
iso_checksum="ea5f349d492fed819e5086d351de47261c470fc794f7124805d176d69ddf1fcd"
2 changes: 1 addition & 1 deletion images/base-RHEL-86.pkrvar.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ distribution="RHEL"
distribution_version="8"
# very specific for D2iQ internal setup. Please use PKR_VAR_iso_path_entry to match your setup. See README.md
iso_paths= [
"[ovh-nfs-services-only] isos/rhel-8.6-x86_64-dvd.iso"
"[ovh-nfs-vsphere-services] isos/rhel-8.6-x86_64-dvd.iso"
]
iso_checksum="8cb0dfacc94b789933253d5583a2fb7afce26d38d75be7c204975fe20b7bdf71"
2 changes: 1 addition & 1 deletion images/base-RockyLinux-8.7.pkrvar.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distribution="RockyLinux"
distribution_version="8.7"
iso_url="http://download.rockylinux.org/pub/rocky/8.7/isos/x86_64/Rocky-8.7-x86_64-minimal.iso"
iso_url="https://dl.rockylinux.org/vault/rocky/8.7/isos/x86_64/Rocky-8.7-x86_64-minimal.iso"
iso_checksum="13c3e7fca1fd32df61695584baafc14fa28d62816d0813116d23744f5394624b"
2 changes: 1 addition & 1 deletion images/base-RockyLinux-9.1.pkrvar.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distribution="RockyLinux"
distribution_version="9.1"
iso_url="http://download.rockylinux.org/pub/rocky/9.1/isos/x86_64/Rocky-9.1-20221215.1-x86_64-minimal.iso"
iso_url="https://dl.rockylinux.org/vault/rocky/9.1/isos/x86_64/Rocky-9.1-20221215.1-x86_64-minimal.iso"
iso_checksum="750c373c3206ae79784e436cc94fffc122296cf1bf8129a427dcd6ba7fac5888"
2 changes: 1 addition & 1 deletion images/base-Ubuntu-20.04.pkrvar.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distribution="Ubuntu"
distribution_version="20.04"
iso_url="https://mirror.us.leaseweb.net/ubuntu-releases/20.04/ubuntu-20.04.5-live-server-amd64.iso"
iso_url="https://old-releases.ubuntu.com/releases/20.04.5/ubuntu-20.04.5-live-server-amd64.iso"
iso_checksum="5035be37a7e9abbdc09f0d257f3e33416c1a0fb322ba860d42d74aa75c3468d4"
2 changes: 1 addition & 1 deletion images/base-Ubuntu-22.04.pkrvar.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distribution="Ubuntu"
distribution_version="22.04"
iso_url="https://mirror.us.leaseweb.net/ubuntu-releases/22.04/ubuntu-22.04.1-live-server-amd64.iso"
iso_url="https://old-releases.ubuntu.com/releases/22.04/ubuntu-22.04.1-live-server-amd64.iso"
iso_checksum="10f19c5b2b8d6db711582e0e27f5116296c34fe4b313ba45f9b201a5007056cb"
Empty file added tmp/.gitkeep
Empty file.
15 changes: 8 additions & 7 deletions vsphere.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ variable "firmware" {

variable "ssh_timeout" {
type = string
default = "10m"
default = "30m"
}

variable "ssh_username" {
Expand Down Expand Up @@ -200,12 +200,13 @@ locals {

# lookup by <distro_name>-<distro_version> fallback to <distro_version>
distro_version_bootfile_lookup = {
"RHEL-7" = "${path.root}/bootfiles/rhel/rhel7.ks"
"RHEL" = "${path.root}/bootfiles/rhel/rhel8.ks"
"RockyLinux" = "${path.root}/bootfiles/rocky/rocky.ks"
"CentOS" = "${path.root}/bootfiles/centos/centos7.ks"
"Ubuntu" = "${path.root}/bootfiles/ubuntu/autoinstall.yaml"
"Ubuntu-18.04" = "${path.root}/bootfiles/ubuntu/preseed.cfg"
"RHEL-7" = "${path.root}/bootfiles/rhel/rhel7.ks"
"RHEL" = "${path.root}/bootfiles/rhel/rhel8.ks"
"RockyLinux" = "${path.root}/bootfiles/rocky/rocky.ks"
"RockyLinux-8.7" = "${path.root}/bootfiles/rocky/rocky-vault.ks"
"CentOS" = "${path.root}/bootfiles/centos/centos7.ks"
"Ubuntu" = "${path.root}/bootfiles/ubuntu/autoinstall.yaml"
"Ubuntu-18.04" = "${path.root}/bootfiles/ubuntu/preseed.cfg"
}

el_old_bootcommand = [
Expand Down