Commit Graph

51 Commits

Author SHA1 Message Date
Lokesh Mandvekar
f88186e688 [skip-ci] Packit/TMT: Run system tests
This commit enables TMT jobs triggered by Packit to run system tests.

2 set of jobs `dev` and `release` have been added. `dev` jobs are meant
to run on main PRs with additional package updates fetched from
podman-next copr while `release` jobs are meant to run on release-
branch PRs using only the dependencies present in the official distro.

Packit checks PR labels (see previous commit) to filter out
the jobs that get run.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2025-02-12 21:51:18 +01:00
Paul Holzinger
b5a13bccfd systemtest: update quay.io registry image
The "2" tag is very old and not a multi arch manifest. As such testing
on aarch64 failed because it pulled and x86_64 image instead. This was
found in downstream RHEL testing.

The "2.8.2" is multi arch and used in podman testing were we
successfully run aarch64 based testing.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-01-11 20:56:39 +01:00
Miloslav Trmač
f423f01d1b Update an expected error message
https://github.com/containers/image/pull/2595 will change it.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-11-20 16:18:20 +01:00
Lokesh Mandvekar
d38276137e
Replace egrep with grep -E
This should silence any `egrep is obsolescent; using grep -E` warnings.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2024-08-16 09:13:18 -04:00
Miloslav Trmač
513a4f1ab3 Update for changed c/image error texts
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-05-14 00:27:18 +02:00
Michael Vogt
16b6f0ade5 main: return exit code 2 when an input is not found
This commit makes skopeo return a different exit code when an
input is not found. The use case is `osbuild` which uses skopeo
to inspect images and it would be nice to differenciate between
an image that is not found and general skopeo errors (or errors
like network issues etc).

I picked exit code `2` for `not found` because it is also the value
of `ENOENT`.

Man page and a test are added.

Signed-off-by: Michael Vogt <mvogt@redhat.com>
2024-03-25 18:05:45 +01:00
James Hewitt
3097b7a4e9
Verify signatures from a trust store
Add the ability to use an on-disk trust store to verify signatures. Also allow the user to trust any known fingerprint instead of having to specify one.

Signed-off-by: James Hewitt <james.hewitt@uk.ibm.com>
2023-04-01 11:51:57 +01:00
Toshiki Sonoda
454f8559c1 systemtests: Fix 040-local-registry-auth about XDG_RUNTIME_DIR
Need to restore XDG_RUNTIME_DIR when podman removes the registry.

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-03-28 15:01:41 +09:00
Daniel J Walsh
2c6e15b5ab
Run codespell on codebase
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2023-02-09 09:13:32 -05:00
Miloslav Trmač
36c480f643 Don't affect $XDG_RUNTIME_DIR of Podman starting the registry
Otherwise $XDG_RUNTIME_DIR/netns gets created and mounted,
breaking (rm -rf).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-01-20 20:06:08 +01:00
Chris Evich
292962d34c
Fix unnecessary use of podman in CI test
For whatever reasons, the podman configuration in CI results in the
inspect test throwing the following error:

```
not ok 4 inspect: image manifest list w/ diff platform
125
configuration is unset - using hardcoded default graph root
\"/var/lib/containers/storage\""
configuration is unset - using hardcoded default graph root
\"/var/lib/containers/storage\""
StoreOptions
```

Fix this by not using `podman`. It's unnecessary, since all the test
needs is the golang-flavor of the current system's architecture name.
That can easily be obtained by asking the go tool directly.

Signed-off-by: Chris Evich <cevich@redhat.com>
2023-01-18 10:09:44 -05:00
Miloslav Trmač
955a59c864 Update tests for changed error texts
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-12 22:56:46 +02:00
Erol Keskin
d3ff6e2635 warn users about --dest-compress and --dest-decompress misuse
Signed-off-by: Erol Keskin <erolkeskin.dev@gmail.com>
2022-09-07 03:38:28 +03:00
Daniel J Walsh
c233a6dcb1
Add dry-run mode to skopeo-sync
Taking over #1459 to drive it to completion.

Signed-off-by: Ted Wexler <twexler@bloomberg.net>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-03-28 14:18:10 -04:00
zhangguanzhang
7ba56f3f7a Add support for docker-archive: to skopeo list-tags
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2022-03-15 09:32:05 +08:00
Miloslav Trmač
370be7e777 Improve a comment in the 010-inspect.bats test
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-02-22 19:44:14 +01:00
Miloslav Trmač
49d9fa9faf Only look for the layer digests in the Layers field.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-02-15 16:08:35 +01:00
Miloslav Trmač
77363128e1 Don't expect the config blob to be listed in (skopeo inspect)
... because it currently isn't.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-02-15 16:08:35 +01:00
Ed Santiago
de71408294 tests: skip sif test on RHEL
(or, more precisely, if fakeroot binary not in $PATH).

Solves RHEL gating-test failure.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-02-07 13:04:15 -07:00
Valentin Rothberg
a4476c358c add a SIF systemtest
To make sure that the basic functionality is exercised in Skopeo and
c/image CI.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-27 10:02:02 +01:00
Valentin Rothberg
bb49923af4 prompt-less signing via passphrase file
To support signing images without prompting the user, add CLI flags for
providing a passphrase file.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-26 08:30:49 +01:00
Ed Santiago
942cd6ec58 Fix bug that prevented useful diagnostics on registry fail
Sigh. 'expr 1 - 1' yields 0 (correctly) but also exits 1. This
is even documented in the man page, but I didn't know it. And
thus, on the final iteration, when timeout reached 0, BATS
errored out on the expr instead of continuing to the 'podman logs'
or the 'die' message.

Solution is super trivial: use $(( ... )) instead of expr.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-11-10 19:56:33 -07:00
Jaikiran Pai
2144a37c21 issue#785 inspect command - introduce a way to skip querying available tags for an image 2021-10-12 20:24:39 +05:30
Ed Santiago
f6ae786508 systemtests: if registry times out, show container logs
the 'signing' test is flaking; symptom is that we can never
connect to the port on the registry:

   https://api.cirrus-ci.com/v1/task/6208385738604544/logs/system.log

