Commit graph

407 commits

Author SHA1 Message Date
Valentin Rothberg a3621a7cff Cirrus: add bindings checks
Make sure that bindings are in sync with the code.  The check is similar
to what's already being done with `make vendor`, so integrate the two.

[NO TESTS NEEDED]

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-20 14:38:02 +01:00
Valentin Rothberg 41a7e11c7e make bindings generation explicit
Instead of implicitly generating the bindings, make it explicit, similar
to `make vendor`.  This should prevent redundant and possibly error
prone generations.  A following commit will shield CI.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-20 13:19:06 +01:00
Valentin Rothberg f302ce578b make bindings generation more robuts
The Go gods did not shine upon us trying to understand what's going on
in #9000.  The symptom is that `go generate` did not add required
imports to a generated file, ultimately breaking subsequent compilation.

While it still remains unclear *why* Go is behaving like that, the
symptom disappears when `go generate` runs in module mode; that is
without `-mod=vendor` and without `GO111MODULE=off`.  This was
reproducible on two separate machines (Ubuntu and Fedora).

Also, when facing an unset GOPATH, set it to Go's default (i.e.,
$HOME/go) and make sure that GOBIN is in PATH since `goimports`
is required by `go generate`.

Fixes: #9000
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-20 13:19:06 +01:00
OpenShift Merge Robot 7d024a2fc8
Merge pull request #9031 from vrothberg/revert-ginkgo
Revert "ginkgo: install on demand via `go get -u`"
2021-01-20 07:17:23 -05:00
OpenShift Merge Robot 54c465bda6
Merge pull request #8911 from edsantiago/prs_must_include_tests
CI: smoke test: insist on adding tests on PRs
2021-01-20 05:57:09 -05:00
Valentin Rothberg 175fc3867a Revert "ginkgo: install on demand via go get -u"
This reverts commit de05e58168.

Running `go get -u` will change the local Go module causing CI to fail
as the local git tree is being changed.  Reverting the change for now
until we have a better idea.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-20 10:31:24 +01:00
Ed Santiago 37abec240a [CI:DOCS] fix go-md2man HTMLSpan warnings
I'm tired of seeing these every time I run 'make':

   WARNING: go-md2man does not handle node type HTMLSpan

Cause: left-angle-brackets ( < ) in document source

Solution:
  1) backquote-escape those that need to be shown, usually
     ones referring to an argument or email address; or
  2) Actual HTML ( <sup> and <a> ) which are meant to be
     shown in generated HTML docs but can't be shown in
     man pages, we filter out via a sed expression.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-01-19 12:59:03 -07:00
Ed Santiago 9f6bb3563d CI: smoke test: insist on adding tests on PRs
On each PR (with a few exceptions), check the list of git-touched
files, and abort if no tests are added. Include instructions
on how to bypass the check if tests really aren't needed.

Include a hardcoded exception list for PRs that only touch a
well-known subset of "safe" files: docs, .cirrus.yml, vendor,
version, hack, contrib, or *.md. This list is likely to need
tuning over time.

