Skip to content

Commit

Permalink
Use the new init command (#874)
Browse files Browse the repository at this point in the history
In elemental-toolkit v0.11.0 we introduce the init command that
initializes configuration for a new derivative.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
  • Loading branch information
frelon authored Aug 29, 2023
1 parent 6818f61 commit 31bb076
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .obs/dockerfile/slem4r-os/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ RUN zypper clean --all && \
rm -rf /boot/vmlinux*

# Rebuild initrd to setup dracut with the boot configurations
RUN dracut -f --regenerate-all && \
RUN elemental init --force immutable-rootfs,grub-config,dracut-config,cloud-config-essentials,elemental-setup && \
# aarch64 has an uncompressed kernel so we need to link it to vmlinuz
kernel=$(ls /boot/Image-* | head -n1) && \
if [ -e "$kernel" ]; then ln -sf "${kernel#/boot/}" /boot/vmlinuz; fi
2 changes: 1 addition & 1 deletion .obs/dockerfile/teal-os/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ RUN zypper clean --all && \
rm -rf /boot/vmlinux*

# Rebuild initrd to setup dracut with the boot configurations
RUN mkinitrd && \
RUN elemental init --force immutable-rootfs,grub-config,dracut-config,cloud-config-essentials,elemental-setup && \
# aarch64 has an uncompressed kernel so we need to link it to vmlinuz
kernel=$(ls /boot/Image-* | head -n1) && \
if [ -e "$kernel" ]; then ln -sf "${kernel#/boot/}" /boot/vmlinuz; fi
Expand Down
5 changes: 1 addition & 4 deletions .obs/specfile/elemental.spec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Source: %{name}-%{version}.tar
Source1: LICENSE
Source2: README.md

Requires: elemental-toolkit
Requires: elemental-cli
Requires: elemental-register
Requires: elemental-system-agent
Requires: elemental-support
Expand Down Expand Up @@ -65,9 +65,6 @@ cp -a framework/files/* %{buildroot}

rm -rf %{buildroot}/var/log/journal

# remove luet config in Elemental Teal
rm -rf %{buildroot}/etc/luet

# belongs to elemental-system-agent package
rm %{buildroot}%{_unitdir}/elemental-system-agent.service

Expand Down
36 changes: 9 additions & 27 deletions Dockerfile.image
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,7 @@
ARG OPERATOR_IMAGE=quay.io/costoolkit/elemental-operator-ci:latest
ARG REGISTER_IMAGE=quay.io/costoolkit/elemental-register-ci:latest
ARG SYSTEM_AGENT_IMAGE=rancher/system-agent:v0.2.9
ARG TOOL_IMAGE=quay.io/costoolkit/elemental-cli-ci:latest
# Binaries and files needed from elemental-toolkit repository
ARG LUET_VERSION=0.32.5
FROM quay.io/luet/base:$LUET_VERSION AS framework-build
COPY framework/files/etc/luet/luet.yaml /etc/luet/luet.yaml
ENV LUET_NOLOCK=true
SHELL ["/usr/bin/luet", "install", "-y", "--system-target", "/framework"]

# elemental-toolkit essentials
RUN system/immutable-rootfs
RUN system/cos-setup
RUN cloud-config/network
RUN cloud-config/recovery
RUN cloud-config/live
RUN cloud-config/boot-assessment
RUN cloud-config/default-services
RUN system/grub2-config
RUN system/base-dracut-modules

# elemental-toolkit utilities
RUN utils/k9s
RUN utils/nerdctl
RUN toolchain/cosign
RUN selinux/rancher
ARG TOOL_IMAGE=ghcr.io/rancher/elemental-toolkit/elemental-cli:v0.11.0

# elemental-operator
FROM $OPERATOR_IMAGE as elemental-operator
Expand All @@ -42,8 +19,6 @@ FROM $TOOL_IMAGE as elemental-cli
# Base os
FROM registry.suse.com/suse/sle-micro-rancher/5.3:latest as default

# Copy installed files from the luet repos
COPY --from=framework-build /framework /
# Copy elemental-operator
COPY --from=elemental-operator /usr/sbin/elemental-operator /usr/sbin/elemental-operator
# Copy elemental-register
Expand Down Expand Up @@ -71,12 +46,19 @@ RUN echo IMAGE=\"${IMAGE_REPO}:${IMAGE_TAG}\" >> /etc/os-release
RUN echo TIMESTAMP="`date +'%Y%m%d%H%M%S'`" >> /etc/os-release
RUN echo GRUB_ENTRY_NAME=\"Elemental\" >> /etc/os-release

# Ensure /tmp is mounted as tmpfs by default
RUN if [ -e /usr/share/systemd/tmp.mount ]; then \
cp /usr/share/systemd/tmp.mount /etc/systemd/system; \
fi

# Rebuild initrd to setup dracut with the boot configurations
RUN mkinitrd && \
RUN elemental init --force immutable-rootfs,grub-config,dracut-config,cloud-config-essentials,elemental-setup && \
# aarch64 has an uncompressed kernel so we need to link it to vmlinuz
kernel=$(ls /boot/Image-* | head -n1) && \
if [ -e "$kernel" ]; then ln -sf "${kernel#/boot/}" /boot/vmlinuz; fi

COPY framework/files/etc/cos/bootargs.cfg /etc/cos/bootargs.cfg

# Save some space
RUN rm -rf /var/log/update* && \
>/var/log/lastlog && \
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ GIT_COMMIT_SHORT?=$(shell git rev-parse --short HEAD)
GIT_TAG?=$(shell git describe --abbrev=0 --tags 2>/dev/null || echo "v0.0.0" )
TAG?=${GIT_TAG}-${GIT_COMMIT_SHORT}
REPO?=ttl.sh/elemental-ci
IMAGE=${REPO}:${GIT_TAG}
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
SUDO?=sudo
CLOUD_CONFIG_FILE?="iso/config"
MANIFEST_FILE?="iso/manifest.yaml"
# This are the default images already in the dockerfile but we want to be able to override them
OPERATOR_IMAGE?=quay.io/costoolkit/elemental-operator-ci:latest
REGISTER_IMAGE?=quay.io/costoolkit/elemental-register-ci:latest
SYSTEM_AGENT_IMAGE?=rancher/system-agent:v0.2.9
TOOL_IMAGE?=quay.io/costoolkit/elemental-cli-ci:latest
TOOL_IMAGE?=ghcr.io/rancher/elemental-toolkit/elemental-cli:v0.11.0
# Used to know if this is a release or just a normal dev build
RELEASE_TAG?=false

Expand Down
16 changes: 0 additions & 16 deletions framework/files/etc/luet/luet.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion tests/smoke/smoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var _ = Describe("Elemental Smoke tests", func() {
})

Context("First boot", func() {
for _, unit := range []string{"cos-setup-initramfs", "cos-setup-network", "cos-setup-rootfs", "cos-setup-boot", "cos-setup-fs"} {
for _, unit := range []string{"elemental-setup-initramfs", "elemental-setup-network", "elemental-setup-rootfs", "elemental-setup-boot", "elemental-setup-fs"} {
It(fmt.Sprintf("starts successfully %s on boot", unit), func() {
systemdUnitIsStarted(unit, s)
})
Expand Down

0 comments on commit 31bb076

Please sign in to comment.