Skip to content

Commit

Permalink
Test checksum support
Browse files Browse the repository at this point in the history
  • Loading branch information
assumptionsandg committed Dec 6, 2024
1 parent 711b25d commit b27a0f9
Showing 1 changed file with 133 additions and 44 deletions.
177 changes: 133 additions & 44 deletions .github/workflows/package-build-ofed.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
---
name: Build OFED packages
name: Build IPA images
on:
workflow_dispatch:
inputs:
rocky9:
description: Build Rocky Linux 9
type: boolean
default: true
ubuntu-jammy:
description: Build Ubuntu 22.04 Jammy
type: boolean
default: true
secrets:
KAYOBE_VAULT_PASSWORD:
required: true
Expand All @@ -22,8 +26,8 @@ env:
KAYOBE_ENVIRONMENT: ci-builder
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
jobs:
overcloud-ofed-packages:
name: Build OFED packages
ipa-image-build:
name: Build IPA images
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
runs-on: arc-skc-host-image-builder-runner
permissions: {}
Expand All @@ -42,18 +46,25 @@ jobs:
with:
path: src/kayobe-config

- name: Output image tag of the builder
id: builder_image_tag
run: |
echo image_tag=$(grep stackhpc_rocky_9_overcloud_host_image_version: etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
- name: Determine OpenStack release
id: openstack_release
run: |
BRANCH=$(awk -F'=' '/defaultbranch/ {print $2}' src/kayobe-config/.gitreview)
echo "openstack_release=${BRANCH}" | sed -E "s,(stable|unmaintained)/,," >> $GITHUB_OUTPUT
- name: Clone StackHPC Kayobe repository
uses: actions/checkout@v4
with:
repository: stackhpc/kayobe
ref: refs/heads/stackhpc/${{ steps.openstack_release.outputs.openstack_release }}
path: src/kayobe
- name: Generate IPA image tag
id: ipa_image_tag
run: |
echo "ipa_image_tag=$(date +${{ steps.openstack_release.outputs.openstack_release }}-%Y%m%dT%H%M%S)" >> $GITHUB_OUTPUT
- name: Display IPA image tag
run: |
echo "${{ steps.ipa_image_tag.outputs.ipa_image_tag }}"
- name: Install Kayobe
run: |
Expand All @@ -62,7 +73,7 @@ jobs:
python3 -m venv kayobe &&
source kayobe/bin/activate &&
pip install -U pip &&
pip install ../src/kayobe
pip install -r ../src/kayobe-config/requirements.txt
- name: Install terraform
uses: hashicorp/setup-terraform@v2
Expand All @@ -82,32 +93,20 @@ jobs:
EOF
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio

- name: Output image tag
id: image_tag
run: |
echo image_tag=$(grep stackhpc_rocky_9_overcloud_host_image_version: etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
# Use the image override if set, otherwise use overcloud-os_distribution-os_release-tag
- name: Output image name
id: image_name
run: |
echo image_name=overcloud-rocky-9-${{ steps.image_tag.outputs.image_tag }} >> $GITHUB_OUTPUT
- name: Generate terraform.tfvars
run: |
cat << EOF > terraform.tfvars
ssh_public_key = "id_rsa.pub"
ssh_username = "cloud-user"
aio_vm_name = "skc-ofed-builder"
aio_vm_image = "${{ env.VM_IMAGE }}"
aio_vm_flavor = "en1.medium"
ssh_username = "ubuntu"
aio_vm_name = "skc-ipa-image-builder"
aio_vm_image = "Ubuntu-22.04"
aio_vm_flavor = "en1.large"
aio_vm_network = "stackhpc-ci"
aio_vm_subnet = "stackhpc-ci"
aio_vm_interface = "ens3"
aio_vm_volume_size = 100
EOF
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio
env:
VM_IMAGE: ${{ steps.image_name.outputs.image_name }}

- name: Terraform Plan
run: terraform plan
Expand Down Expand Up @@ -179,70 +178,160 @@ jobs:
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe control host bootstrap
- name: Run growroot playbook
- name: Configure the seed host (Builder VM)
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe playbook run src/kayobe-config/etc/kayobe/ansible/growroot.yml
kayobe seed host configure \
-e seed_bootstrap_user=ubuntu \
--skip-tags network,apt,docker,docker-registry
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}

- name: Configure the seed host (Builder VM)
- name: Install dependencies
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe seed host command run \
--command "sudo apt update && sudo apt -y install gcc git libffi-dev python3-dev python-is-python3 python3-venv" --show-output
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}