By all indications, the registry is up, i.e., the 'podman rm -f reg'
in teardown() succeeds, as shown by the 53c (CID) in the log. (It
bothers me that the FAIL message from die() does not appear in the
log, and I can't figure out why).

To try to diagnose this, run 'podman logs' on the registry upon
failure.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-08-11 10:10:23 -06:00
Daniel J Walsh
6d6c8b5609 Update tests for removal of error and Error from error messages
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-07-01 21:02:13 +02:00
Hironori Shiina
bef5e4505e Add system tests
Add system tests for the following subcommands and flags:
- skopeo copy --format
- skopeo copy --additional-tag
- skopeo copy --dest-shared-blob-dir
- skopeo copy --src-shared-blob-dir
- skopeo inspect --tls-verify --cert-dir
- skopeo delete --tls-verify --cert-dir
- skopeo copy --dest-creds
- skopeo copy --src-creds
- skopeo copy --authfile
- skopeo inspect --authfile
- skopeo delete --authfile
- skopeo copy --remove-signatures
- skopeo standalone-sign
- skopeo standalone-verify
- skopeo manifest-digest

Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
2021-03-16 11:00:56 +01:00
Nalin Dahyabhai
81e66ffc46 020-copy.bats: check that we set the manifest type correctly
When copying to an OCI layout destination, forcing zstd compression,
check that the manifest correctly describes the type of the layer blob.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-02-05 11:31:12 -05:00
Ed Santiago
47a6716921 Migrate tests from docker.io
Switch to using images from quay.io/libpod instead, where
we're not (yet) subject to rate limiting.

Completely rewrite one unclear test. The purpose of the
test was to test #708, in which 'skopeo inspect --raw'
was fixed to be able to inspect images that do not
match the current host's os+arch. We now use a fixed
test image on quay.io, generated by a new script,
whose manifest is pretty unlikely to match our host.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-01-21 14:04:01 -07:00
Josh Soref
4987a67293 Spelling
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-12-21 16:10:45 -05:00
Ed Santiago
f9773889a1 Add Subject Alternative Name to local openssl cert
Go 1.15 deprecates checking CN; this broke gating tests:

   Get "https://localhost:5000/v2/": x509: certificate relies on legacy Common Name field, use SANs or temporarily enable Common Name matching with GODEBUG=x509ignoreCN=0

Easy two-line solution in the 'openssl' invocation. Huge
thanks to Nalin for tracking down and fixing while I was
still getting started:

   https://github.com/containers/buildah/pull/2595

Copied from 0f2892a5b021de3b1cf273f5679fda8298b57c02 in buildah

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-10-01 06:32:55 -06:00
Miloslav Trmač
0e2611d3a6 Run htpasswd from our build-container instead of registry:2
registry:2 no longer contains htpasswd.

Also don't use log_and_run ... >> $file
because that will cause the command to be logged to $file.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2020-06-19 19:44:52 +02:00
Ed Santiago
cf4dff471c Fix for yet another breaking podman change
'podman info' changed format, again, without preserving backward
compatibility. Basically, some keys that used to be lower-case
are now upper-case-first-letter.

These tests need to work with new podman on rawhide, and
old podman on f31/f32 and possibly RHEL. We must therefore
add a revolting workaround for the change.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-04-08 15:32:44 -06:00
Ed Santiago
6e3f4c99be Update on #834: force runc only when cgroupsv1
PR 834 broke Fedora gating tests, because "--runtime runc"
doesn't work so well on Rawhide. Let's try to be smarter
about when we add that override.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-31 05:14:35 -06:00
Ed Santiago
1e7fe55be0 Use fully-qualified image names
Replace shortnames with FQINs; this should allow tests to
run regardless of the state of registries.conf.

And, fix one broken new test that invoked 'jq' (without dot).
This usage works in Fedora, but not in RHEL.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-19 14:13:18 -06:00
Valentin Rothberg
2e65e64c06 CI: force Podman to use runc
crun had a regression running on cgroupsv1 in containers.  It has been
fixed upstream but did not yet bubble up into the packages.  Force using
runc to unblock Skopeo's CI.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-03 11:09:31 +01:00
Daniel J Walsh
10d0ebb9fe
Merge pull request #754 from mtrmac/podman-login-consistency
Revert "Temporarily work around auth.json location confusion"
2019-10-31 14:40:10 -04:00
Miloslav Trmač
d83d081942 Revert "Temporarily work around auth.json location confusion"
This reverts commit 4962559e5c.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-10-31 17:33:39 +01:00
Alex Jia
2553a230d0 systemtest: inspect container image different from current platform arch
When --raw is provided, can inspect show the raw manifest list, w/o
requiring any particular platform to be present, this test case is
used for make sure inspect command w/ --raw option works well for
container image is different from current platform arch.

Signed-off-by: Alex Jia <chuanchang.jia@gmail.com>
2019-10-24 14:33:45 +08:00
Ed Santiago
58248412bd System tests: various fixes
- zstd test - give unique name.

   a36d81c copy/pasted an existing test but didn't give
   the new test a new name, leading to bats warning:
      duplicate test name(s) in [...]/020-copy.bats

 - start_registry() - use bash builtins, not curl, to test
   if registry port is open.

   curl on Fedora now barfs with "Received HTTP/0.9 when not
   allowed" when the registry is run with SSL, because the
   response is not valid HTTP. One workaround would be 'curl
   --http0.9' but (surprise) that option doesn't exist on rhel8;
   and even with that option we would need --output /dev/null
   to silence a different curl warning. Curl is overkill
   for this purpose anyway, all we really need is netcat
   or some simple binary is-port-listening-or-not test.
   Fortunately, bash provides a /dev/tcp/<host>/<port>
   emulator that does the right thing and works on Fedora
   as well as RHEL8.

 - new log_and_run() helper

   This is the noisiest yet least critical part of this PR.
   I'm sorry. It's motivated by my frustration in trying
   to reproduce the curl problem above: getting just the
   right incantation of openssl + podman-run cost me time.
   With this enhancement, important commands are logged
   as part of the output of failing tests, making it
   easy[*] for maintenance programmers to figure out a
   recipe for reproducing the failure.

     [*] "easy" as long as the test-writing developer
         uses log_and_run() wisely.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-10-15 15:59:14 -06:00
Nalin Dahyabhai
4962559e5c Temporarily work around auth.json location confusion
Temporarily work around https://github.com/containers/libpod/issues/4227
until Fedora has an updated packaged version of podman that includes
that fix, at which point we should revert this patch.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-10-15 12:36:19 -04:00
Valentin Rothberg
51b54191a8 systemtest: copy: docker->storage->oci-archive
Add a systemtest copying an image from docker to storage and then to an
oci-archive.  There are other ways to trigger the same code paths, but
this one has caught a regression in c/image in libpod's.

Fixes: #734
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-10-02 20:02:24 +02:00
Valentin Rothberg
1c243a5b12 systemtest/010-inspect.bats: require only PATH
The "inspect: env" test started failing since the environment in the
`fedora:latest` image has changed.  Hence, only check for `PATH` in
the image's environment which is a defacto standard.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-09-30 15:31:14 +02:00
Alex Jia
8d1bb15075 systemtest: add simple env test in inspect.bats
Signed-off-by: Alex Jia <chuanchang.jia@gmail.com>
2019-09-18 10:35:27 +08:00
Giuseppe Scrivano
a36d81c55c
copy: add --dest-compress-format and --dest-compress-level
add the possibility to specify the format and the level to use when
compressing blobs.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-09-02 17:28:22 +02:00
Alex Jia
6878c95ea8 systemtest: support deleting image from registry
Signed-off-by: Alex Jia <chuanchang.jia@gmail.com>
2019-07-31 18:47:13 +08:00
Alex Jia
70ec2ca2e3 systemtest/040-local-registry-auth.bats: fix a typo
Signed-off-by: Alex Jia <chuanchang.jia@gmail.com>
2019-07-28 17:01:02 +08:00
Miloslav Trmač
a4de1428f9 Skip systemtest/050-signing.bats if skopeo can't create signatures
This does not happen in this repo's tests, but containers/image's
(make test-skopeo) fails in the containers_image_openpgp configuration with

> not ok 10 signing
> ...
> # time="2019-06-11T20:59:32Z" level=fatal msg="Signing not supported: signing is not supported in github.com/containers/image built with the containers_image_openpgp build tag"

To reproduce/test this:
> make test-system BUILDTAGS='ostree containers_image_openpgp'

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-06-13 18:53:53 +02:00
Ed Santiago
fa18fce7e8 start_registry: wait for registry to be ready
The usual 'podman run -d' race condition: we've been forking
off the container but not actually making sure it's up; this
leads to flakes in which we try (and fail) to access it.

Solution: use curl to check the port; we will expect a zero
exit status once we can connect. Time out at ten seconds.

Resolves: #675

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-06-13 09:27:58 -06:00
Ed Santiago
47e7cda4e9 System tests - get working under podman-in-podman
Skopeo CI tests run under podman; hence the registries
run in the tests will be podman-in-podman. This requires
complex muckery to make work:

 - install bats, jq, and podman in the test image
 - add new test-system Make target. It runs podman
   with /var/lib/containers bind-mounted to a tmpdir
   and with other necessary options; and invokes a
   test script that hack-edits /etc/containers/storage.conf
   before running podman for the first time.
 - add --cgroup-manager=cgroupfs option to podman
   invocations in BATS: without this, podman-in-podman
   fails with:
       systemd cgroup flag passed, but systemd support for managing cgroups is not available

Also: gpg --pinentry-mode option is not available on all
our test platforms. Check for it before using.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-05-28 10:53:12 -06:00
Ed Santiago
5dd3b2bffd fixup! Incorporate review feedback from mtrmac
- Got TLS registry working, and test enabled. The trick was to
  copy the .crt file to a separate directory *without* the .key

- auth test - set up a private XDG_RUNTIME_DIR, in case tests
  are being run by a real user.

- signing test - remove FIXME comments; questions answered.

- helpers.bash - document start_registries(); save a .crt file,
  not .cert; and remove unused stop_registries() - it's too hard
  to do right, and very easy for individual tests to 'podman rm -f'

- run-tests - remove SKOPEO_BINARY definition, it's inconsistent
  with the one in helpers.bash

Signed-off-by: Ed Santiago <santiago@redhat.com>
2019-05-28 10:10:50 -06:00