Commit graph

241 commits

Author SHA1 Message Date
Ed Santiago 0e85768c96 logformatter: handle podman-remote
Oops! Logs of podman-remote tests are unreadable, they have
multiple (useless) --remote options plus '--url /something/long'
that makes it impossible to read the actual command being run.
This commit strips off '--remote' entirely, and hides '--url'
and its arg in the only-on-mouse-hover '[options]' text.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-07-22 10:32:06 -06:00
OpenShift Merge Robot 80add2902c
Merge pull request #6992 from rhatdan/apparmor
Support default profile for apparmor
2020-07-22 15:38:42 +02:00
Daniel J Walsh 4c4a00f63e
Support default profile for apparmor
Currently you can not apply an ApparmorProfile if you specify
--privileged.  This patch will allow both to be specified
simultaniosly.

By default Apparmor should be disabled if the user
specifies --privileged, but if the user specifies --security apparmor:PROFILE,
with --privileged, we should do both.

Added e2e run_apparmor_test.go

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-22 06:27:20 -04:00
Ed Santiago 7bdf93ee63 logformatter: update MAGIC BLOB string
Fallout from libpod->podman repo name move: the HTML logs
created by logformatter are no longer accessible. They
render as:

    https://storage.googleapis.com/SECRET-5385732420009984-fcae48/artifacts/containers/podman/6313596734930944/html/integration_test.log.html

(yes, "SECRET" instead of "cirrus-ci". Possibly because
the GCE_SSH_USERNAME key, "cirrus-ci", was overzealously
encrypted, making Cirrus censor any instances of the
string in output. Let's see if this fixes it. But anyway
this is a secondary unrelated bug).

Reason: it looks like Cirrus "generated a new magic blob"
when we renamed libpod -> podman. Chris was kind enough to
locate the new magic blob and to give me a link to where
we can discover it ourselves. I added that as a code comment.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-07-20 14:02:14 -06:00
Brent Baude 99cc076700 Fix systemd pid 1 test
fedora removed the systemd package from its standard container image causing our systemd pid1 test to fail.  Replacing usage of fedora to ubi-init.

adding ubi images to the cache for local tests.

also, remove installation of test/policy.json to the system wide /etc/containers

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-07-13 17:11:26 -05:00
Ed Santiago aa16a0aab1 system tests: invoke with abs path to podman
Reversion of one part of #6679: my handling of 'realpath'
would not work when $PODMAN is 'podman-remote --url etc'.
Trying to handle that case got unmaintainable; so instead
let's just force 'make {local,remote}system' to invoke
with a full PODMAN path. This breaks down if someone
runs the tests with a manual 'bats' invocation, but I
think I'm the only one who ever does that.

Since podman path will now be very long in the logs,
add code to logformatter to abbreviate it like we do
for the ginkgo logs.

And, one thing that has bugged me for a long time:
in the error logs, show a different prompt ('#' vs '$')
to distinguish root vs rootless. This should make it
much easier to see at-a-glance whether a log file
is root or not. Add tests for it.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-23 08:10:57 -06:00
Matthew Heon 0e171b7b33 Do not share container log driver for exec
When the container uses journald logging, we don't want to
automatically use the same driver for its exec sessions. If we do
we will pollute the journal (particularly in the case of
healthchecks) with large amounts of undesired logs. Instead,
force exec sessions logs to file for now; we can add a log-driver
flag later (we'll probably want to add a `podman logs` command
that reads exec session logs at the same time).

As part of this, add support for the new 'none' logs driver in
Conmon. It will be the default log driver for exec sessions, and
can be optionally selected for containers.

Great thanks to Joe Gooch (mrwizard@dok.org) for adding support
to Conmon for a null log driver, and wiring it in here.

Fixes #6555

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-17 11:11:46 -04:00
OpenShift Merge Robot c44992827d
Merge pull request #6530 from edsantiago/test_podman_remote
Enable, then partially disable, podman-remote testing
2020-06-10 13:19:44 -04:00
OpenShift Merge Robot 9967f28339
Merge pull request #6193 from cevich/conmon_ci_packages
Cirrus: Include packages for containers/conmon CI
2020-06-09 21:22:17 -04:00
Chris Evich 455a94d1f9
Cirrus: Include packages for containers/conmon CI
This allows the containers/conmon repository to share the same VM
images produced by containers/libpod.  Included are several packages
which are downloaded only since they might otherwise interfere with
testing for some repos.  This allows stable versions to be at the ready
at testing runtime, avoiding any version updates surprising developers.

