traderepublic / Cilicon

🛠️ Self-Hosted ephemeral macOS CI on Apple Silicon
MIT License
950 stars 28 forks source link

Runner does not automatically start up again when vm reboots on v2 #26

Closed rubenvde closed 1 year ago

rubenvde commented 1 year ago

I got the vm up and running now. When the runner task is done it shutdown and starts up again as expected but then it will not start the github action runner script again so it's stuck booted up but not available to run anything.

Screenshot 2023-06-19 at 22 45 54

Am I missing a setting that resolves this?

Marcocanc commented 1 year ago

@rubenvde Thanks for reporting this. Would you mind sharing your configuration (you may redact any irrelevant/secret information) and providing more information on the image you're using? I haven't come across this behaviour yet but will do my best to find a fix.

Could you try to connect directly via SSH from your host computer after a VM reboot to see if that works? The VMs IP is written in the title bar of the Cilicon app.

rubenvde commented 1 year ago

@Marcocanc thanks for helping out. So I tried connecting to the SSH from the host computer in the terminal after reboot, that works.

This is my cilicon.yml file.

source: ~/VM2.bundle
provisioner:
  type: github
  config:
    appId: 000000
    organization: XXXXX
    privateKeyPath: ~/CI/github.pem
hardware:
  ramGigabytes: 16
  connectsToAudioDevice: false
directoryMounts:
  - hostPath: ~/CI/VM Cache 2
    guestFolder: Cache
    readOnly: false
autoTransferImageVolume: /Volumes/Cilicon Drive
runnerName: the-Swift-Samurai-2
editorMode: false

How I get to the image is from v1 I downloaded the latest ipsw version. And via editorMode I installed Xcode and updated the system ones.

Let me know if you need more information.

Marcocanc commented 1 year ago

Thanks for the info. Is it consistently running fine once and then failing to provision on the subsequent run? Or did it only work the very first time? Could you share the contents of the config.json file inside the VM.bundle folder (right click, show package contents to open)?

I just realized I'm not handling failures to obtain the IP address, so I'm having a deeper look there.

Marcocanc commented 1 year ago

Would you mind manually checking your /var/db/dhcpd_leases file to see if the mac address that's in your bundle config.json exists more than once (or not at all) and see if the IP address matches the one you used to connect via SSH?

rubenvde commented 1 year ago

The system consistently runs the Github script only once. I have to say when I close the app and start it up again, it takes multiple times to reboot and connect via SSH. Eventually it will work but I get this message multiple times:

Screenshot 2023-06-21 at 13 45 09

but it automatically reboots multiple times and after 2-3 tries it succeeds. I'm not sure if this error is related to this issue 🤔

rubenvde commented 1 year ago

Here is the content of the config.json {"ecid":"YnBsaXN0MDDRAQJURUNJRBNIb5NdmXhriggLEAAAAAAAAAEBAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAZ","arch":"arm64","os":"darwin","hardwareModel":"YnBsaXN0MDDTAQIDBAUGXxAZRGF0YVJlcHJlc2VudGF0aW9uVmVyc2lvbl8QD1BsYXRmb3JtVmVyc2lvbl8QEk1pbmltdW1TdXBwb3J0ZWRPUxQAAAAAAAAAAAAAAAAAAAABEAKjBwgIEAwQAAgPKz1SY2VpawAAAAAAAAEBAAAAAAAAAAkAAAAAAAAAAAAAAAAAAABt","macAddress":"e6:d5:c2:1c:65:0b"}

rubenvde commented 1 year ago

wow /var/db/dhcpd_leases is a very big list (I only use this computer for Cilicon, do I need to reset this file once in a while?), but the macAddress in the config.json is not in the /var/db/dhcpd_leases.

Marcocanc commented 1 year ago

@rubenvde, I think Cilicon 1.0 was causing this file to grow as it would create a new mac address and therefore a new dhcp lease on every boot (no longer the case in 2.0). It should be safe to purge the file. Once you've cleared it, could you check if the behaviour changes?

rubenvde commented 1 year ago

@Marcocanc I've found the issue. It's a stupid one. I was running v1 (for the team so they would at least one working), but it was conflicting with v2. So now I closed the old v1 program and everything appears to be working without any issue. Thanks for looking into it and helping out.

It would still be really nice to have support for 2 different vms!

Marcocanc commented 1 year ago

v1 and v2 could technically run in parallel as long as the vmClonePath is set to different locations. Support for up to two VMs in one instance of Cilicon is planned for the future.

rubenvde commented 1 year ago

That's what I had but gave issues. I had two vmClonePaths VM1.bundle and VM2.bundle but then for v2 the script wouldn't start up again after reboot