5

Shell access for builds.sr.ht CI

 3 years ago
source link: https://drewdevault.com/2019/08/19/Introducing-shell-access-for-builds.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Shell access for builds.sr.ht CI

Shell access for builds.sr.ht CI August 19, 2019 on Drew DeVault's blog

Have you ever found yourself staring at a failed CI build, wondering desperately what happened? Or, have you ever needed a fresh machine on-demand to test out an idea in? Have you been working on Linux, but need to test something on OpenBSD? Starting this week, builds.sr.ht can help with all of these problems, because you can now SSH into the build environment.

If you didn't know, Sourcehut is the 100% open/libre software forge for hackers, complete with git and Mercurial hosting, CI, mailing lists, and more - with no JavaScript. Try it out!

The next time your build fails on builds.sr.ht, you’ll probably notice the following message:

Screenshot of builds.sr.ht showing a prompt to SSH into the failed buildVM and examine it

After the build fails, we process everything normally - sending emails, webhooks, and so on - but keep the VM booted for an additional 10 minutes. If you do log in during this window, we keep the VM alive until you log out or until your normal build time limit has elapsed. Once you’ve logged in, you get a shell and can do anything you like, such as examining the build artifacts or tweaking the source and trying again.

$ ssh -t [email protected] connect 81809
Connected to build job #81809 (failed):
https://builds.sr.ht/jobs/~sircmpwn/81809
Your VM will be terminated 4 hours from now, or when you log out.

bash-5.0 $

You can also connect to any build over SSH by adding shell: true to your build manifest. When you do, the VM will be kept alive after all of the tasks have finished (even if it doesn’t fail) so you can SSH in. You can also SSH in before the tasks have finished, and tail the output of the build in your terminal. An example use case might be getting a fresh Alpine environment to test build your package on:

This was accomplished with a simple build manifest:

image: alpine/edge
shell: true
sources:
- https://git.alpinelinux.org/aports
tasks:
- "prep-abuild": |
    abuild-keygen -an

Since build manifests run normally in advance of your shell login, you can do things like install your preferred editor and dotfiles, pull down your SSH keys through build secrets, or anything else you desire to set up a comfortable working environment.

Furthermore, by leveraging the builds.sr.ht API, you can write scripts which take advantage of the shell features. Need a NetBSD shell? With a little scripting you can get something like this working:

With experimental multiarch support being rolled out, soon you’ll be just a few keystrokes away from an ARM or PowerPC shell, too.

I want to expand more on SSH access in the future. Stay tuned and let me know if you have any cool ideas!

Have a comment on one of my posts? Start a discussion in my public inbox by sending an email to ~sircmpwn/[email protected] [mailing list etiquette]

Articles from blogs I read Generated by openring

Go on ARM and Beyond

The industry is abuzz about non-x86 processors recently, so we thought it would be worth a brief post about Go’s support for them. It has always been important to us for Go to be portable, not overfitting to any particular operating sys…

via The Go Programming Language Blog December 17, 2020

Status update, December 2020

Hi all! This status update is the 24th one, so it’s been 2 years I’ve started writing those now (ignoring a little hiatus). Time flies! This month I’ve invested a lot of time into wlroots. My main focus has been renderer v6, which has now been internally rol…

via emersion December 16, 2020

What's cooking on Sourcehut? December 2020

A brisk wind of winter chill sets a stir down my spine, as I sit down with a fresh cup of coffee to yarn a story of careful engineering and passionate spirit that took place over the course of 30 days. The last 30 days. Cause this is the monthly “what’s cook…

via Blogs on Sourcehut December 15, 2020
The content for this site is CC-BY-SA. The code for this site is MIT.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK