Skip to content

Commit

Permalink
moved base container images to root directory
Browse files Browse the repository at this point in the history
The BlueChi base images for build and integration test as
well as the rpm build image have been moved from
tests/containers/ to containers/ directory. It also includes
the necessary path changes.
The build and push script has also been fixed.

Signed-off-by: Michael Engel <[email protected]>
  • Loading branch information
engelmi committed Mar 27, 2024
1 parent 697bc57 commit 943df62
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ meson configure -Dwith_analyzer=true builddir
```

Since the result of the analysis is heavily dependent on the compiler version, flags, etc., its recommended to build
and run tests for BlueChi also in the [build-base](./tests/containers/build-base):
and run tests for BlueChi also in the [build-base](./containers/build-base):

```bash
# navigate into the bluechi directory
Expand Down
12 changes: 8 additions & 4 deletions build-scripts/build-push-containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ IMAGE="$1"
# The 2nd parameter is optional and it specifies the container architecture. If omitted, all archs will be built.
ARCHITECTURES="${2:-amd64 arm64}"
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
CONTAINER_FILE_DIR=$SCRIPT_DIR"/../tests/containers"
ROOT_DIR=$SCRIPT_DIR"/../"
CONTAINER_FILE_DIR=$SCRIPT_DIR"/../containers"

function push(){
buildah manifest push --all $IMAGE "docker://quay.io/bluechi/$IMAGE"
}

function build(){
buildah manifest exists $IMAGE || buildah manifest create $IMAGE
# remove old image, ignore result
buildah manifest rm $IMAGE &> /dev/null

buildah manifest create $IMAGE

for arch in $ARCHITECTURES; do
buildah bud --tag "quay.io/bluechi/$IMAGE" \
--manifest $IMAGE \
--arch ${arch} \
--build-context root_dir=${SCRIPT_DIR}/.. \
${CONTAINER_FILE_DIR}/${IMAGE}
-f ${CONTAINER_FILE_DIR}/${IMAGE} \
${ROOT_DIR}
done
}

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/containers/build-base → containers/build-base
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RUN dnf install -y dnf-plugin-config-manager && \
dnf -y clean all

# Install python dependencies
COPY --from=root_dir requirements.txt .
COPY requirements.txt .
RUN python3 -m venv /opt/bluechi-env && \
. /opt/bluechi-env/bin/activate && \
pip install -r requirements.txt && \
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# NOTE: build-base container image needs to be rebuilt after changing this file!
# NOTE: containers/build-base image needs to be rebuilt after changing this file!

# Try to keep linter package versions aligned with latest Fedora RPM versions
black==24.1.1
flake8==6.0.0
isort==5.13.2

11 changes: 3 additions & 8 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,24 +193,19 @@ New id 'UUID' added to test '/tests/path_to_your_new_test'.
The integration tests rely on containers as separate compute entities. These containers are used to simulate BlueChi's
functional behavior on a single runner.

The [containers](./containers/) directory contains two container files.

The `integration-test-base` file describes the builder base image that is published to
[https://quay.io/repository/bluechi/integration-test-base](https://quay.io/repository/bluechi/integration-test-base). It contains core dependencies such as systemd and devel packages.

Both, `integration-test-local` as well as `integration-test-snapshot`, are based on the builder base image for the integration tests and contain compiled products and configurations for integration testing.
Both, [integration-test-local](./containers/integration-test-local) as well as [integration-test-snapshot](./containers/integration-test-snapshot), are based on the [integration-base](../containers/integration-test-base) image which contains core dependencies such as systemd and devel packages. The base image is published to [https://quay.io/repository/bluechi/integration-test-base](https://quay.io/repository/bluechi/integration-test-base).

### Updating container images in registry

The base images can either be build and pushed locally or via a github workflow to the [bluechi on quay.io](https://quay.io/organization/bluechi) organization and its repositories. If any updates are required, please reach out to the [code owners](../.github/CODEOWNERS).

#### Building and pushing via workflow

The base images [build-base](./containers/build-base) and [integration-test-base](./containers/integration-test-base) can be built and pushed to quay by using the [Container Image Workflow](../.github/workflows/images.yml). It can be found and triggered here in the [Actions tab](https://github.com/eclipse-bluechi/bluechi/actions/workflows/images.yml) of the BlueChi repo.
The base images [build-base](../containers/build-base) and [integration-test-base](../containers/integration-test-base) can be built and pushed to quay by using the [Container Image Workflow](../.github/workflows/images.yml). It can be found and triggered here in the [Actions tab](https://github.com/eclipse-bluechi/bluechi/actions/workflows/images.yml) of the BlueChi repo.

#### Building and pushing locally

The base images [build-base](./containers/build-base) and [integration-test-base](./containers/integration-test-base) are built for multiple architectures (arm64 and amd64) using the [build-containers.sh](../build-scripts/build-containers.sh) script. It'll build the images for the supported architectures as well as a manifest, which can then be pushed to the registry.
The base images [build-base](../containers/build-base) and [integration-test-base](../containers/integration-test-base) are built for multiple architectures (arm64 and amd64) using the [build-containers.sh](../build-scripts/build-containers.sh) script. It'll build the images for the supported architectures as well as a manifest, which can then be pushed to the registry.

Building for multiple architectures, the following packages are required:

Expand Down

0 comments on commit 943df62

Please sign in to comment.