Skip to content

Commit

Permalink
Add tumbleweed example (#1823)
Browse files Browse the repository at this point in the history
* Add tumbleweed example

Signed-off-by: Fredrik Lönnegren <[email protected]>

* Add status badges for workflows to README

Signed-off-by: Fredrik Lönnegren <[email protected]>

* Update ele-testhelpers to latest commit

Signed-off-by: Fredrik Lönnegren <[email protected]>

---------

Signed-off-by: Fredrik Lönnegren <[email protected]>
  • Loading branch information
frelon authored Sep 6, 2023
1 parent 229438f commit 17e4895
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
arch: ['x86_64', 'aarch64']
flavor: ['green']
flavor: ['green', 'tumbleweed']
uses: ./.github/workflows/build_and_test.yaml
with:
arch: ${{ matrix.arch }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ build-cli:

.PHONY: build-os
build-os: build
$(DOCKER) build examples/$(FLAVOR) --platform ${PLATFORM} --build-arg TOOLKIT_REPO=$(TOOLKIT_REPO) --build-arg VERSION=$(VERSION) --build-arg REPO=$(REPO) -t $(REPO):$(VERSION)
$(DOCKER) build examples/$(FLAVOR) --platform ${PLATFORM} ${DOCKER_ARGS} --build-arg TOOLKIT_REPO=$(TOOLKIT_REPO) --build-arg VERSION=$(VERSION) --build-arg REPO=$(REPO) -t $(REPO):$(VERSION)

.PHONY: push-os
push-os:
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Elemental Toolkit

[![PR](https://github.com/rancher/elemental-toolkit/actions/workflows/pr.yaml/badge.svg?branch=main)](https://github.com/rancher/elemental-toolkit/actions/workflows/pr.yaml)
[![nightly](https://github.com/rancher/elemental-toolkit/actions/workflows/nightly.yaml/badge.svg?branch=main)](https://github.com/rancher/elemental-toolkit/actions/workflows/nightly.yaml)

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.
Expand All @@ -12,7 +15,7 @@ Documentation is available at [https://rancher.github.io/elemental-toolkit/docs]
- Immutable-first, but with a flexible layout
- Cloud-init driven
- Based on systemd
- Built and upgraded from containers - It is a [single image OS](https://quay.io/repository/costoolkit/releases-green)!
- Built and upgraded from containers
- OTA updates
- Easy to customize
- Cryptographically verified
Expand Down
71 changes: 71 additions & 0 deletions examples/tumbleweed/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# run `make build` to build local/elemental-toolkit image
ARG TOOLKIT_REPO
ARG VERSION
FROM ${TOOLKIT_REPO}:${VERSION} as TOOLKIT

# OS base image of our choice
FROM opensuse/tumbleweed:latest as OS
ARG REPO
ARG VERSION
ENV VERSION=${VERSION}

# install kernel, systemd, dracut, grub2 and other required tools
RUN ARCH=$(uname -m); \
if [[ $ARCH == "aarch64" ]]; then ARCH="arm64"; fi; \
zypper --non-interactive install --no-recommends -- \
kernel-default \
device-mapper \
dracut \
grub2 \
grub2-${ARCH}-efi \
shim \
haveged \
systemd \
NetworkManager \
openssh-server \
openssh-clients \
timezone \
parted \
e2fsprogs \
dosfstools \
mtools \
xorriso \
findutils \
gptfdisk \
rsync \
squashfs \
lvm2 \
tar \
gzip \
vim \
which \
less \
sudo \
curl \
sed

# Just add the elemental cli
COPY --from=TOOLKIT /usr/bin/elemental /usr/bin/elemental

# Enable essential services
RUN systemctl enable NetworkManager.service

# Generate initrd with required elemental services
RUN elemental init -f && \
kernel=$(ls /boot/Image-* | head -n1) && \
if [ -e "$kernel" ]; then ln -sf "${kernel#/boot/}" /boot/vmlinuz; fi && \
rm -rf /var/log/update* && \
>/var/log/lastlog && \
rm -rf /boot/vmlinux*

# Update os-release file with some metadata
RUN echo IMAGE_REPO=\"${REPO}\" >> /etc/os-release && \
echo IMAGE_TAG=\"${VERSION}\" >> /etc/os-release && \
echo IMAGE=\"${REPO}:${VERSION}\" >> /etc/os-release && \
echo TIMESTAMP="`date +'%Y%m%d%H%M%S'`" >> /etc/os-release && \
echo GRUB_ENTRY_NAME=\"Elemental\" >> /etc/os-release

# Good for validation after the build
CMD /bin/bash


2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/mudler/yip v1.1.0
github.com/onsi/ginkgo/v2 v2.9.3
github.com/onsi/gomega v1.27.6
github.com/rancher-sandbox/ele-testhelpers v0.0.0-20230503125222-ae1b8f5a8578
github.com/rancher-sandbox/ele-testhelpers v0.0.0-20230906081931-42837bae8bd5
github.com/sanity-io/litter v1.5.5
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.7.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rancher-sandbox/ele-testhelpers v0.0.0-20230503125222-ae1b8f5a8578 h1:t3rKYU1ek1pIDpF2yex1gYQcYRJjHxwFrd4Nk9O1JIU=
github.com/rancher-sandbox/ele-testhelpers v0.0.0-20230503125222-ae1b8f5a8578/go.mod h1:2Kk5HBelEumSSM3otn4GFd9ElClpW9w8VaMW5T+nkKs=
github.com/rancher-sandbox/ele-testhelpers v0.0.0-20230906081931-42837bae8bd5 h1:fWR1SAFDa6s7NLHzKRDQRF8rpAYFOGXuRynvvbW8Bkg=
github.com/rancher-sandbox/ele-testhelpers v0.0.0-20230906081931-42837bae8bd5/go.mod h1:Ex+a/ng4u2BvcGQdQjTHI48h88bQ6k2a7q8rnvU0XbQ=
github.com/rancher-sandbox/linuxkit v1.0.0 h1:ejEKyLWfByMkwzpmcSQLc5/RL3FtiKRpIgY+TUjFpaM=
github.com/rancher-sandbox/linuxkit v1.0.0/go.mod h1:n6Fkjc5qoMeWrnLSA5oqUF8ZzFKMrM960CtBwfvH1ZM=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
Expand Down
38 changes: 7 additions & 31 deletions vendor/github.com/rancher-sandbox/ele-testhelpers/vm/sut.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ github.com/pkg/errors
# github.com/pkg/xattr v0.4.9
## explicit; go 1.14
github.com/pkg/xattr
# github.com/rancher-sandbox/ele-testhelpers v0.0.0-20230503125222-ae1b8f5a8578
# github.com/rancher-sandbox/ele-testhelpers v0.0.0-20230906081931-42837bae8bd5
## explicit; go 1.20
github.com/rancher-sandbox/ele-testhelpers/vm
# github.com/rancher-sandbox/linuxkit v1.0.0
Expand Down

0 comments on commit 17e4895

Please sign in to comment.