❄️ The toolkit to build, ship and maintain cloud-init driven Linux derivatives based on container images
Go to file
Fredrik Lönnegren f29ac2690f Avoid panic when MaxSnaps is set to 0
When the MaxSnaps configuration option is set to 0 the following panic
occurs during installation:

```
[PANICKED] Test Panicked
  In [It] at: /usr/lib64/go/1.24/src/runtime/panic.go:115 @ 07/01/25 10:04:57.47

  runtime error: index out of range [0] with length 0

  Full Stack Trace
    github.com/rancher/elemental-toolkit/v2/pkg/snapshotter.(*LoopDevice).cleanOldSnapshots(0xc00025a300)
        /home/frelon/src/elemental-toolkit/pkg/snapshotter/loopdevice.go:468 +0x3e7
    github.com/rancher/elemental-toolkit/v2/pkg/snapshotter.(*LoopDevice).CloseTransaction(0xc00025a300, 0xc000234a00)
        /home/frelon/src/elemental-toolkit/pkg/snapshotter/loopdevice.go:271 +0x11d5
    github.com/rancher/elemental-toolkit/v2/pkg/snapshotter_test.init.func3.12()
        /home/frelon/src/elemental-toolkit/pkg/snapshotter/loopdevice_test.go:204 +0x38e
```

This commit checks that we don't try to delete old snapshots in case
there are none.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
(cherry picked from commit d8450e01b9)
2025-07-31 17:49:46 +02:00
.github Switch GHA runners to Ubuntu 24.04 2025-03-13 16:20:24 +01:00
.obs
cmd
docs
examples Backport a couple of fixes 2025-03-13 16:20:24 +01:00
internal/version
make
pkg Avoid panic when MaxSnaps is set to 0 2025-07-31 17:49:46 +02:00
scripts Simplify podman calls in CI steup 2025-03-13 16:20:24 +01:00
tests
vendor
.codecov.yaml
.dockerignore
.gitignore
.gitmodules
.golangci.yml Adapt .golangci.yml format to a new version 2025-03-13 16:20:24 +01:00
.goreleaser.yaml
CODEOWNERS
CONTRIBUTING.md
Dockerfile Backport a couple of fixes 2025-03-13 16:20:24 +01:00
LICENSE
Makefile
README.md
config.yaml.example
go.mod
go.sum
main.go

README.md

Elemental Toolkit

Build nightly

Elemental-toolkit is a toolkit to build, ship and maintain cloud-init driven Linux derivatives based on container images with a common featureset - allows container images to be bootable in VMs, baremetals, embedded devices, and much more.

It is designed to reduce the maintenance surface, with a flexible approach to provide upgrades from container registries. It is cloud-init driven and also designed to be adaptive-first, allowing easily to build changes on top.

Documentation is available at https://rancher.github.io/elemental-toolkit/docs

Design goals

  • A Manifest for container-based OS. It contains just the common bits to make a container image bootable and to be upgraded from, with little customization on top
  • Immutable-first, but with a flexible layout
  • Cloud-init driven
  • Based on systemd
  • Built and upgraded from containers
  • OTA updates
  • Easy to customize
  • Cryptographically verified

Quick start

Check out our getting-started section in the documentation.

License

Copyright (c) 2020-2024 SUSE, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.