Add a test suite, but not one recognized by the new script
(because it's a "*.t" file), so: [NO TESTS NEEDED]

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-01-19 10:45:58 -07:00
Valentin Rothberg de05e58168 ginkgo: install on demand via go get -u
Install ginkgo on demand via `go get -u` rather than keeping a copy it's
entire source code in the vendor dirctory.  The main motivation for that
is to make `golangci-lint` happy which is continuously throwing up on
the import of a program (i.e., ginkgo).  The linter is broken and stupid
as it ignores flags to ignore dirs and ignores build tags (at least some
linters do) which is blocking us from updating to newer versions.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-19 10:00:53 +01:00
Valentin Rothberg 2df59829e4 simplify bindings generation
Run `go generate ./pkg/bindings/...` once for all bindings instead of
generating them separately.  This should speed up bindings generation
as a given package is visited only once, and it fixes #8989 by dropping
the use of pushd and popd.

Fixes: #8989
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-17 17:24:03 +01:00
Valentin Rothberg 4629942686 make: generate bindings: use vendor
Set `-mod=vendor` when generating the bindings.  We expect all
dependencies to be vendored already.  This should slightly speed
up the bindings generation and prevent redundant network accesses.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-01-17 17:24:01 +01:00
Matthew Heon f781efd2dc Add tests for volume plugins
This involves a new test binary (a basic implementation of the
volume plugin protocol) and a new image on quay.io (Containerfile
to produce it and all sources located in this commit). The image
is used to run a containerized plugin we can test against.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-01-14 16:43:23 -05:00
Valentin Rothberg d498ef53aa
Makefile: add target to generate bindings
Add a `.generate-bindings` make target that only runs in the absence of
the `.generate-bindings` file or when a `types.go` file below
`pkg/bindings` has changed.

This will regenerate the go bindings and make sure the code is up2date.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-14 11:54:57 -05:00
Chris Evich 1d8b9e944f
Cirrus: Add cross-compile test for alternative arches
Followup to https://github.com/containers/podman/pull/8907 that simply
ensures cross-compiling podman completes.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-01-11 13:46:37 -05:00
Paul Holzinger 65c88ec473 Add mips architecture to the cross build target
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-07 15:04:40 +01:00
Josh Soref 4fa1fce930 Spelling
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-12-22 13:34:31 -05:00
Wong Hoi Sing Edison 0599b21857
Update nix pin with make nixpkgs
This PR introduce 3 changes:

  - Upgrade Nix stable channel from 20.03 to 20.09.

    NixOS 20.09 released at 2020-10-27, see
    <https://nixos.org/manual/nixos/stable/release-notes.html#sec-release-20.09>
    for more information.

  - Replace `git` with `gitMinimal`.

    All 6 projects (i.e. crun/conmon/skopeo/buildah/podman/cri-o) are
    having `git` as dependency for failsafe during bootstrap. BTW
    <https://github.com/NixOS/nixpkgs/pull/104896> replace `asciidoc`
    with `asciidoctor` so trigger the dependency chain to `glib` and so
    failed (see below). Switching to `gitMinimal` skip this dependency
    chain to `glib`, which also speed up overall build process.

  - Adding `-pthread` for `glib`

    `conmon` couldn't skip the error by replacing `git` with
    `gitMinimal` since it do depend on `glib`. Since `glib` trigger
    error message "undefined reference to 'pthread\_create'", therefore
    adding `pthread` to `CFLAGS` could solve the problem.

Also see:

  - <https://github.com/containers/crun/pull/550>
  - <https://github.com/containers/conmon/pull/218>
  - <https://github.com/containers/skopeo/pull/1120>
  - <https://github.com/containers/buildah/pull/2831>
  - <https://github.com/containers/podman/pull/8526>
  - <https://github.com/cri-o/cri-o/pull/4395>

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
2020-12-20 18:41:22 +08:00
OpenShift Merge Robot 4b5cb7b1de
Merge pull request #8534 from Luap99/revert-Luap99-cobra-vendor
Revert the custom cobra vendor
2020-12-01 21:39:50 +01:00
Paul Holzinger 3d4a0e42b3 Revert the custom cobra vendor
Vendor in the latest cobra release v1.1.1

This will hurt the completion experience but is required for
proper packaging, see: #8528.

The best solution is to keep the current scripts since they
work fine with cobra v1.1.1.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-01 14:15:18 +01:00
Daniel J Walsh f62a356515
Remove varlink support from Podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-26 16:50:42 -05:00
OpenShift Merge Robot 2993e97dec
Merge pull request #6442 from Luap99/podman-autocomplete
Shell completion
2020-11-13 16:46:51 +01:00
Daniel J Walsh a7431003b8
Fix issues found with codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-12 13:37:38 -05:00
Paul Holzinger ae3816614d Install the new shell completion logic
Add a new make target (completion) to generate the shell
completion scripts. This will generate the scripts for bash,
zsh and fish for both podman and podman-remote with `podman completion`.
The scripts are put into the completions directory and can be
installed system wide with `sudo make install.completions`.

This commit replaces the current handwritten scripts for bash and zsh.

The `validate.completion` target has been adjusted to make sure nobody
edits these scripts directly.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-12 11:40:29 +01:00
Ed Santiago b0601cb34a [CI:DOCS] Restore man page cross-checker
Somewhere in the CIv2 migration we lost the man page vs --help
cross-checker. Add it back, by adding it into the man-page-check
Makefile target; this is part of 'make validate', which is run
in CI even on CI:DOCS PRs.

As happens when CI doesn't run, things broke. Man pages got out
of sync with --help. This PR:

 1) Fixes hack/xref-helpmsgs-manpages to deal with the new
    "Options" (instead of "Flags") form of podman help. #8034
    did part of that, but one of my review comments was
    accidentally left out.

 2) Fixes hack/xref-helpmsgs-manpages to deal with the new
    option syntax in man pages, post- #8292, in which each
    option is preceded by four hashes so as to make them
    HTML <h4> elements with named anchors.

 3) Fixes man pages that #8292 accidentally missed.

 4) Adds man page entries for two flags that got added
    to podman but not documented (pod create --network-alias,
    play kube --log-driver)

Fixes: #8296

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-11-11 08:31:30 -07:00
Jhon Honce 2d50ec6996 Update CI tests to run python docker library against API
* Update reference to docker-py to docker to reflect change in library
  name
* Update tests to create storage sandbox
* Enable all tests that endpoints support
* Refactor containers/{id}/rename to return 404 not 500
* Refactor tests to use quay.io vs. docker.io

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-11-09 10:45:54 -07:00
Daniel J Walsh 3daef2e826
Use /tmp/podman-run-* for backup XDG_RUNTIME_DIR
We need to block systemd from cleaning up this directory
by dropping a /usr/lib/tmpfiles.d/podman.conf file in place.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-04 15:32:00 -05:00
Jhon Honce df8bda8cc0 Add test/apiv2/rest_api tests to make target
* renamed old API tests to not be discovered, they do not pass
* Updated the API tests to use a pristine storage configuration
* Skipped attach test, it needs to be re-written

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-11-02 08:36:22 -07:00
Chris Evich 2c9084e224
Cirrus: Implement podman automation 2.0
Reimplement CI-automation to remove accumulated technical-debt and
optimize workflow.  The task-dependency graph designed goal was to
shorten it's depth and increase width (i.e. more parallelism).  A
reduction in redundant building (and 3rd party module download) was
also realized by caching `$GOPATH` and `$GOCACHE` early on.  This
cache is then reused in favor of a fresh clone of the repository
(when possible).

Note: The system tests typically execute MUCH faster than the
integration tests.  However, contrary to a fail-fast/fail-early
principal, they are executed last.  This was implemented due to
debug-ability related concerns/preferences of the primary
(golang-centric) project developers.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-10-02 11:53:04 -04:00
Jordan Christiansen 6dccaa4f26 Don't disable Go modules when generating varlink
From a fresh install of Fedora 33 Beta and a fresh clone of the repo, `make` fails with the following error when Go modules are disabled:

    # Only generate the varlink code on Linux (see issue #4814).
    GO111MODULE=off go generate ./pkg/varlink/...
    ../../vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go:12:2: cannot find package "github.com/varlink/go/varlink/idl" in any of:
    	/usr/lib/golang/src/github.com/varlink/go/varlink/idl (from $GOROOT)
    	/home/test/src/podman/_output/src/github.com/varlink/go/varlink/idl (from $GOPATH)
    pkg/varlink/generate.go:3: running "go": exit status 1
    make: *** [Makefile:646: pkg/varlink/iopodman.go] Error 1

Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
2020-09-30 12:24:45 -05:00
Daniel J Walsh 63ba4ff871
Print nice error message when python is not installed
If user runs `make help` on a system without python, we should print a
decent message.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-21 16:32:02 -04:00
Chris Evich 3b3770588b
Makefile: Fix broken libpodimage targets
The configuration for this container has moved to the
`containers/automation_images` repository.  Leverage the
image built from the new location to guarantee synchronization
with images used in CI.

