Skip to content

Commit

Permalink
Changes rock bases to bare
Browse files Browse the repository at this point in the history
The whereabouts image is supposed to install the binaries on the host
it's running on. For this, it runs a bash script, which is why we still
need a few stage packages. Note that the helm chart uses pgrep in a
readiness / liveness probe.

We can no longer use ensure_image_contains_paths to check if files exist
in the rock images, since they are now bare-based. Instead, we can use
ensure_image_contains_paths_bare, which checks the image layers instead.
Because of this, we need sufficient permissions to check the
/var/lib/docker folder.
  • Loading branch information
claudiubelu committed Oct 24, 2024
1 parent 2fe3070 commit 4afeea1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
8 changes: 7 additions & 1 deletion 0.5.4/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: |
license: Apache-2.0
version: 0.5.4

base: [email protected]
base: bare
build-base: [email protected]

platforms:
Expand All @@ -33,6 +33,12 @@ parts:
source-type: git
source-tag: v${CRAFT_PROJECT_VERSION}
source-depth: 1
stage-packages:
- bash
- coreutils
- sed
# Needed for pgrep, which is used as a liveness / readiness probe.
- procps
build-snaps:
- go/1.16/stable
build-environment:
Expand Down
8 changes: 7 additions & 1 deletion 0.6.1/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: |
license: Apache-2.0
version: 0.6.1

base: [email protected]
base: bare
build-base: [email protected]

platforms:
Expand All @@ -33,6 +33,12 @@ parts:
source-type: git
source-tag: v${CRAFT_PROJECT_VERSION}
source-depth: 1
stage-packages:
- bash
- coreutils
- sed
# Needed for pgrep, which is used as a liveness / readiness probe.
- procps
build-snaps:
- go/1.19/stable
build-environment:
Expand Down
8 changes: 7 additions & 1 deletion 0.6.3/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: |
license: Apache-2.0
version: 0.6.3

base: [email protected]
base: bare
build-base: [email protected]

platforms:
Expand All @@ -33,6 +33,12 @@ parts:
source-type: git
source-tag: v${CRAFT_PROJECT_VERSION}
source-depth: 1
stage-packages:
- bash
- coreutils
- sed
# Needed for pgrep, which is used as a liveness / readiness probe.
- procps
build-snaps:
- go/1.20/stable
build-environment:
Expand Down
4 changes: 2 additions & 2 deletions tests/sanity/test_whereabouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _test_whereabouts_rock(image_version, expected_files):
image = rock.image

# check rock filesystem
docker_util.ensure_image_contains_paths(image, expected_files)
docker_util.ensure_image_contains_paths_bare(image, expected_files)

# check binary name and version.
version = docker_util.get_image_version(image)
Expand All @@ -33,7 +33,7 @@ def _test_whereabouts_rock(image_version, expected_files):
assert "KUBERNETES_SERVICE_HOST" in process.stderr

# check script. It expects serviceaccount token to exist.
process = docker_util.run_in_docker(image, ["/install-cni.sh"], False)
process = docker_util.run_in_docker(image, ["bash", "-x", "/install-cni.sh"], False)
assert (
"cat: /var/run/secrets/kubernetes.io/serviceaccount/token: No such file or directory"
in process.stderr
Expand Down
4 changes: 3 additions & 1 deletion tests/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ commands =
description = Run integration tests
deps =
-r {tox_root}/requirements-test.txt
allowlist_externals =
sudo
commands =
pytest -v \
sudo -E {envpython} -m pytest -v \
--maxfail 1 \
--tb native \
--log-cli-level DEBUG \
Expand Down

0 comments on commit 4afeea1

Please sign in to comment.