pkg: fedora: Create containers manually, reclaim space from the runner
The GitHub runners usually have about 14 GB of free space. This is
not enough to build a full Fedora kernel with debug symbols.
Disabling the debug symbols is not an option, because they are needed
to generate data for BPF programs, and because it would mean more
patches to the spec file which I would like to avoid.
The runners contain a bunch of software that is entirely useless for
our purposes. For example, a full .NET distribution, the entire Android
SDK, and a bunch of cached container images that arent Fedora.
However, with GitHubs container directive it is not possible to remove
these, because no custom code is ever executed on the runner itself.
To execute code on the runner, the container has to be created and used
manually. To simplify this, all of the actual logic has been moved to a
dedicated script, similar to how the CI on iptsd is set up.
2023-07-22 18:27:44 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euxo pipefail
|
|
|
|
|
|
|
|
dnf()
|
|
|
|
{
|
|
|
|
command dnf -y "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z "${GIT_REF:-}" ]; then
|
|
|
|
echo "GIT_REF is unset!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${GITHUB_REPOSITORY:-}" ]; then
|
|
|
|
echo "GITHUB_REPOSITORY is unset!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${SURFACEBOT_TOKEN:-}" ]; then
|
|
|
|
echo "SURFACEBOT_TOKEN is unset!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${BRANCH_STAGING:-}" ]; then
|
|
|
|
echo "BRANCH_STAGING is unset!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
FEDORA="${1:-}"
|
|
|
|
|
|
|
|
if [ -z "${FEDORA}" ]; then
|
|
|
|
echo "Fedora version is unset!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
REPONAME="$(echo "${GITHUB_REPOSITORY}" | cut -d'/' -f2)"
|
|
|
|
REPO="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
|
|
|
|
|
|
|
|
# parse git tag from ref
|
|
|
|
GIT_TAG="${GIT_REF#refs/tags/}"
|
|
|
|
|
|
|
|
# Install dependencies
|
2023-07-25 10:35:37 +00:00
|
|
|
dnf install git findutils openssl
|
pkg: fedora: Create containers manually, reclaim space from the runner
The GitHub runners usually have about 14 GB of free space. This is
not enough to build a full Fedora kernel with debug symbols.
Disabling the debug symbols is not an option, because they are needed
to generate data for BPF programs, and because it would mean more
patches to the spec file which I would like to avoid.
The runners contain a bunch of software that is entirely useless for
our purposes. For example, a full .NET distribution, the entire Android
SDK, and a bunch of cached container images that arent Fedora.
However, with GitHubs container directive it is not possible to remove
these, because no custom code is ever executed on the runner itself.
To execute code on the runner, the container has to be created and used
manually. To simplify this, all of the actual logic has been moved to a
dedicated script, similar to how the CI on iptsd is set up.
2023-07-22 18:27:44 +00:00
|
|
|
|
|
|
|
# clone package repository
|
|
|
|
git clone -b "${BRANCH_STAGING}" "${REPO}" repo
|
|
|
|
|
|
|
|
# copy packages
|
2023-08-01 19:25:36 +00:00
|
|
|
find "fedora-${FEDORA}-latest" -type f -print0 | xargs -0 -I '{}' cp {} "repo/fedora/f${FEDORA}"
|
pkg: fedora: Create containers manually, reclaim space from the runner
The GitHub runners usually have about 14 GB of free space. This is
not enough to build a full Fedora kernel with debug symbols.
Disabling the debug symbols is not an option, because they are needed
to generate data for BPF programs, and because it would mean more
patches to the spec file which I would like to avoid.
The runners contain a bunch of software that is entirely useless for
our purposes. For example, a full .NET distribution, the entire Android
SDK, and a bunch of cached container images that arent Fedora.
However, with GitHubs container directive it is not possible to remove
these, because no custom code is ever executed on the runner itself.
To execute code on the runner, the container has to be created and used
manually. To simplify this, all of the actual logic has been moved to a
dedicated script, similar to how the CI on iptsd is set up.
2023-07-22 18:27:44 +00:00
|
|
|
pushd "repo/fedora/f${FEDORA}" || exit 1
|
|
|
|
|
|
|
|
# convert packages into references
|
|
|
|
while read -rd $'\n' FILE; do
|
|
|
|
echo "${REPONAME}:${GIT_TAG}/$(basename "${FILE}")" > "${FILE}.blob"
|
|
|
|
rm "${FILE}"
|
|
|
|
done <<< "$(find . -name '*.rpm' -type f)"
|
|
|
|
|
2023-07-25 10:35:37 +00:00
|
|
|
RAND="$(openssl rand -hex 16)"
|
pkg: fedora: Create containers manually, reclaim space from the runner
The GitHub runners usually have about 14 GB of free space. This is
not enough to build a full Fedora kernel with debug symbols.
Disabling the debug symbols is not an option, because they are needed
to generate data for BPF programs, and because it would mean more
patches to the spec file which I would like to avoid.
The runners contain a bunch of software that is entirely useless for
our purposes. For example, a full .NET distribution, the entire Android
SDK, and a bunch of cached container images that arent Fedora.
However, with GitHubs container directive it is not possible to remove
these, because no custom code is ever executed on the runner itself.
To execute code on the runner, the container has to be created and used
manually. To simplify this, all of the actual logic has been moved to a
dedicated script, similar to how the CI on iptsd is set up.
2023-07-22 18:27:44 +00:00
|
|
|
BRANCH="${BRANCH_STAGING}-${RAND}"
|
|
|
|
|
|
|
|
# set git identity
|
|
|
|
git config --global user.name "surfacebot"
|
|
|
|
git config --global user.email "surfacebot@users.noreply.github.com"
|
|
|
|
|
|
|
|
# commit and push
|
|
|
|
git checkout -b "${BRANCH}"
|
|
|
|
git add .
|
|
|
|
git commit -m "Update Fedora ${FEDORA} ${REPONAME} package"
|
|
|
|
git push --set-upstream origin "${BRANCH}"
|
|
|
|
|
|
|
|
popd || exit 1
|