Also, re-enable running the VM-image check test which was not working
due to a logic problem in Cirrus-CI configuration.  Update the neglected
tests so that they pass on all distros.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-06-09 14:47:23 -04:00
Ed Santiago 15f273b931 WIP: Enable (and disable) remote testing
podman-remote has not been tested. A principal part of the
problem was #5387 - the YAML I wrote did not have the
intended effect, it did not set TEST_REMOTE_CLIENT=true
and because of my multiple iterations I did not catch this
during testing.

Part 1 of this PR is to fix .cirrus.yml to enable remote tests.

Part 2 -- what I had first noticed and tried to fix -- is that
rootless_test.sh was never running remote because, of course,
envariables are not sent via ssh. I reworked integration_test.sh
and rootless_test.sh to use a command-line decision instead.

Part 3, sigh, is to disable one failing integration test
and *all* system tests, because so many of the latter are
failing. Addressing those failures needs to be done in
subsequent PRs. Issues #6538, #6539, #6540 are filed for
some of the problems I isolated. There will be more.

Also, minor, fixed some stale references to varlink.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-06-09 12:43:58 -06:00
OpenShift Merge Robot c831ae110e
Merge pull request #6521 from cevich/update_cors_docs
[CI:DOCS] Improve swagger+CORS metadata docs
2020-06-09 16:43:32 +02:00
Chris Evich 4314336ce3
Improve swagger+CORS metadata docs
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-06-09 09:53:19 -04:00
Valentin Rothberg b6148b6576 force bats version to v1.1.0
We experienced regression when using the latest `v1.2.0-dev` bats in
Ubuntu 20.04 (see github.com/containers/libpod/pull/6418).  Using
bats v1.1.0 worked in the Ubuntu test VM.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-08 15:21:34 +02:00
Brent Baude efd1422143 Enable Ubuntu tests in CI
Add updates required for ubuntu and run integration tests

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-06-08 12:21:16 +02:00
Daniel J Walsh 77b8187ea0
Attempt to turn on special_testing_in_podman tests
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-04 10:58:37 -04:00
Matthew Heon e0d9404634 Enable detached exec for remote
The biggest obstacle here was cleanup - we needed a way to remove
detached exec sessions after they exited, but there's no way to
tell if an exec session will be attached or detached when it's
created, and that's when we must add the exit command that would
do the removal. The solution was adding a delay to the exit
command (5 minutes), which gives sufficient time for attached
exec sessions to retrieve the exit code of the session after it
exits, but still guarantees that they will be removed, even for
detached sessions. This requires Conmon 2.0.17, which has the new
`--exit-delay` flag.

As part of the exit command rework, we can drop the hack we were
using to clean up exec sessions (remove them as part of inspect).
This is a lot cleaner, and I'm a lot happier about it.

Otherwise, this is just plumbing - we need a bindings call for
detached exec, and that needed to be added to the tunnel mode
backend for entities.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-02 15:30:42 -04:00
Valentin Rothberg dc80267b59 compat handlers: add X-Registry-Auth header support
* Support the `X-Registry-Auth` http-request header.

 * The content of the header is a base64 encoded JSON payload which can
   either be a single auth config or a map of auth configs (user+pw or
   token) with the corresponding registries being the keys.  Vanilla
   Docker, projectatomic Docker and the bindings are transparantly
   supported.

 * Add a hidden `--registries-conf` flag.  Buildah exposes the same
   flag, mostly for testing purposes.

 * Do all credential parsing in the client (i.e., `cmd/podman`) pass
   the username and password in the backend instead of unparsed
   credentials.

 * Add a `pkg/auth` which handles most of the heavy lifting.

 * Go through the authentication-handling code of most commands, bindings
   and endpoints.  Migrate them to the new code and fix issues as seen.
   A final evaluation and more tests is still required *after* this
   change.

 * The manifest-push endpoint is missing certain parameters and should
   use the ABI function instead.  Adding auth-support isn't really
   possible without these parts working.

 * The container commands and endpoints (i.e., create and run) have not
   been changed yet.  The APIs don't yet account for the authfile.

 * Add authentication tests to `pkg/bindings`.