Also, remove several other targets that haven't worked for a really
long time.  Upon discussion, they seem to apply to a minority of
users.  Remove them to clean up the `Makefile` and reduce
maintenance burden.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-09-18 11:09:01 -04:00
Jordan Christiansen 36318e5cab Make Go builds more consistent
* Use the BUILDFLAGS variable for all Go builds
* Use `go install` instead of manually specifying the GOBIN path

Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
2020-09-17 11:22:12 -05:00
Lokesh Mandvekar 3bf7b9400c Makefile: add cross compile targets for more arches
This commit adds additional targets for which we provide binary packages
on fedora and other distros.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-09-08 08:53:41 -04:00
Paul Holzinger d9f0c48176 fix podman version output to include git commit and builttime
Add the go module version v2 to the libpod path.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-08-18 20:37:18 +02:00
Lokesh Mandvekar 45220340bb Makefile: use full path for ginkgo
Without this change, I get:

```
ginkgo \
        -r \
         \
        --skipPackage test/e2e,pkg/apparmor,test/endpoint,pkg/bindings,hack \
        --cover \
        --covermode atomic \
        --coverprofile coverprofile \
        --outputdir .coverage \
        --tags "   selinux systemd exclude_graphdriver_devicemapper seccomp" \
        --succinct
/bin/sh: line 1: ginkgo: command not found
```

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-08-11 14:50:06 -04:00
Ed Santiago a4fcf09b7a Reenable remote system tests
podman-remote is in better shape now. Let's see what needs
to be done to reenable remote system tests.

 - logs test: skip multilog, it doesn't work remote

 - diff test: use -l only when local, not with remote

 - many other tests: skip_if_remote, with 'FIXME: pending #xxxx'
   where xxxx is a filed issue.

Unrelated: added new helper to skip_if_remote and _if_rootless,
where we check if the source message includes "remote"/"rootless"
and insert it if missing. This is a minor usability enhancement
to make it easier to understand at-a-glance why a skip triggers.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-08-03 09:36:36 -06:00
Valentin Rothberg efcc2f5b18 Install auto-update services for users
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-08-03 13:12:07 +02:00
Peter Oliver f3e01de3a3 Install auto-update systemd service and timer.
Signed-off-by: Peter Oliver <git@mavit.org.uk>
2020-08-03 13:12:06 +02:00
Daniel J Walsh a5e37ad280
Switch all references to github.com/containers/libpod -> podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-28 08:23:45 -04:00
Valentin Rothberg a05c15da2f make localunit: record coverage
Inspirsed by CRI-O's coverage logic.  Initial coverage is at 15.7
percent.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-21 15:46:43 +02:00
Valentin Rothberg d628de31d7 unit tests: root check
The unit tests currently require running as root.  This has caused some
confusion that justifies adding a root check to `make localunit` and
error out for non-root users instead of starting the tests deemed to
fail.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-21 13:31:43 +02:00
Daniel J Walsh 841eac0af6
Switch references from libpod.conf to containers.conf
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-20 15:09:54 -04:00
Wong Hoi Sing Edison f53812a11e
Cleanup nix derivation for static builds
Signed-off-by: Wong Hoi Sing Edison <hswong3i@gmail.com>
2020-07-18 09:03:28 +08:00
Matthew Heon 237fe441b3 Remove outdated seccomp policy
Some time ago, we moved the Seccomp policy (and related setup
code) to a place where all our tools could share it [1]. We did
not, however, remove the in-repo seccomp.json file. Over the last
year or so, the in-repo seccomp policy has become progressively
more and more outdated, with no effort made to maintain it
(because what sense is there in keeping a duplicate?). Today, a
friend came to me and asked if a Podman container could access
keyctl, assuming it could not because he was reading the outdated
Seccomp policy which does not allow it. Since it's becoming clear
that this file is doing no good and actively causing confusion,
let's just drop it.

[1] https://github.com/seccomp/containers-golang

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-07-13 16:35:04 -04:00
Daniel J Walsh a10da9a999
Add containers.conf default file for windows and MAC Installs
We want to add this configuration file so that users can descover
how to configure the permanent connection to a remote podman instance.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-24 12:58:44 -04: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
Lokesh Mandvekar 78bd0e0a63 Makefile: allow customizable GO_BUILD
This will let me use a customizable GO_BUILD so that I can run build
targets for deb packages

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-06-22 09:59:30 -04:00
Lokesh Mandvekar 30c0fc9f12 Makefile: install.varlink needs to create dirs
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-06-17 15:58:11 -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
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