Raspberry Pi Image Customization with GitHub Actions

19
Raspberry Pi Image Customization with GitHub Actions

Transcript of Raspberry Pi Image Customization with GitHub Actions

Page 1: Raspberry Pi Image Customization with GitHub Actions

Raspberry Pi Image Customization with GitHub Actions

Page 2: Raspberry Pi Image Customization with GitHub Actions

Gina Häußge aka @fooselPassionate code monkey 🐒 Geek 👩‍💻 Gamer 🎮 Hobby baker 👩‍🍳

Creator & maintainer of OctoPrint 🐙 GitHub Star 🌟

Page 3: Raspberry Pi Image Customization with GitHub Actions

Introduction & MotivationRaspberry Pi? Images? Customization? Why?

Page 4: Raspberry Pi Image Customization with GitHub Actions

Raspberry Pi?• Small Single Board Computer

• Released in 2012

• Starts at 35 bucks

• Boots from an SD card

flashed with an OS image

Page 5: Raspberry Pi Image Customization with GitHub Actions

Flashed OS image?• Most often: “Raspberry Pi

OS”, Debian derivative

• One .iso file

• Two partitions: /boot

(FAT32) & / (ext4)

• Flashed via a flash tool like

the Raspberry Pi Imager

Page 6: Raspberry Pi Image Customization with GitHub Actions

OS choice: rpi-imager.json

Page 7: Raspberry Pi Image Customization with GitHub Actions

Why customize an image?• To preinstall or update

software

• To preconfigure things

• Case in Point: OctoPi

• OctoPrint + … + preconfig

• Keep OctoPrint updated!

Page 8: Raspberry Pi Image Customization with GitHub Actions

Why not do it interactively?• Many things happen on first boot

• Key generation

• File system extension

• More, depending on software

• Consequence: Boot & copy = 👎

• Also: Automating builds = ❤

Page 9: Raspberry Pi Image Customization with GitHub Actions

Enter: CustoPiZer👉OctoPrint/CustoPiZer

Page 10: Raspberry Pi Image Customization with GitHub Actions

CustoPiZer• Customization tool for images

• Mounts partitions

• Runs scripts inside chroot

• Available as Docker image!

• Available as GitHub Action!

• based on work by Guy Sheffer

Page 11: Raspberry Pi Image Customization with GitHub Actions

Usage as GitHub Action

Page 12: Raspberry Pi Image Customization with GitHub Actions

Tying everything together👉OctoPrint/OctoPi-UpToDate

Page 13: Raspberry Pi Image Customization with GitHub Actions

scripts/01-update-octoprint

Page 14: Raspberry Pi Image Customization with GitHub Actions
Page 15: Raspberry Pi Image Customization with GitHub Actions

rpi-imager.json snippet

Page 16: Raspberry Pi Image Customization with GitHub Actions
Page 17: Raspberry Pi Image Customization with GitHub Actions

And rpi-imager.json?

Page 18: Raspberry Pi Image Customization with GitHub Actions

Summary• Image customization as a ~5min GitHub Action run

• Automatic release generation

• Automatic rpi-imager.json snippet generation

• Merging of snippets for stable & pre releases and serving via

GitHub pages

• … and all fully automated! 🤖

Page 19: Raspberry Pi Image Customization with GitHub Actions

Slides: octoprint.org/slides/universe2021.pdf