Fixes: #6384
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-05-29 15:39:37 +02:00
Chris Evich 8d54e4855c
Cirrus: Fix image-name hints
This properly prints out image-name hints when executing the hack script
without any arguments.  It is required due to changes made by Ed for
test-name beatification.  An identical change was made and reviewed by
Ed in the containers/storage repo.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-05-14 15:00:34 -04:00
Chris Evich 6479b54f41
Cirrus: Update Ubuntu 18 to 20
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-05-14 15:00:34 -04:00
Matthew Heon 440e97c2c0 Remove libpod.conf from repo
Now that we're shipping containers.conf, we don't want to provide
a libpod.conf anymore. This removes libpod.conf from the repo and
as many direct uses as I can find.

There are a few more mentions in the documentation, but someone
more familiar with containers.conf should make those edits.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-05-12 14:15:44 -04:00
Brent Baude a4c607cc71 set binding tests to required
some small fix ups for binding tests and then make them required.

update containers-common

V2 bindings tests were failing because of changes introduced in commit
a2ad5bb.

Fix some typos.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>

in the case where the specgen attribute for Env and Labels are nil, we should should then make the map IF we have labels and envs that need to be added.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-08 09:05:37 -05:00
Chris Evich 50cb32fdfb
CI:DOCS: Document API docs + CORS maintenance
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-05-06 15:52:53 -04:00
Chris Evich 6e60772dc3
Cirrus: Utilize new base images
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-04-30 13:21:03 -04:00
Chris Evich 7c44c05425
cirrus: Update to Fedora 32 proper
Now that it's officially released, update to it from the beta.  Also
(and significant), adjust the SELinux context of the GCP metadata
service.  Add a comment to the code explaining why this is necessary.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-04-30 13:21:03 -04:00
Chris Evich 97ecd21b59
Cirrus: Unify package installation
Also, test-build critical container images depended upon for
CI-purposes.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-04-24 08:22:50 -04:00
Chris Evich d2d9722454
Cirrus: Add support for Fedora 32
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-04-20 14:22:23 -04:00
Chris Evich e282c88d2c
Cirrus: More Ubuntu 19 + Fedora 31
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-04-20 14:22:23 -04:00
Ed Santiago 1be8a34f5e Log formatter: add BATS summary line
BATS emits a summary line (number of tests passed/failed)...
but only on a tty or when run with --pretty! In our CI
context, with TAP output, it gives no end summary.

Fix that. Keep track of 'ok', 'not ok', and 'skipped',
and display the counts at the end.

Also: add a regression test. You don't need to review
or even read it: it's stark, and I'm not even enabling
it for CI because it almost certainly won't run due to
missing Perl library modules. It's just something I
need on my end.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-04-17 08:12:09 -06:00
Ed Santiago 55eea9127a logformat: handle apiv2 results, add anchor links
apiv2 tests emit TAP-compliant output; recognize it and
highlight it the same way we do BATS tests.

Add anchor links to TAP output, so other tools (e.g.
cirrus-flake-summarize) can link to particular lines

And, remove a "-f" from "wait" in test-apiv2; looks
like there's some version of bash used in some CI VM
that doesn't grok it.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-04-08 12:10:24 -06:00
Chris Evich 19c3b5462f
Cirrus: Minor docs update
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-03-30 16:00:01 -04:00
OpenShift Merge Robot 17ad800905
Merge pull request #5368 from cevich/opensuse_ubuntu_packages
Opensuse openbuild ubuntu + buildah packages
2020-03-28 10:50:10 +01:00
OpenShift Merge Robot debd6face3
Merge pull request #4340 from cevich/libseccomp_update
Log libseccomp package version
2020-03-28 10:47:32 +01:00
OpenShift Merge Robot b743f60a4b
Merge pull request #5479 from cevich/auto_release
Cirrus: Disable non-docs release processing
2020-03-23 14:36:30 +01:00
Chris Evich 6ac04366ee
Cirrus: Enable future installing buildah packages
Many of the packages required for CI in buildah overlap with libpod.
When building new VM images, attempt to source a package list
from the buildah repository.  If found, also install the listed
packages on the VM.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-03-19 12:28:24 -04:00
Chris Evich e810dd135e
Cirrus: Include packages for buildah CI
Also, move some setup steps at VM image build time to save runtime.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-03-19 12:28:24 -04:00
Chris Evich 4c9b021533
Cirrus: Update Ubuntu base images
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-03-19 12:28:24 -04:00
Chris Evich 7cbdd48f78
Cirrus: Use opensuse open build Ubuntu packages
This is necessary as the projectatomic PPA is no longer maintained.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-03-19 12:28:24 -04:00
Brent Baude 14186ca28e fix timeout file flake
this is a temporary fix for the flake that has been troubling us.  once conmon is in fedora 30 and 31 stable, we can remove this fix.  the images will just need to be rebuilt.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-17 15:44:39 -05:00
Ed Santiago 3003384785 Four small CI fixes:
1) 'podman system info' (in logcollector): has been silently
     failing in special_testing_rootless, with:
       logcollector.sh: line 16: podman: command not found
     Use ./bin/podman instead of just podman; this is probably
     the right thing to do in the general case anyway

  2) logformatter: highlight 'panic:', seen in bindings test:
        https://storage.googleapis.com/cirrus-ci-5385732420009984-fcae48/artifacts/containers/libpod/6693715108429824/html/integration_test.log.html

  3) logformatter: handle Unicode bullet in front of 'Running',
     seen in bindings test.

  4) logformatter: turn down contrast on BATS 'ok' results,
     for legibility

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-16 11:37:27 -06:00
Chris Evich 9215eb0331
Cirrus: Disable non-docs release processing
Detecting when it's time to upload a release inside Cirrus-CI is really
difficult for many automation and human reasons.  Disabling it for now
until a more robust solution can be implemented

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-03-12 15:41:03 -04:00
Brent Baude 194759b96e turn off color-mode for bindings
the binding ginkgo tests were using color mode which throws in a bunch of ansi garbage that makes it hard to read the logs

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-12 13:45:56 -05:00
Daniel J Walsh ac354ac94a
Fix spelling mistakes in code found by codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-07 10:30:44 -05:00
Brent Baude 8b5e2a6297 add default network for apiv2 create
during container creation, if no network is provided, we need to add a default value so the container can be later started.

