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

Hyper-V: Ubuntu 20.04 #72

Closed
saltydk opened this issue Dec 8, 2020 · 17 comments
Closed

Hyper-V: Ubuntu 20.04 #72

saltydk opened this issue Dec 8, 2020 · 17 comments

Comments

@saltydk
Copy link

saltydk commented Dec 8, 2020

Any chance an option to build an image using focal could be added?

@FeodorFitsner
Copy link
Member

Could you please elaborate on your use case?

@saltydk
Copy link
Author

saltydk commented Dec 8, 2020

I'm hosting an Appveyor Server and running builds on Hyper-V cloud. Need more detail than that?

@FeodorFitsner
Copy link
Member

If you have Ubuntu 18.04 image you can just upgrade it to 20.04, right?

@saltydk
Copy link
Author

saltydk commented Dec 8, 2020

I've only used the commands that Appveyor (When adding Hyper-V cloud) suggests when adding a cloud to build images. I'm not sure I'd know where to start when it comes to manually editing these.

@saltydk
Copy link
Author

saltydk commented Jun 1, 2021

If you have Ubuntu 18.04 image you can just upgrade it to 20.04, right?

I imported the image in Hyper-V ran through the upgrade process and appveyor builds stopped working on the upgraded image. I'd appreciate some help on how to go about 'just upgrading' it.

@FeodorFitsner
Copy link
Member

It's not that trivial to get Hyper-V running on Ubuntu. Typically, it's Hyper-V daemons failing to start on VM boot. For AppVeyor integration it's KVP daemon for exchanging data between host and guest operating systems. It must be running. You may find more info about its troubleshooting here: https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/manage/manage-hyper-v-integration-services#start-and-stop-an-integration-service-from-a-linux-guest

@saltydk
Copy link
Author

saltydk commented Jun 5, 2021

Those all look fine. The appveyor-build-agent.service complains about not being able to restart /etc/init.d/networking

@saltydk
Copy link
Author

saltydk commented Jun 5, 2021

I'm struggling to find what is different between the 18.04 and 20.04 VMs. Would appreciate some guidance or a working packer profile for 20.04 since you guys seem to have it running already on your own systems.

@FeodorFitsner
Copy link
Member

Sure, this is the working script we use to bootstrap Ubuntu image on Hyper-V: https://gist.github.com/FeodorFitsner/4131fdf6e68ab76a0cfc1a4e938c749f

It assumes you have a Hyper-V VM with a freshly installed Ubuntu with internet access and appveyor user created (with a password known to you).

Hope that helps.

@saltydk
Copy link
Author

saltydk commented Jun 6, 2021

That worked! Thank you so much.

@saltydk
Copy link
Author

saltydk commented Jun 7, 2021

Any plans to create a packer profile for 20.04?

@FeodorFitsner
Copy link
Member

FeodorFitsner commented Jun 9, 2021

Based on our experience it's really challenging to make Packer working right with Hyper-V directly from ISO - the whole process usually is unreliable and based on timeouts/retries. Instead, we pre-create "base" VMs manually with just build agent installed (the script from above) and then build images from AppVeyor: https://ci.appveyor.com/project/AppVeyor/build-images-linux Unfortunately, this functionality is not available for BYOC right now (but I think could be easily added), but for "custom build images" only.

@saltydk
Copy link
Author

saltydk commented Jun 9, 2021

Would be sweet if the image bake (which I'm assuming is what you meant) would be a thing on BYOC.

@saltydk
Copy link
Author

saltydk commented Jun 9, 2021

On a related note, would it be possible to add the ability to specify how many pre-heated VMs a particular image gets? Once you start getting a few images that only really need one instance it seems to work against you.

@FeodorFitsner
Copy link
Member

You need to create a separate Hyper-V cloud for each image if you need it pre-heated, ultimately one cloud per image.

Re: bake - actually, if you look at build script it's pretty trivial. You can take "base" image with build agent (which I assume you already have and run a few lines while logged into it (from here):

curl -fsSL "https://github.com/appveyor/build-images/archive/master.tar.gz" -o scripts.tar.gz
mkdir src && tar -zxf scripts.tar.gz -C src
cd src/build-images-master/scripts/Ubuntu && pwd
sudo -E ./basicconfig.sh

That's it - you'll get the same image as we have on production.

@saltydk
Copy link
Author

saltydk commented Jun 9, 2021

How would you go about creating the separate cloud on the same host?

Would the above script save the result as a new image, which is what I assume the bake image functionality was all about. My use case would be to test sub-projects that depend on another project on an image that is dynamically built whenever the the project is updated.

@FeodorFitsner
Copy link
Member

Add a new Hyper-V cloud and use the same "Host agent authorization token".

The script will update VM only and then you copy its VHD and use as an image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants