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

Windows 10: Add VirtualBox, KVM CI #270

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
39 changes: 39 additions & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
jobs:
- job: build
pool:
vmImage: 'macOS-10.15'
timeoutInMinutes: 300
strategy:
maxParallel: 4
matrix:
windows_10:
template: windows_10
steps:
- bash: |
wget -nv -nc -O packer_1.6.0_darwin_amd64.zip https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_darwin_amd64.zip
sudo unzip -o packer_1.6.0_darwin_amd64.zip -d /usr/local/bin
displayName: Install Packer
- bash: |
pip install --user ansible
pip install pywinrm
ln -s /Users/runner/Library/Python/2.7/bin/ansible /usr/local/bin/ansible
ln -s /Users/runner/Library/Python/2.7/bin/ansible-playbook /usr/local/bin/ansible-playbook
displayName: Install Ansible
- bash: |
packer --version
ansible --version
ansible-playbook --version
vboxmanage --version
sysctl -a | grep machdep.cpu
sysctl -a | grep mem
df -h .
displayName: Dump software version
- bash: |
# Set PACKER_LOG to 1 to troubleshoot infrastructure issues
# export PACKER_LOG=1
export PACKER_CACHE_DIR=$(Agent.BuildDirectory)/packer_cache/
# See https://github.com/ansible/ansible/issues/49207
# See https://github.com/ansible/ansible/issues/32499
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
packer build --only=virtualbox-iso --var memory_size=6144 --var disk_size=30720 $(template).json
displayName: Build box
59 changes: 59 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
sudo: true
language: bash
dist: focal

jobs:
include:
- env: PROVIDER=qemu TEMPLATE=windows_10 VIRT_GROUP=kvm PACKER_VERSION=1.6.0 PACKER_LOG=1

install:
# Install Packer.
- wget -nv -nc -O packer_${PACKER_VERSION}_linux_amd64.zip https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip
- sudo unzip -o packer_${PACKER_VERSION}_linux_amd64.zip -d /usr/local/bin

# Install ansible
- sudo add-apt-repository -y ppa:ansible/ansible
- sudo apt-get update
- sudo apt-get install -yq --no-install-suggests --no-install-recommends ansible
- pip install pywinrm

# Install qemu-kvm
- if [ $PROVIDER == "qemu" ]; then sudo apt-get install -yq --no-install-suggests --no-install-recommends qemu-kvm qemu-utils; fi

# Set up group membership
- sudo adduser $USER $VIRT_GROUP

# Dump versions of available software
- lsb_release -a
- uname -r
- if [ $PROVIDER == "qemu" ]; then qemu-system-x86_64 --version; fi
- packer --version
- ansible --version

# Dump group membership
- groups
- sudo sudo -u $USER -g $VIRT_GROUP groups
- sudo -E su $USER -c 'groups'

# Dump CPU information
- cat /proc/cpuinfo

script:
# Ping stdout every 9 minutes to prevent Travis from terminating the buidl.
- |
while sleep 9m; do
echo "====[ This job has been running for $SECONDS ]===="
done &
# Download the virtio-win iso
- wget -nv -nc https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso -O ~/virtio-win.iso
# See here https://github.com/travis-ci/travis-ci/issues/1839 for background on the sudo sudo command
- sudo -E su $USER -c 'packer build --only=${PROVIDER} --var virtio_win_iso=~/virtio-win.iso --var memory_size=6144 --var disk_size=30720 ${TEMPLATE}.json'

after_success:
# Upload the resulting box to Azure Storage
- |
sha256sum ${TEMPLATE}_libvirt.box
az storage blob upload --auth-mode=key --account-name=${AZURE_STORAGE_ACCOUNT} --account-key=${AZURE_STORAGE_KEY} --container-name boxes --file ${TEMPLATE}_libvirt.box --name ${TRAVIS_JOB_ID}/${TEMPLATE}_libvirt.box
echo "The box has been uploaded to Azure Storage:"
echo "URL: https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/boxes/${TRAVIS_JOB_ID}/${TEMPLATE}_virtualbox.box"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think, that should _libvirt.box

echo "SHA256: `shasum -a 256 ${TEMPLATE}_virtualbox.box`"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think, that should _libvirt.box

6 changes: 1 addition & 5 deletions windows_10.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,14 @@
],
"headless": true,
"iso_checksum": "{{user `iso_checksum`}}",
"iso_url": "{{user `iso_url`}}",
"iso_url": "{{user `iso_url`}}",
"memory": "{{user `memory`}}",
"output_directory": "windows_10-qemu",
"qemuargs": [
[
"-drive",
"file=windows_10-qemu/{{ .Name }},if=virtio,cache=writeback,discard=ignore,format=qcow2,index=1"
],
[
"-drive",
"file={{ user `iso_url` }},media=cdrom,index=2"
],
[
"-drive",
"file={{ user `virtio_win_iso` }},media=cdrom,index=3"
Expand Down