Skip to content
Draft
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 @@ -39,7 +39,7 @@ jobs:
build:
needs: [set_version]
if: ${{ github.event_name != 'pull_request' || github.event.action != 'closed' }}
uses: gardenlinux/gardenlinux/.github/workflows/build.yml@5a713d37923e67b7fbf6745a92344c6e1ea73595
uses: gardenlinux/gardenlinux/.github/workflows/build.yml@5f5b3a9e04f5c44c7126be185ccc78e8938a4adb
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@5a713d37923e67b7fbf6745a92344c6e1ea73595
uses: gardenlinux/gardenlinux/.github/workflows/build.yml@5f5b3a9e04f5c44c7126be185ccc78e8938a4adb
with:
version: ${{ inputs.version || 'now' }}
# to set target to "release" or "nightly" we need proper KMS secrets
Expand Down Expand Up @@ -50,7 +50,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@5a713d37923e67b7fbf6745a92344c6e1ea73595
# uses: gardenlinux/gardenlinux/.github/workflows/upload_oci.yml@5f5b3a9e04f5c44c7126be185ccc78e8938a4adb
uses: ./.github/workflows/upload_oci.yml
with:
version: ${{ needs.build.outputs.version }}
Expand Down
4 changes: 2 additions & 2 deletions .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@5a713d37923e67b7fbf6745a92344c6e1ea73595
uses: gardenlinux/gardenlinux/.github/workflows/build_flavors_matrix.yml@5f5b3a9e04f5c44c7126be185ccc78e8938a4adb
with:
flags: '${{ inputs.flavor_filter }} --no-arch --json-by-arch --build --test'
upload_gl_artifacts:
Expand All @@ -40,7 +40,7 @@ jobs:
- uses: oras-project/setup-oras@1d808f7d7f6995cc68b7bf507bfe5c5446e1dc9d # v2
- run: oras version
- name: Install python-gardenlinux-lib
uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@19c1b24c01faab81a7fe24713748dd172d00904a
uses: gardenlinux/python-gardenlinux-lib/.github/actions/setup@7b3c8e74746b20863c760f259bf1208982f51d97
- name: Install cosign
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
with:
Expand Down
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM ghcr.io/gardenlinux/builder:d6d24ba1aec66889a2acab83aedcb00e869abfcd@sha256:3dc78daebb56605baf105d2f20a6e8b94137237c1c2587b80d571fbb5c9f49ab
FROM ghcr.io/gardenlinux/builder:0196add0ce875ac0b7721c19b2ee3ac37cf84387@sha256:a25e60658d595f0040b516fedaa067802e69f40810ebdd95ade5a59385eabf4c

RUN sed 's/version="$2"/version=\$(echo \$2 | cut -d. -f 1-2)/' -i /builder/bootstrap
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1877.22.0
1877.23.0
68 changes: 60 additions & 8 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ shopt -s nullglob
exec 3>&1
exec 1>&2

#container_image=ghcr.io/gardenlinux/builder:d6d24ba1aec66889a2acab83aedcb00e869abfcd
container_image=localhost/builder
container_engine=podman
target_dir=.build
Expand All @@ -23,9 +22,15 @@ container_cmd=()

use_kms=0
resolve_cname=0
allow_frankenstein=1
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
Expand Down Expand Up @@ -59,6 +64,10 @@ while [ $# -gt 0 ]; do
target_dir="$2"
shift 2
;;
--apparmor-profile)
apparmor_profile="$2"
shift 2
;;
*)
break
;;
Expand All @@ -72,11 +81,10 @@ container_mount_opts=(
-v "$(realpath "$target_dir"):/builder/.build"
)

for feature in features/*; do
if [ -d "$feature" ]; then
container_mount_opts+=(-v "$(realpath -- "$feature"):/builder/$feature:ro")
fi
done
# 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]}")")"
Expand All @@ -91,7 +99,7 @@ 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")"
cname="$("$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" /builder/parse_features --allow-frankenstein --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
Expand All @@ -102,8 +110,13 @@ make_opts=(
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
Expand All @@ -112,7 +125,7 @@ if [ "$use_kms" = 1 ]; then
done
fi

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

if [[ -f "$PWD"/build.config ]]; then
Expand All @@ -125,4 +138,43 @@ 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 requirements.defs
Loading