Skip to content

Commit

Permalink
remove --verbose from rock entrypoint (#495)
Browse files Browse the repository at this point in the history
  • Loading branch information
linostar authored Jun 11, 2024
1 parent d81fc0c commit af0ee81
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/reference/rockcraft.yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ others are optional.
**Required**: No

The optional name of the Pebble service to serve as the OCI entrypoint. If set,
this makes Rockcraft extend ``["/bin/pebble", "enter", "--verbose"]`` with
this makes Rockcraft extend ``["/bin/pebble", "enter"]`` with
``["--args", "<serviceName>"]``. The command of the Pebble service must
contain an optional argument that will become the OCI CMD.

Expand Down
7 changes: 1 addition & 6 deletions rockcraft/pebble.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,7 @@ def get_entrypoint(build_base: str) -> list[str]:
# Previously pebble existed in /bin/pebble
pebble_path = Pebble.PEBBLE_BINARY_PATH_PREVIOUS

entrypoint = [f"/{pebble_path}", "enter"]

if is_legacy:
entrypoint += ["--verbose"]

return entrypoint
return [f"/{pebble_path}", "enter"]

@staticmethod
def _is_focal_or_jammy(build_base: str) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion tests/spread/foreign/big/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ execute: |
docker images
# Check the rock's output
docker run --rm big:latest | MATCH "/tmp"
docker run --rm big:latest --verbose | MATCH "/tmp"
############################################################################################
# test ownership: "newfiles" and "a.txt" are owned by uid 9999, "b.txt" is owned by uid 3333
Expand Down
4 changes: 2 additions & 2 deletions tests/spread/rockcraft/bare-base/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ execute: |
sudo rockcraft.skopeo --insecure-policy copy oci-archive:bare-base-test_latest_amd64.rock docker-daemon:bare-base-test:latest
rm bare-base-test_latest_amd64.rock
docker images bare-base-test:latest
id=$(docker run --rm -d bare-base-test)
id=$(docker run --rm -d bare-base-test --verbose)
grep_docker_log "$id" "ship it!"
docker exec "$id" pebble services | grep hello
docker exec "$id" pebble ls /usr/bin/hello
test "$(docker inspect "$id" -f '{{json .Config.Entrypoint}}')" = '["/bin/pebble","enter","--verbose"]'
test "$(docker inspect "$id" -f '{{json .Config.Entrypoint}}')" = '["/bin/pebble","enter"]'
docker rm -f "$id"
12 changes: 7 additions & 5 deletions tests/spread/rockcraft/entrypoint-service/task.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
summary: container entrypoint-service test

execute: |
set -ex
run_rockcraft pack
test -f entrypoint-service-test_latest_amd64.rock
Expand All @@ -10,11 +11,12 @@ execute: |
rm entrypoint-service-test_latest*.rock
docker images entrypoint-service-test:latest
id=$(docker run -d entrypoint-service-test)
test "$(docker inspect "$id" -f '{{json .Config.Entrypoint}}')" = '["/bin/pebble","enter","--verbose","--args","test-service"]'
test "$(docker inspect "$id" -f '{{json .Config.Entrypoint}}')" = '["/bin/pebble","enter","--args","test-service"]'
test "$(docker inspect "$id" -f '{{json .Config.Cmd}}')" = '["foo"]'
grep_docker_log "$id" "foo"
docker logs "$id" 2>&1 | grep "foo"
docker rm -f "$id"
id=$(docker run -d entrypoint-service-test bar)
test "$(docker inspect "$id" -f '{{json .Config.Cmd}}')" = '["bar"]'
grep_docker_log "$id" "bar"
id=$(sh -c 'docker run -d entrypoint-service-test bar \; --verbose')
test "$(docker inspect "$id" -f '{{json .Config.Entrypoint}}')" = '["/bin/pebble","enter","--args","test-service"]'
test "$(docker inspect "$id" -f '{{json .Config.Cmd}}')" = '["bar",";","--verbose"]'
docker logs "$id" 2>&1 | grep '\[test-service\] bar'
docker rm -f "$id"
4 changes: 2 additions & 2 deletions tests/unit/test_oci.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def test_set_default_user(self, mock_run):
None,
"[email protected]",
Pebble.PEBBLE_BINARY_PATH_PREVIOUS,
["--config.entrypoint", "--verbose"],
[],
[],
),
(
Expand All @@ -583,7 +583,7 @@ def test_set_default_user(self, mock_run):
"test-service",
"[email protected]",
Pebble.PEBBLE_BINARY_PATH_PREVIOUS,
["--config.entrypoint", "--verbose"],
[],
[
"--config.entrypoint",
"--args",
Expand Down

0 comments on commit af0ee81

Please sign in to comment.