Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
build:
needs: [set_version]
if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
uses: gardenlinux/gardenlinux/.github/workflows/build.yml@bd5e711d06acb6e93da02deb47ad2ce569af0914
uses: gardenlinux/gardenlinux/.github/workflows/build.yml@c15e9789b16b0e64019b52b45fb6fa3b3c0f608c
with:
version: ${{ needs.set_version.outputs.VERSION }}
# to set target to "release" or "nightly" we need proper KMS secrets
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
submodules: recursive
build:
needs: [checkout]
uses: gardenlinux/gardenlinux/.github/workflows/build.yml@bd5e711d06acb6e93da02deb47ad2ce569af0914
uses: gardenlinux/gardenlinux/.github/workflows/build.yml@c15e9789b16b0e64019b52b45fb6fa3b3c0f608c
with:
version: ${{ inputs.version || 'now' }}
# to set target to "release" or "nightly" we need proper KMS secrets
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
name: Run glcli to publish to OCI
needs: [build]
# use custom upload_oci.yml as we do not sign the images
# uses: gardenlinux/gardenlinux/.github/workflows/upload_oci.yml@bd5e711d06acb6e93da02deb47ad2ce569af0914
# uses: gardenlinux/gardenlinux/.github/workflows/upload_oci.yml@c15e9789b16b0e64019b52b45fb6fa3b3c0f608c
uses: ./.github/workflows/upload_oci.yml
with:
version: ${{ needs.build.outputs.version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload_oci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
generate_matrix_publish:
name: Generate flavors matrix to publish
uses: gardenlinux/gardenlinux/.github/workflows/build_flavors_matrix.yml@bd5e711d06acb6e93da02deb47ad2ce569af0914
uses: gardenlinux/gardenlinux/.github/workflows/build_flavors_matrix.yml@c15e9789b16b0e64019b52b45fb6fa3b3c0f608c
with:
flags: '${{ inputs.flavor_filter }} --no-arch --json-by-arch --build --test'
upload_gl_artifacts:
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ SHELL := /usr/bin/env bash
.SHELLFLAGS := -euo pipefail -c

ROOT_DIR := $(shell git rev-parse --show-toplevel)
SED := $(shell command -v gsed 2>/dev/null || command -v sed)

# Default to latest commit if COMMIT is not specified
COMMIT ?= $(shell git ls-remote https://github.com/gardenlinux/gardenlinux.git HEAD | cut -f1)
Expand Down Expand Up @@ -29,7 +30,7 @@ update:
git add gardenlinux

# update workflow commit references
sed -i -E 's|(gardenlinux/gardenlinux/.github/workflows/[^@]*)@[0-9a-f]{40}|\1@$(COMMIT)|g' $(ROOT_DIR)/.github/workflows/*.y*ml
$(SED) -i -E 's|(gardenlinux/gardenlinux/.github/workflows/[^@]*)@[0-9a-f]{40}|\1@$(COMMIT)|g' $(ROOT_DIR)/.github/workflows/*.y*ml

# update features
mkdir -p $(ROOT_DIR)/features
Expand All @@ -56,6 +57,13 @@ update:
fi; \
done

# update builder image
new_builder_image=$$(grep -m1 '^container_image=' $(ROOT_DIR)/gardenlinux/build | cut -d= -f2); \
current_builder_image=$$(grep -m1 '^container_image=' $(ROOT_DIR)/build | cut -d= -f2); \
if [ "$$new_builder_image" != "$$current_builder_image" ]; then \
$(SED) -i -E 's|^container_image=.*|container_image=$$new_builder_image|' $(ROOT_DIR)/build; \
fi

clean:
git reset --soft
rm -rf $(ROOT_DIR)/gardenlinux
Expand Down
1 change: 0 additions & 1 deletion build

This file was deleted.

180 changes: 180 additions & 0 deletions build
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
#!/usr/bin/env bash

set -euo pipefail
shopt -s nullglob

exec 3>&1
exec 1>&2

container_image=ghcr.io/gardenlinux/builder:0196add0ce875ac0b7721c19b2ee3ac37cf84387
container_engine=podman
target_dir=.build

container_run_opts=(
--memory 4G
--security-opt seccomp=unconfined
--security-opt apparmor=unconfined
--security-opt label=disable
--read-only
)

container_cmd=()

use_kms=0
resolve_cname=0
allow_frankenstein=0
apparmor_profile=

while [ $# -gt 0 ]; do
case "$1" in
--allow-frankenstein) # https://xkcd.com/1589/
allow_frankenstein=1
shift
;;
--container-image)
container_image="$2"
shift 2
;;
--container-engine)
container_engine="$2"
shift 2
;;
--container-run-opts)
declare -a "container_run_opts=($2)"
shift 2
;;
--privileged)
container_run_opts+=(--privileged)
container_cmd=(--second-stage)
shift
;;
--kms)
use_kms=1
shift
;;
--print-container-image)
printf '%s\n' "$container_image" >&3
exit 0
;;
--resolve-cname)
resolve_cname=1
shift
;;
--target)
target_dir="$2"
shift 2
;;
--apparmor-profile)
apparmor_profile="$2"
shift 2
;;
*)
break
;;
esac
done

[ -d "$target_dir" ] || mkdir "$target_dir"

container_mount_opts=(
-v "$PWD/keyring.gpg:/builder/keyring.gpg:ro"
-v "$(realpath "$target_dir"):/builder/.build"
)

# mount all features to enable dynamic discovery of requirements.mod files
container_mount_opts+=(-v "$(realpath -- "features"):/builder/features:ro")
container_mount_opts+=(-v "$(realpath -- "gardenlinux"):/builder/gardenlinux:ro")
container_mount_opts+=(-v "$(realpath -- "requirements.defs"):/builder/requirements.defs:ro")

if [ "$container_image" = localhost/builder ]; then
dir="$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")"
"$container_engine" build -t "$container_image" "$dir"
fi

repo="$(./get_repo)"
commit="$(./get_commit)"
timestamp="$(./get_timestamp)"
default_version="$(./get_version)"


if [ "$resolve_cname" = 1 ]; then
arch="$("$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" dpkg --print-architecture)"
cname="$("$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" /builder/parse_features --feature-dir /builder/features --default-arch "$arch" --default-version "$default_version" --cname "$1")"
short_commit="$(head -c 8 <<< "$commit")"
echo "$cname-$short_commit" >&3
exit 0
fi

make_opts=(
REPO="$repo"
COMMIT="$commit"
TIMESTAMP="$timestamp"
DEFAULT_VERSION="$default_version"
LOG_WITH_TIMESTAMP="${LOG_WITH_TIMESTAMP:-true}"
)

if [ "$allow_frankenstein" = 1 ]; then
make_opts+=("ALLOW_FRANKENSTEIN=1")
fi

if [ "$use_kms" = 1 ]; then
for e in AWS_DEFAULT_REGION AWS_REGION AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN; do
if [ -n "${!e-}" ]; then
make_opts+=("$e=${!e}")
fi
done
fi

# Default values which can be overridden via 'build.config' file
tempfs_size=2G

if [[ -f "$PWD"/build.config ]]; then
. "$PWD"/build.config
fi

make_opts+=("TEMPFS_SIZE=$tempfs_size")

if [ -d cert ]; then
container_mount_opts+=(-v "$PWD/cert:/builder/cert:ro")
fi

# Check if builder apparmor profile has to be created or selected
if [ "$container_engine" = "docker" ] \
&& [ ! "$apparmor_profile" ] \
&& out=$(sysctl kernel.apparmor_restrict_unprivileged_userns 2> /dev/null) \
&& [[ $out = "kernel.apparmor_restrict_unprivileged_userns = 1" ]]; then
if [ ! -f /etc/apparmor.d/builder ]; then
echo "You are using Docker on a system restricting unprivileged user namespaces with apparmor, which prevents a successful build. For more information please refer to the #Usage section in the README."
read -r -p "Do you want to permanently create a new apparmor profile at /etc/apparmor.d/builder to solve the issue? [Y/n] " response
response=${response,,}
if [[ "$response" =~ ^(yes|y)$ ]]; then
if [ ! -f /etc/apparmor.d/builder ]; then
profile="abi <abi/4.0>, include <tunables/global> profile builder flags=(unconfined) {userns, }"
echo "$profile" | sudo tee /etc/apparmor.d/builder > /dev/null
sudo apparmor_parser -r -W /etc/apparmor.d/builder
fi
echo "Created profile builder at /etc/apparmor.d/builder"
else
echo Abort.
exit 1
fi
fi
apparmor_profile=builder
fi

# Apply apparmor profile if selected
if [ "$apparmor_profile" ]; then
replaced=false
for i in "${!container_run_opts[@]}"; do
if [ "${container_run_opts[$i]}" = "apparmor=unconfined" ]; then
container_run_opts["$i"]="apparmor=$apparmor_profile"
replaced=true
fi
done

if ! $replaced; then
container_run_opts+=(--security-opt "apparmor=$apparmor_profile")
fi
fi

"$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" ${container_cmd[@]+"${container_cmd[@]}"} fake_xattr make --no-print-directory -C /builder "${make_opts[@]}" "$@" >&3
1 change: 1 addition & 0 deletions features/_archgrouped
2 changes: 1 addition & 1 deletion gardenlinux
Submodule gardenlinux updated 67 files
+2 −2 .github/workflows/build_flavor.yml
+1 −1 .github/workflows/build_flavors_matrix.yml
+1 −1 .github/workflows/build_kmodbuild_container.yml
+1 −1 .github/workflows/docs-check.yml
+1 −1 .github/workflows/download_flavors_images.yml
+1 −1 .github/workflows/manual_gh_release_page.yml
+42 −22 .github/workflows/nightly.yml
+31 −0 .github/workflows/nightly_create_issue.yml
+34 −10 .github/workflows/publish_oci_containers.yml
+1 −38 .github/workflows/publish_s3.yml
+1 −1 .github/workflows/tag_latest_container.yml
+1 −1 .github/workflows/test_flavor_chroot.yml
+1 −1 .github/workflows/test_flavor_cloud.yml
+1 −1 .github/workflows/test_flavor_oci.yml
+1 −1 .github/workflows/test_flavor_qemu.yml
+1 −1 .github/workflows/upload_to_github_release.yml
+1 −1 .github/workflows/upload_to_s3.yml
+1 −1 CONTRIBUTING.md
+70 −4 LICENSE.md
+1 −1 Pipfile
+2 −2 REUSE.toml
+18 −20 SECURITY.md
+4 −6 build
+4 −8 docs/explanation/github-workflows.md
+29 −0 docs/explanation/secure-boot.md
+18 −0 docs/how-to/releases/index.md
+79 −77 docs/how-to/releases/os-releases.md
+1 −1 docs/reference/adr/0031-builder-glci-interface.md
+192 −0 docs/reference/adr/0037-builder-glci-interface.md
+72 −0 docs/reference/adr/0038-public-by-default-documentation-policy.md
+1 −2 docs/reference/kernel.md
+1 −1 docs/reference/releases/archived-releases.md
+1 −1 docs/reference/releases/maintained-releases.md
+20 −0 features/_archgrouped/README.md
+2 −0 features/_archgrouped/info.yaml
+1 −0 features/_archgrouped/requirements.mod
+1 −2 features/_autoinstall/requirements.mod
+1 −2 features/_tpm2/requirements.mod
+1 −2 features/_trustedboot/requirements.mod
+1 −2 features/_usi/exec.config
+11 −0 features/_usi/file.include/etc/systemd/system/gardenlinux-etc-setup-hooks.service
+12 −0 features/_usi/file.include/usr/sbin/run-etc-setup-hooks
+1 −1 features/_usi/image.esp.tar
+10 −0 features/_usi/initrd.include/etc/systemd/system/setup-etc-overlay.service
+2 −1 features/_usi/initrd.include/etc/systemd/system/sysroot-etc.mount
+25 −0 features/_usi/initrd.include/usr/bin/setup-etc-overlay
+1 −2 features/_usi/requirements.mod
+1 −1 features/base/pkg.include
+4 −1 features/container/image.oci
+2 −1 features/container/info.yaml
+6 −0 features/gardener/exec.config
+4 −0 features/gardener/file.include/etc/systemd/system-preset/91-disable-apt-daily.preset
+1 −1 features/openstackMetal/pkg.include
+37 −63 flavors.yaml
+1 −1 hack/compare-apt-repo-versions-gl-debian.sh
+1 −1 hack/compare-apt-repo-versions.sh
+416 −58 hack/create_nightly_issue.py
+1 −1 hack/get-selected-gl-bom.sh
+1 −1 hack/gl-pkg-url.sh
+1 −1 hack/gl-search.sh
+1 −1 hack/glvd-search.sh
+5 −0 requirements.defs
+1 −1 requirements.txt
+0 −2 tests/integration/runtime/test_pythonDev.py
+1 −0 tests/util/container/enter_host_ns.c
+3 −3 tests/util/python.env.sh
+13 −2 tests/util/run_oci.sh
1 change: 1 addition & 0 deletions requirements.defs
Loading