Skip to content

Commit

Permalink
Modify container image for bots/infrastructure migration (#78)
Browse files Browse the repository at this point in the history
Contains a few individual changes, needed for the bot/infrastructure
migration.
  • Loading branch information
nikolaszimmermann authored Nov 21, 2024
1 parent 13a4824 commit ccd09fe
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
12 changes: 7 additions & 5 deletions images/wkdev_sdk/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL maintainer="webkit-gtk@lists.webkit.org"
LABEL version="1.0"
LABEL org.opencontainers.image.title="WebKit SDK"
LABEL org.opencontainers.image.description="Provides a complete WebKit Gtk/WPE development environment based on Ubuntu 24.04"
LABEL org.opencontainers.image.source=https://github.com/Igalia/wkdev-sdk
LABEL org.opencontainers.image.source=https://github.com/Igalia/webkit-container-sdk

# Tweakable "make -j <x>" setting.
ARG NUMBER_OF_PARALLEL_BUILDS=4
Expand All @@ -23,10 +23,6 @@ ARG APT_AUTOREMOVE="apt-get --assume-yes autoremove"
# Disable prompt during package configuration
ENV DEBIAN_FRONTEND noninteractive

# Debian package build settings
ENV DEBEMAIL "webkit-gtk@lists.webkit.org"
ENV DEBFULLNAME "Igalia"

# Enable debugging in WebKit's sandbox.
ENV WEBKIT_ENABLE_DEBUG_PERMISSIONS_IN_SANDBOX "1"

Expand Down Expand Up @@ -145,5 +141,11 @@ RUN gst-inspect-1.0 audiornnoise && \
gst-inspect-1.0 livesync && \
gst-inspect-1.0 rsrtp

# Remove systemd services that would startup by default, when spawning
# systemd as PID 1 within the container (usually, we don't spawn systemd
# within the wkdev-sdk container, for interactive usage, but we do so
# when deploying the wkdev-sdk image as bot).
RUN find /etc/systemd/ -type l -name '*.service' -print -exec rm {} \;

# Switch back to interactive prompt, when using apt.
ENV DEBIAN_FRONTEND dialog
2 changes: 1 addition & 1 deletion images/wkdev_sdk/required_system_packages/04-devtools.lst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build-essential cmake ninja-build

# Build tools
icecc ccache rustup
ccache rustup

# Debugging / profiling / tracing
valgrind rr perf-tools-unstable systemd-coredump
Expand Down
12 changes: 11 additions & 1 deletion scripts/host-only/wkdev-sdk-bakery
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ argsparse_use_option trace "Enable 'xtrace' mode for this script"
argsparse_use_option =verbose "Increase verbosity of this script"

argsparse_use_option =name: "Name of container image" mandatory default:wkdev-sdk
argsparse_use_option =env: "Environment variable as string array, e.g. -e KEY=value,FOO=bar" cumulative
argsparse_use_option =mode: "Operation mode: 'build', 'deploy', or 'export'" mandatory
argsparse_use_option idle-cores: "Number of CPU cores to leave idle, when building the image" type:uint default:2
argsparse_use_option =tag: "Tag to use for created image." default:$(get_default_container_tag)
Expand Down Expand Up @@ -58,7 +59,16 @@ build_image() {

pushd "$(get_image_directory_by_name "${container_image_name}")" &>/dev/null
timer_start
run_podman_silent_unless_verbose build --jobs $(get_number_of_cores_for_build) --tag "$(get_tag_for_build)" . || _abort_ "Container image build failed"

local podman_argument=("--jobs" "$(get_number_of_cores_for_build)")
podman_argument+=("--tag" "$(get_tag_for_build)")

for environment_variable in "${cumulated_values_env[@]}"
do
podman_argument+=("--env" "${environment_variable}")
done

run_podman_silent_unless_verbose build ${podman_argument[@]} . || _abort_ "Container image build failed"
timer_stop
popd &>/dev/null
}
Expand Down
15 changes: 4 additions & 11 deletions utilities/resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
[ -z "${application_ready}" ] && { echo "[FATAL] You need to source 'utilities/application.sh' before sourcing this script."; return 1; }

# Internal helpers
_get_sdk_images_directory() { echo "${WKDEV_SDK}/images"; }
_get_sdk_templates_directory() { echo "$(_get_sdk_images_directory)/wkdev_sdk/custom_built_packages/templates"; }
_get_sdk_images_directory() {
local default="${WKDEV_SDK}/images";
echo "${WKDEV_SDK_IMAGES_DIRECTORY:-"${default}"}";
}

# Get absolute path to '<wkdev-sdk>/images/<image>' directory, given an image name.
# The subdirectory name is equal to the image name, except that hyphens transform to
Expand All @@ -16,12 +18,3 @@ get_image_directory_by_name() {
[ ! -d "${image_directory}" ] && _abort_ "Invalid image directory '${image_directory}' for image name '${image_name}'"
echo "${image_directory}"
}

# Get absolute path to '<wkdev-sdk>/.../templates/<template-name>.template' file, given a <template-name>.
get_template_file_by_name() {

local template_name="${1}"
local template_file="$(_get_sdk_templates_directory)/${template_name}.template"
[ ! -f "${template_file}" ] && _abort_ "Invalid template file '${template_file}' for template name '${template_name}'"
echo "${template_file}"
}

0 comments on commit ccd09fe

Please sign in to comment.