use apiv2 container creation for RunTopContainer instead of an exec to the system podman. RunTopContainer now also returns the container id and an error.

added a libpod commit endpoint.

also, changed the use of the connections and bindings slightly to make it more convenient to write tests.

Fixes: 5366
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-06 14:31:45 -06:00
OpenShift Merge Robot 60e9e7ca9c
Merge pull request #5039 from cevich/fix_gobin_exit_bug
Cirrus: Fix gate image & false-positive exits
2020-03-05 19:28:10 +01:00
Ed Santiago 1814638000 CI: format cirrus logs
This introduces a new cirrus helper script, logformatter.
Usage is:

    [commands...] | logformatter TEST-NAME

It reformats its input into a readable, highlighed, linkable
form. Some features:

   - boring stuff (timestamps, standard podman options) is
     deemphasized
   - important stuff (warnings, errors) is emphasized
   - in-page links to the actual failures
   - active links to source files
   - jumps to bottom of page on load, because that's where
     the errors are. (All errors are linked)

Add it to select test commands (integration, system) and
add a new artifacts_html, run in the 'always' block, which
uploads generated *.log.html into Cirrus; from there we
generate a live URL that can be viewed in browser.

Unfortunately, due to security concerns in Cirrus, it is
not currently possible to make the link a live one.

Kludge: add a line of dashes after Restoring images; without this,
the first test ("systemd PID 1") has no dashes before it, so
logformatter doesn't see it.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-02 15:55:05 -07:00
Ed Santiago 5612089412 CI: add API v2 tests
API v2 has been quiet for a few days, and the test script is
actually passing. Let's take advantage of this opportunity
to get them running in CI.

Requires adding a check for cgroupsv2

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-02 13:19:42 -07:00
Chris Evich d0782e7839
Cirrus: Fix gate image & false-positive exits
A number of scripts relating to tooling used and the gate container
image were not exiting upon errors as intended.  Coupled with
external service unavailability (i.e. downloading golangci-lint)
was observed to cause difficult to debug failures.

This change corrects the scripts inside/out of the gate container as
well as fixes many golang related path consistency problems vs other CI
jobs.  After this change, all jobs use consistent path names reducing
the number of special-case overrides needed.

Lastly, I also made a documentation-pass, updating/correcting as needed,
including documenting a likely local validation-failure mode, related to
`$EPOCH_TEST_COMMIT`.  This is dependent on the developers git
environment, so documentation is the only possible "fix".

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-03-02 08:50:54 -05:00
Chris Evich 0885f76742
Cirrus: Force runc use in F30
Suspect crun might be sneaking in during VM image build via podman RPM
dependency.  Add it to the removal list when building, then also force
use of runc at runtime in F30.

Also quote all true/false vars to force them as strings instead of
booleans (which will become capitalized)

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-28 10:37:31 -05:00
Chris Evich c96eb612e5
Cirrus: Remove unnecessary handle_crun workaround
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-28 09:54:36 -05:00