forked from joefitzgerald/packer-windows
-
Notifications
You must be signed in to change notification settings - Fork 435
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
qmfrederik
wants to merge
10
commits into
StefanScherer:main
Choose a base branch
from
qmfrederik:fixes/windows-10-ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
284f070
Add Travis CI script
qmfrederik bb0b039
Build VirtualBox image in Azure
qmfrederik e206568
Work around a possible Ansible bug
qmfrederik f7a9947
Build Windows 10, 6 GB memory and 30 GB disk space
qmfrederik 813ec6e
Keep stdout busy
qmfrederik 500afc7
Bump packer verion
qmfrederik 604ae5b
Revert "Update windows_10.json"
qmfrederik cf3141b
Revert "Update windows_10.json"
qmfrederik 6a3aed3
Use Packer 1.6.0
qmfrederik f2e0498
Upload box to Azure storage
qmfrederik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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 |
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
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" | ||
echo "SHA256: `shasum -a 256 ${TEMPLATE}_virtualbox.box`" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think, that should _libvirt.box |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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