v0.9.0 #120
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: | |
- dev | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Packer cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/packer | |
key: ${{ runner.os }}-packer | |
- name: Install Dependencies | |
run: brew install xmlstarlet | |
- name: Remove network config for VirtualBox 6 compatibility | |
run: sed -i '' '/localhostreachable/d' foundry-appliance.pkr.hcl | |
- name: Build VirtualBox OVF image | |
uses: nick-fields/retry@v2 | |
env: | |
GITHUB_PULL_REQUEST: ${{ github.event.number }} | |
with: | |
timeout_minutes: 40 | |
max_attempts: 5 | |
command: ./build-appliance virtualbox -force | |
- name: Get build_name from OVF file | |
run: echo "build_name=$(sh -c "find . -name '*.ovf' | xargs basename -s '.ovf'")" >> $GITHUB_ENV | |
working-directory: ./output-virtualbox | |
- name: Improve OVF VMware compatibility | |
run: | | |
xml ed --inplace \ | |
-N ns='http://schemas.dmtf.org/ovf/envelope/1' \ | |
-N vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" \ | |
-u "//ns:System/vssd:VirtualSystemType" \ | |
-v "vmx-13" \ | |
${{ env.build_name }}.ovf | |
xml ed --inplace \ | |
-N ns='http://schemas.dmtf.org/ovf/envelope/1' \ | |
-N rasd='http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData' \ | |
-d "//ns:Item[rasd:ResourceSubType[contains(text(), 'PIIX4')]]" \ | |
${{ env.build_name }}.ovf | |
xml ed --inplace \ | |
-N ns='http://schemas.dmtf.org/ovf/envelope/1' \ | |
-d "//ns:StorageController[@type='PIIX4']" \ | |
${{ env.build_name }}.ovf | |
working-directory: ./output-virtualbox | |
- name: Create OVA manifest | |
run: openssl sha256 *.ovf *.vmdk > ${{ env.build_name }}.mf | |
working-directory: ./output-virtualbox | |
- name: Package OVA image | |
run: tar -cvf ../${{ env.build_name }}.ova --format=ustar ${{ env.build_name }}{.ovf,-disk001.vmdk,.mf} | |
working-directory: ./output-virtualbox | |
- name: Upload OVA to Azure Storage | |
run: | | |
az cloud set --name AzureUSGovernment | |
az storage blob upload --file ${{ env.build_name }}.ova \ | |
--container-name ova \ | |
--name appliance/${{ env.build_name }}.ova \ | |
--connection-string "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}" \ | |
--no-progress |