diff --git a/.github/workflows/overcloud-host-image-build.yml b/.github/workflows/overcloud-host-image-build.yml index 019a4ee72..ba657de4f 100644 --- a/.github/workflows/overcloud-host-image-build.yml +++ b/.github/workflows/overcloud-host-image-build.yml @@ -1,5 +1,5 @@ --- -name: Build overcloud host images +name: Build Amphora image on: workflow_dispatch: inputs: @@ -27,17 +27,11 @@ env: KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} jobs: overcloud-host-image-build: - name: Build overcloud host images + name: Build Amphora image if: github.repository == 'stackhpc/stackhpc-kayobe-config' runs-on: arc-skc-host-image-builder-runner permissions: {} steps: - - name: Validate inputs - run: | - if [[ ${{ inputs.rocky9 }} == 'false' && ${{ inputs.ubuntu-jammy }} == 'false' ]]; then - echo "At least one distribution must be selected" - exit 1 - fi - name: Install Package uses: ConorMacBride/install-package@main @@ -62,6 +56,7 @@ jobs: id: openstack_release run: | BRANCH=$(awk -F'=' '/defaultbranch/ {print $2}' src/kayobe-config/.gitreview) + echo "BRANCH=$BRANCH" >> $GITHUB_OUTPUT echo "openstack_release=${BRANCH}" | sed -E "s,(stable|unmaintained)/,," >> $GITHUB_OUTPUT # Generate a tag to apply to all built overcloud host images. @@ -198,146 +193,88 @@ jobs: 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 + --command "sudo apt update && sudo apt -y install gcc git libffi-dev python3-dev python-is-python3 python3-venv python3-diskimage-builder pip debootstrap qemu-utils kpartx" --show-output env: KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} - - name: Create bifrost_httpboot Docker volume + - name: Clone Octavia source code run: | source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && - kayobe seed host command run --command "sudo mkdir -p /var/lib/docker/volumes/bifrost_httpboot/_data" --show-output - env: - KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} + kayobe seed host command run \ + --command "git clone https://opendev.org/openstack/octavia -b ${{ steps.openstack_release.outputs.BRANCH }} ~/octavia" --show-output - - name: Build a Rocky Linux 9 overcloud host image - id: build_rocky_9 - continue-on-error: true + - name: Install diskimage-builder run: | source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && - kayobe overcloud host image build --force-rebuild \ - -e os_distribution="rocky" \ - -e os_release="9" \ - -e stackhpc_overcloud_dib_name=overcloud-rocky-9 - env: - KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} - if: inputs.rocky9 + kayobe seed host command run \ + --command "pip install diskimage-builder" --show-output - - name: Show last error logs - continue-on-error: true + - name: Clone diskimage-builder source code run: | source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && - kayobe seed host command run --command "tail -200 /opt/kayobe/images/overcloud-rocky-9/overcloud-rocky-9.stdout" --show-output - env: - KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} - if: steps.build_rocky_9.outcome == 'failure' + kayobe seed host command run \ + --command "git clone https://opendev.org/openstack/diskimage-builder ~/diskimage-builder" --show-output - - name: Upload Rocky Linux 9 overcloud host image to Ark + - name: Create build log file 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/overcloud-rocky-9 \ - -e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ - -e artifact_type="kayobe-images" \ - -e file_regex="*.qcow2" \ - -e os_distribution="rocky" \ - -e os_release="9" - env: - KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} - if: inputs.rocky9 && steps.build_rocky_9.outcome == 'success' + kayobe seed host command run \ + --command "touch ~/octavia-amphora-image-build.log" --show-output - - name: Upload Rocky Linux 9 overcloud host image to Dev Cloud + - name: Install Amphora image build dependencies run: | source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && - kayobe playbook run \ - src/kayobe-config/etc/kayobe/ansible/openstack-host-image-upload.yml \ - -e local_image_path="/opt/kayobe/images/overcloud-rocky-9/overcloud-rocky-9.qcow2" \ - -e image_name=overcloud-rocky-9-${{ steps.image_tag.outputs.image_tag }} - env: - CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }} - OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} - OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }} - if: inputs.rocky9 && steps.build_rocky_9.outcome == 'success' + kayobe seed host command run \ + --command "pip install -r ~/octavia/diskimage-create/requirements.txt" --show-output - - name: Build an Ubuntu Jammy 22.04 overcloud host image - id: build_ubuntu_jammy - continue-on-error: true + - name: Create Amphora image + id: build_amphora run: | source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && - kayobe overcloud host image build --force-rebuild \ - -e os_distribution="ubuntu" \ - -e os_release="jammy" \ - -e stackhpc_overcloud_dib_name=overcloud-ubuntu-jammy - env: - KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} - if: inputs.ubuntu-jammy + kayobe seed host command run \ + --command "~/octavia/diskimage-create/diskimage-create.sh -i ubuntu-minimal -s 3 -t qcow2 -o ~/amphora-x64-haproxy.qcow2 -g ${{ steps.openstack_release.outputs.BRANCH }} -w ~/octavia/diskimage-create/ >> ~/octavia-amphora-image-build.log 2>&1" --show-output - 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 --command "tail -200 /opt/kayobe/images/overcloud-ubuntu-jammy/overcloud-ubuntu-jammy.stdout" --show-output - env: - KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} - if: steps.build_ubuntu_jammy.outcome == 'failure' - - - name: Upload Ubuntu Jammy 22.04 overcloud host 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/overcloud-ubuntu-jammy \ - -e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ - -e artifact_type="kayobe-images" \ - -e file_regex="*.qcow2" \ - -e os_distribution="ubuntu" \ - -e os_release="jammy" + kayobe seed host command run --command "tail -200 ~/octavia-amphora-image-build.log" --show-output env: KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} - if: inputs.ubuntu-jammy && steps.build_ubuntu_jammy.outcome == 'success' + if: steps.build_amphora.outcome == 'failure' - - name: Upload Ubuntu Jammy overcloud host image to Dev Cloud + - name: Copy Amphora image back + 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/openstack-host-image-upload.yml \ - -e local_image_path="/opt/kayobe/images/overcloud-ubuntu-jammy/overcloud-ubuntu-jammy.qcow2" \ - -e image_name=overcloud-ubuntu-jammy-${{ steps.image_tag.outputs.image_tag }} - env: - CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }} - OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} - OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }} - if: inputs.ubuntu-jammy && steps.build_ubuntu_jammy.outcome == 'success' + mkdir artifact + scp stack@$(jq -r .access_ip_v4.value src/kayobe-config/etc/kayobe/environments/ci-builder/tf-outputs.yml):~/amphora-x64-haproxy.qcow2 ./artifact + if: steps.build_amphora.outcome == 'success' - - name: Copy logs back + - name: Copy logback 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/ - scp -r ubuntu@$(jq -r .access_ip_v4.value src/kayobe-config/etc/kayobe/environments/ci-builder/tf-outputs.yml):/tmp/updated_images.txt ./logs/ || true + mkdir artifact + scp stack@$(jq -r .access_ip_v4.value src/kayobe-config/etc/kayobe/environments/ci-builder/tf-outputs.yml):~/octavia-amphora-image-build.log ./artifact if: always() - name: Fail if any overcloud host image builds failed run: | echo "Builds failed. See workflow artifacts for details." && exit 1 - if: steps.build_rocky_9.outcome == 'failure' || - steps.build_ubuntu_jammy.outcome == 'failure' + if: steps.build_amphora.outcome == 'failure' - - name: Upload logs artifact + - name: Upload logs & image artifact uses: actions/upload-artifact@v4 with: - name: Build logs - path: ./logs + name: Build-result + path: ./artifact if: always() - name: Destroy