-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add osbuild-ci images based on c8s and c9s
Add two new variants of the osbuild-ci image based on c8s and c9s. CentOS Stream is lacking some packages. Install all of the unavailable python packages using pip and also pytest on cXs images. The reason is for not installing pytest from cXs repositories is to get the latest version of it to not have to deal with lack of features on older releases. In addition, the cXs base images contain minimal variants of some packages, which we want to install into them. To resolve the conflicts, allow erasing of packages during package installation. The intention is that these cXs images will be used mostly to run the unit tests. The Fedora image should be used for all the additional testing (such as pylint, mypy, isort, ...), including unit tests. Signed-off-by: Tomáš Hozza <[email protected]>
- Loading branch information
Showing
3 changed files
with
222 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# | ||
# osbuild-ci - OSBuild CI Images | ||
# | ||
# This image provides the OS environment for the osbuild continuous integration | ||
# on GitHub Actions. It is based on CesnOS Stream and includes all the required | ||
# packages and utilities for running unit-tests. | ||
# | ||
# Arguments: | ||
# | ||
# * OSB_FROM="quay.io/centos/centos:stream9" | ||
# This controls the host container used as base for the CI image. | ||
# | ||
# * OSB_DNF_PACKAGES="" | ||
# Specify the packages to install into the container. Separate packages | ||
# by comma. By default, no package is pulled in. | ||
# | ||
# * OSB_DNF_GROUPS="" | ||
# Specify the package groups to install into the container. Separate | ||
# groups by comma. By default, no group is pulled in. | ||
# | ||
# * OSB_PIP_PACKAGES="" | ||
# Specify the packages to install into the container using pip. Separate | ||
# packages by comma. By default, no packages are installed. | ||
# | ||
|
||
ARG OSB_FROM="quay.io/centos/centos:stream9" | ||
FROM "${OSB_FROM}" AS target | ||
|
||
# | ||
# Import our build sources and prepare the target environment. When finished, | ||
# we drop the build sources again, to keep the target image small. | ||
# | ||
|
||
WORKDIR /osb | ||
COPY src src | ||
|
||
ARG OSB_DNF_PACKAGES="" | ||
ARG OSB_DNF_GROUPS="" | ||
ARG OSB_PIP_PACKAGES="" | ||
ARG OSB_DNF_ALLOW_ERASING="" | ||
RUN ./src/scripts/dnf.sh "${OSB_DNF_PACKAGES}" "${OSB_DNF_GROUPS}" ${OSB_DNF_ALLOW_ERASING} | ||
RUN ./src/scripts/pip.sh "${OSB_PIP_PACKAGES}" | ||
COPY src/scripts/osbuild-ci.sh . | ||
|
||
RUN rm -rf /osb/src | ||
|
||
# | ||
# Allow cross-UID git access. Git users must be careful not to invoke git from | ||
# within untrusted directory-paths. | ||
# | ||
|
||
RUN git config --global --add safe.directory '*' | ||
|
||
# | ||
# Rebuild from scratch to drop all intermediate layers and keep the final image | ||
# as small as possible. Then setup the entrypoint. | ||
# | ||
|
||
FROM scratch | ||
COPY --from=target . . | ||
|
||
WORKDIR /osb/workdir | ||
ENTRYPOINT ["/osb/osbuild-ci.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# This script is a pip package install helper for container images. It takes | ||
# packages as argument and then installs them via `pip3`. | ||
# | ||
|
||
set -eox pipefail | ||
|
||
OSB_IFS=$IFS | ||
|
||
# | ||
# Parse command-line arguments into local variables. We accept: | ||
# @1: Comma-separated list of packages to install. | ||
# | ||
|
||
if (( $# > 0 )) ; then | ||
IFS=',' read -r -a PIP_PACKAGES <<< "$1" | ||
IFS=$OSB_IFS | ||
fi | ||
if (( $# > 1 )) ; then | ||
echo >&2 "ERROR: invalid number of arguments" | ||
exit 1 | ||
fi | ||
|
||
# | ||
# Install the specified packages. | ||
# | ||
|
||
if (( ${#PIP_PACKAGES[@]} )) ; then | ||
pip3 install --upgrade "${PIP_PACKAGES[@]}" | ||
fi |