Skip to content

Commit fdba42a

Browse files
committed
ci: attempt to use cross-rs image for release job
1 parent e1cf2e3 commit fdba42a

File tree

9 files changed

+42
-33
lines changed

9 files changed

+42
-33
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
linux:
2626
name: linux / ${{ matrix.target }}
2727
runs-on: ubuntu-latest
28-
needs: github
28+
# needs: github
2929
strategy:
3030
fail-fast: false
3131
matrix:
@@ -35,29 +35,23 @@ jobs:
3535
- i686-unknown-linux-gnu
3636
- x86_64-unknown-linux-gnu
3737
- x86_64-unknown-linux-musl
38+
container:
39+
image: ghcr.io/cross-rs/${{ matrix.target }}:latest
40+
options: --user=root
3841
steps:
39-
# TODO this needs to run in the cross container
40-
# - name: Install dependencies
41-
# run: |
42-
# sudo apt-get update
43-
# sudo apt-get install -y libudev-dev libgtk-4-dev libglib2.0-dev
44-
45-
- uses: actions-rs/toolchain@v1
46-
with:
47-
toolchain: nightly
48-
profile: minimal
49-
override: true
50-
target: ${{ matrix.target }}
42+
- name: Install dependencies
43+
run: |
44+
apt-get update
45+
apt-get install -y libudev-dev libgtk-4-dev libglib2.0-dev
5146
5247
- uses: actions/checkout@v4
5348
with:
5449
fetch-tags: true
5550

5651
- uses: actions-rs/cargo@v1
5752
with:
58-
use_cross: true
5953
command: build
60-
args: --release --target ${{ matrix.target }}
54+
args: --release --target ${{ matrix.target }} --features gui
6155

6256
- uses: actions/upload-artifact@v4
6357
with:

goldboot-image/src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,9 +757,13 @@ impl ImageHandle {
757757

758758
// Jump to the block corresponding to the cluster
759759
dest.seek(SeekFrom::Start(entry.block_offset))?;
760-
dest.read_exact(&mut block)?;
761-
762-
let hash: [u8; 32] = Sha256::new().chain_update(&block).finalize().into();
760+
let hash: [u8; 32] = match dest.read_exact(&mut block) {
761+
Ok(_) => Sha256::new().chain_update(&block).finalize().into(),
762+
Err(_) => {
763+
// TODO check for EOF error
764+
[0u8; 32]
765+
}
766+
};
763767

764768
if hash != entry.digest {
765769
// Read cluster
@@ -791,7 +795,7 @@ impl ImageHandle {
791795

792796
// Write the cluster to the block
793797
dest.seek(SeekFrom::Start(entry.block_offset))?;
794-
// dest.write_all(&cluster.data)?;
798+
dest.write_all(&cluster.data)?;
795799
}
796800

797801
progress(

goldboot/src/cli/cmd/cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub fn run(cmd: super::Commands) -> ExitCode {
4747
// Fully verify config before proceeding
4848
match foundry.validate() {
4949
Err(err) => {
50-
error!(error = %err, "Failed to validate config file");
50+
error!(error = ?err, "Failed to validate config file");
5151
return ExitCode::FAILURE;
5252
}
5353
_ => debug!("Validated config file"),
@@ -56,7 +56,7 @@ pub fn run(cmd: super::Commands) -> ExitCode {
5656
// Run the build finally
5757
match foundry.run(output) {
5858
Err(err) => {
59-
error!(error = %err, "Failed to cast image");
59+
error!(error = ?err, "Failed to cast image");
6060
ExitCode::FAILURE
6161
}
6262
_ => ExitCode::SUCCESS,

goldboot/src/cli/cmd/deploy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub fn run(cmd: super::Commands) -> ExitCode {
4747

4848
match image_handle.write(output, ProgressBar::Write.new_empty()) {
4949
Err(err) => {
50-
error!(error = %err, "Failed to write image");
50+
error!(error = ?err, "Failed to write image");
5151
ExitCode::FAILURE
5252
}
5353
_ => ExitCode::SUCCESS,

goldboot/src/cli/cmd/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pub fn run(cmd: super::Commands) -> ExitCode {
194194
// Finally write out the config
195195
match config_path.write(&foundry) {
196196
Err(err) => {
197-
error!(error = %err, "Failed to write config file");
197+
error!(error = ?err, "Failed to write config file");
198198
ExitCode::FAILURE
199199
}
200200
_ => {

goldboot/src/cli/cmd/liveusb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ pub fn run(cmd: super::Commands) -> ExitCode {
3939
.interact()
4040
.unwrap()
4141
{
42-
std::process::exit(0);
42+
return ExitCode::FAILURE;
4343
}
4444
}
4545

4646
match image_handles[0].write(dest, ProgressBar::Write.new_empty()) {
4747
Err(err) => {
48-
error!(error = %err, "Failed to write image");
48+
error!(error = ?err, "Failed to write image");
4949
ExitCode::FAILURE
5050
}
5151
_ => ExitCode::SUCCESS,

goldboot/src/foundry/molds/goldboot/mod.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,17 @@ impl DefaultSource for Goldboot {
5656

5757
impl CastImage for Goldboot {
5858
fn cast(&self, worker: &FoundryWorker) -> Result<()> {
59+
// Load goldboot executable
60+
let exe = if let Some(path) = self.executable.as_ref() {
61+
std::fs::read(path)?
62+
} else {
63+
get_latest_release(OsCategory::Linux, worker.arch)?
64+
};
65+
5966
let mut qemu = QemuBuilder::new(&worker, OsCategory::Linux)
6067
.vga("cirrus")
6168
.source(&worker.element.source)?
62-
.drive_files(HashMap::from([(
63-
"goldboot".to_string(),
64-
get_latest_release(OsCategory::Linux, worker.arch)?,
65-
)]))?
69+
.drive_files(HashMap::from([("goldboot".to_string(), exe)]))?
6670
.start()?;
6771

6872
// Start HTTP
@@ -90,7 +94,8 @@ impl CastImage for Goldboot {
9094
enter!("cp /mnt/goldboot /usr/bin/goldboot"),
9195
enter!("chmod +x /usr/bin/goldboot"),
9296
// Skip getty login
93-
enter!("sed -i 's|ExecStart=.*$|ExecStart=/usr/bin/goldboot|' /usr/lib/systemd/system/[email protected]"),
97+
enter!("echo 'exec /usr/bin/goldboot' >/root/.xinitrc"),
98+
enter!("sed -i 's|ExecStart=.*$|ExecStart=/usr/bin/startx|' /usr/lib/systemd/system/[email protected]"),
9499
// Stop gracefully
95100
enter!("poweroff"),
96101
])?;

goldboot/src/foundry/molds/goldboot/preseed.cfg

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ tasksel tasksel/first multiselect minimal
368368
#d-i pkgsel/run_tasksel boolean false
369369

370370
# Individual additional packages to install
371-
d-i pkgsel/include string curl libgtk-4-1 tpm2-tools xorg
371+
d-i pkgsel/include string libgtk-4-1 tpm2-tools xorg
372372
# Whether to upgrade packages after debootstrap.
373373
# Allowed values: none, safe-upgrade, full-upgrade
374374
d-i pkgsel/upgrade select safe-upgrade
@@ -411,10 +411,13 @@ d-i grub-installer/with_other_os boolean true
411411
# or encrypted using an MD5 hash, see grub-md5-crypt(8).
412412
#d-i grub-installer/password-crypted password [MD5 hash]
413413

414+
# Never show boot menu
415+
grub-pc grub-pc/timeout string 0
416+
414417
# Use the following option to add additional boot parameters for the
415418
# installed system (if supported by the bootloader installer).
416419
# Note: options passed to the installer will be added automatically.
417-
d-i debian-installer/add-kernel-opts string quiet loglevel=3 rd.systemd.show_status=auto rd.udev.log_level=3
420+
d-i debian-installer/add-kernel-opts string quiet loglevel=0 rd.systemd.show_status=no rd.udev.log_level=0
418421

419422
### Finishing up the installation
420423
# During installations from serial console, the regular virtual consoles

goldboot/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ pub fn main() -> ExitCode {
7474
#[cfg(feature = "gui")]
7575
None => goldboot::gui::load_gui(command_line.fullscreen),
7676
#[cfg(not(feature = "gui"))]
77-
None => panic!("Not supported"),
77+
None => {
78+
error!("GUI support not compiled in");
79+
return ExitCode::FAILURE;
80+
}
7881
}
7982
}

0 commit comments

Comments
 (0)