- name: Build a Ubuntu 22.04 Jammy IPA image
id: build_ubuntu_jammy_ipa
continue-on-error: true
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe seed host configure --skip-tags network,docker
kayobe overcloud deployment image build --force-rebuild \
-e os_distribution="ubuntu" \
-e os_release="jammy" \
-e ipa_ci_builder_distribution="ubuntu"
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.ubuntu-jammy

- name: Run a distro-sync
- name: Show last error logs
continue-on-error: true
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe seed host command run --become --command "dnf distro-sync --refresh"
kayobe seed host command run --command "tail -200 /opt/kayobe/images/ipa/ipa.stdout" --show-output
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: steps.build_ubuntu_jammy_ipa.outcome == 'failure'

- name: Reset BLS entries on the seed host
- name: Upload Ubuntu 22.04 Jammy IPA kernel image to Ark
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe playbook run src/kayobe-config/etc/kayobe/ansible/reset-bls-entries.yml \
-e "reset_bls_host=ofed-builder"
kayobe playbook run \
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
-e artifact_path=/opt/kayobe/images/ipa \
-e artifact_type=ipa \
-e artifact_tag=${{ steps.ipa_image_tag.outputs.ipa_image_tag }} \
-e os_distribution="ubuntu" \
-e os_release="jammy" \
-e file_regex='*.kernel' \
-e upload_checksum=true
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.ubuntu-jammy && steps.build_ubuntu_jammy_ipa.outcome == 'success'

- name: Disable noexec in /var/tmp
- name: Upload Ubuntu 22.04 Jammy IPA ramdisk image to Ark
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe seed host command run --become --command "sed -i 's/noexec,//g' /etc/fstab"
kayobe playbook run \
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
-e artifact_path=/opt/kayobe/images/ipa \
-e artifact_type=ipa \
-e artifact_tag=${{ steps.ipa_image_tag.outputs.ipa_image_tag }} \
-e os_distribution="ubuntu" \
-e os_release="jammy" \
-e file_regex='*.initramfs' \
-e upload_checksum=true
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.ubuntu-jammy && steps.build_ubuntu_jammy_ipa.outcome == 'success'

- name: Reboot to apply the kernel update
- name: Build a Rocky 9 IPA image
id: build_rocky_9_ipa
continue-on-error: true
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe playbook run src/kayobe-config/etc/kayobe/ansible/reboot.yml
kayobe overcloud deployment image build --force-rebuild \
-e os_distribution="rocky" \
-e os_release="9" \
-e ipa_ci_builder_distribution="rocky"
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.rocky9

- name: Run OFED builder playbook
- name: Show last error logs
continue-on-error: true
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe playbook run src/kayobe-config/etc/kayobe/ansible/build-ofed-rocky.yml
kayobe seed host command run --command "tail -200 /opt/kayobe/images/ipa/ipa.stdout" --show-output
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: steps.build_rocky_9_ipa.outcome == 'failure'

- name: Run OFED upload playbook
- name: Upload Rocky 9 IPA kernel image to Ark
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe playbook run src/kayobe-config/etc/kayobe/ansible/push-ofed.yml
kayobe playbook run \
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
-e artifact_path=/opt/kayobe/images/ipa \
-e artifact_type=ipa \
-e artifact_tag=${{ steps.ipa_image_tag.outputs.ipa_image_tag }} \
-e os_distribution="rocky" \
-e os_release="9" \
-e file_regex='*.kernel' \
-e upload_checksum=true
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.rocky9 && steps.build_rocky_9_ipa.outcome == 'success'

- name: Upload Rocky 9 IPA ramdisk image to Ark
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe playbook run \
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
-e artifact_path=/opt/kayobe/images/ipa \
-e artifact_type=ipa \
-e artifact_tag=${{ steps.ipa_image_tag.outputs.ipa_image_tag }} \
-e os_distribution="rocky" \
-e os_release="9" \
-e file_regex='*.initramfs' \
-e upload_checksum=true
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.rocky9 && steps.build_rocky_9_ipa.outcome == 'success'

- name: Copy logs back
continue-on-error: true
run: |
mkdir logs
scp -r ubuntu@$(jq -r .access_ip_v4.value src/kayobe-config/etc/kayobe/environments/ci-builder/tf-outputs.yml):/opt/kayobe/images/*/*.std* ./logs/
if: always()

- name: Upload logs artifact
uses: actions/upload-artifact@v4
with:
name: Build logs
path: ./logs

- name: Fail if the IPA image build failed
run: |
echo "Builds failed. See workflow artifacts for details." &&
exit 1
if: steps.build_rocky_9_ipa.outcome == 'failure' ||
steps.build_ubuntu_jammy_ipa.outcome == 'failure'

- name: Destroy
run: terraform destroy -auto-approve
Expand Down

0 comments on commit b27a0f9

Please sign in to comment.