Commit graph

444 commits

Author SHA1 Message Date
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
Daniel J Walsh 9263ed2ab1
Remove use of ABISupport buildtag
We need to default to building podman. If you specify no build
tags you will not build podman, not podman-remote.

Just using remote flag to indicate podman-remote and !remote for
podman.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-03 15:11:34 -04:00
Lokesh Mandvekar 8a914e8a0b default build without varlink tag
Issue gh#6286 was already fixed in a prior commit but the Makefile still
ran some varlink steps by default.

This commit makes any varlink build steps dependent on the varlink
build tag and also makes the contrib rpm spec file independent of
varlink.

Endpoint tests will be run only if BUILDTAGS contains varlink.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-05-29 14:38:33 -04:00
Daniel J Walsh 911b6d8b48
Vendor in containers/common v0.12.0
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-28 16:58:53 -04:00
Daniel J Walsh f8632bad82
Fix builds on 32 bit arches
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-27 09:52:36 -04:00
Ed Santiago b81b865b52 podman-registry: many unrelated fixes
1) fix lost credentials.

    must_pass(), added in #6375, eats the credentials
    generated via 'podman run --entrypoint htpasswd'.
    Run that podman instance directly, and add explicit
    error check.

    (The error and stdout/stderr handling here has gotten
    cumbersome. There must be something I'm missing that
    could make it all simpler.)

 2) fix default podman path.

    When setting $PODMAN, default to the locally built
    one -- there may not be one in $PATH (e.g. in
    Ubuntu, see #6366). This in turn requires us to:

 3) run registry test in integration, not unit test

    It looks like unit tests run before podman is built,
    causing a chicken-egg dilemma. Try to solve that by
    running the new hack/podman-registry-go test in
    integration tests, not unit tests.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-05-26 08:21:46 -06:00
Lokesh Mandvekar 7d64258b94 Makefile: customizable $REMOTETAGS
This change will allow the builder to specify custom REMOTETAGS.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-05-24 06:20:17 -04:00
Brent Baude 8ec08a426e v2 enable remote integration tests
enable remote integration tests

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-19 14:26:19 -05:00
Daniel J Walsh 46b13d4d61
Fix REMOTETAGS
Handle REMOTETAGS the same way for all remote commands.

This fixes issues where remote commands are not building correctly on rhel7 and centos7 systems.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-14 09:53:40 -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
Sascha Grunert c21258b70e
Add podman static build
We’re now able to build a static podman binary based on a custom nix
derivation. This is integrated in cirrus as well, whereas a later target
would be to provide a self-contained static binary bundle which can be
installed on any Linux x64-bit system.

Fixes: https://github.com/containers/libpod/issues/1399

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-05-11 13:11:07 +02:00
OpenShift Merge Robot e12cc5a3b3
Merge pull request #6136 from liuming50/fix-a-makefile-dependency-issue
Makefile: fix a dependency issue
2020-05-08 17:36:23 +02:00
Ming Liu f339587185 Makefile: fix a dependency issue
Instead of being depended by docs, targets '.install.md2man' and
'docdir' should be depended by 'MANPAGES', or else the path
'docs/build/man' or 'GOMD2MAN' might not exist when it tries to
generate files in it.

This fixes a following build error:
| open docs/build/man/podman-volume-ls.1: no such file or directory
| Makefile:377: recipe for target 'docs/source/markdown/podman-volume-ls.1' failed
| make: *** [docs/source/markdown/podman-volume-ls.1] Error 1
| make: *** Waiting for unfinished jobs....
| open docs/build/man/podman-init.1: no such file or directory
| Makefile:377: recipe for target 'docs/source/markdown/podman-init.1' failed

Signed-off-by: Ming Liu <ming.liu@toradex.com>
2020-05-08 14:57:58 +02:00
Daniel J Walsh b27aa5f81b
Add podman-remote-static target
We should not be building podman-remote with the BUILDTAGS, these
only effect server side.

CRC Group wants to use a static version of podman-remote in order
to install the same podman-remote client on any Linux box.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-05-07 16:47:56 -04:00
Lokesh Mandvekar c10bd7c11f Makefile: include -nobuild install targets
Distro packaging often uses non-default build and linker flags.
The current Makefile cannot be used in the package build process as it
will end up rebuilding the binaries with the default flags.

This commit introduces install targets which do not depend on the build
targets. Distro packages should prefer these if they want to use any
non-default flags.

NOTE: This commit effectively leaves prior targets unchanged, so users
won't notice any difference.

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
2020-04-23 13:08:25 -04:00
Ed Santiago 0e45637a97 Makefile: fix broken chcon for podman-remote
The install.remote target looks like it was copy-pasted
from install.bin and missed a spot.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-04-21 07:52:43 -06:00
Anatoli Babenia a58c59f401 Make find ignore dot files
There is no need to search for sources in hidden dirs. In my case
there are files from development environment that stand in the way.

Signed-off-by: Anatoli Babenia <anatoli@rainforce.org>
2020-04-20 07:26:55 +03:00
Brent Baude 241326a9a8 Podman V2 birth
remote podman v1 and replace with podman v2.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-16 15:53:58 -05:00
Ed Santiago ba26c763c5 swagger-check: new CI tool to cross-check swagger
New script cross-references r.Handle() and r.HandleFunc()
calls against the preceding '// swagger:operation' comments,
and exits failure (with descriptive error messages) if any
comments do not match the code.

This script should not be necessary: the swagger comments
should be autogenerated from the source code.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-04-14 11:27:44 -06:00
OpenShift Merge Robot 555b30e9eb
Merge pull request #5634 from jwhonce/wip/service
V2 podman system service
2020-04-09 14:55:45 +02:00
Miloslav Trmač 439485f096 Fix (make vendor)
(export a=b command args) does not run (command args) with a=b,
it sets $a to b, and marks variables $a $command $args as exported,
i.e. (command args) is not run.

So we were not actually running (go mod tidy).

Fix that.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2020-04-08 20:42:02 +02:00
Jhon Honce e0847f5457 V2 podman system service
* Added support for system service
* Enabled linting on the varlinkapi source, needed to support V2
  service command
* Added support for PODMAN_SOCKET

Skip linting deprecated code

Rather than introduce bugs by correcting deprecated code, linting the
code is being skipped. Code that is being ported into V2 is being
checked.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-04-07 19:22:10 -07:00
Jhon Honce 7a12e01556 V2 Move varlink home
* move cmd/podman/varlink/* to pkg/varlink to support podmanV2 refactor
* update Makefile
* reformatted all impacted code

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-03-30 08:18:35 -07:00
Daniel J Walsh 8ab686f0e0
Add APIV2 service files
Also fix issue in pods_test.go

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-20 09:09:42 -04:00
OpenShift Merge Robot 49a7856f2e
Merge pull request #5465 from edsantiago/man_page_option_checker
New test: man page cross-ref against --help
2020-03-19 16:53:02 +01:00
Daniel J Walsh fea5f913e3
Don't include SUBDIR in windows.zip
The zip file should returne podman.exe plus the documentation
directory.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-19 08:57:54 -04:00
Ed Santiago 81005f463e New test: man page cross-ref against --help
New hack/xref-helpmsgs-manpages script, added to CI 'gate'
task, runs 'podman [subcommand] --help' and cross-references
against man pages in docs/source/markdown/podman*.1.md

See #5453 and #5460 for instances of the problems the
script has found.

The careful reader will find an alarming number of special-case
bypasses. These are a tradeoff I am making: to get perfect
coverage with no handwaving, it would be necessary to make
drastic changes to some man pages, and I believe those would
be counterproductive.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-03-18 11:03:26 -06:00
Brent Baude 2c85674773 build for amd64|arm|ppc64le
to protect against architecture specific build regressions, we cross compile for multiple architectures

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-10 13:57:53 -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
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
Daniel J Walsh 00e9db0822
Add installation of pre-commit to Makefile
pre-commit is required for running certain tests by the Makefile.
Adding pre-commit to install.tools allows users to easily use
and test podman.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-02-18 16:59:31 -05:00
Valentin Rothberg 51e0a8b1c3 Make: s/uname -o/uname -s/
uname -o doesn't seem to work on Mac OS.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-11 12:53:42 +01:00
Max Goltzsche c588ae1428
Fix varlink code generation target.
Closes #5130.

varlink code generation was skipped when `uname -o` did not print "GNU/Linux".
However on some Linux systems (e.g. alpine) only "Linux" is printed
which results in cmd/podman/varlink/iopodman.go not being generated.
Thus the Makefile target condition has been changed to match "Linux".

Signed-off-by: Max Goltzsche <max.goltzsche@gmail.com>
2020-02-09 21:25:59 +01:00
Brent Baude 0577493688 {CI:DOCS] run gofmt before lint
the linting task identifies gofmt issues; therefore it makes more sense to run our make gofmt first, which actually fixes the gofmt issues.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-04 13:15:22 -06:00
Chris Evich dbb9d098b5
Cirrus: Fix gate task + make lint|validate
A recent Makefile change (4ec893a748) removed a side-effect necessary
for 'make validation' to pass under automation.  Making things worse,
change 12bd7e927c was found upon investigation to always point at
the latest upstream HEAD.  However, this is rarely a fork-point for
pull-requests.  Further investigation showed the built-in Cirrus-CI,
golang-based git does not obtain sufficient data for the Makefile
command `git merge-base HEAD $${DEST_BRANCH:-master}` to function
properly (in the context of the gate container).

Fix this by customizing the clone operation and slightly adjust the
Makefile command to function as intended in the gate container.  Also
add checks to the validate and lint targets which validate the
variable EPOCH_TEST_COMMIT value is never an empty string or whitespace.

Signed-off-by: Chris Evich <cevich@redhat.com>
2020-02-03 16:23:46 -05:00
Sorin Sbarnea 5190407619 Assure validate includes lint
Fixed issue where lint was not run on CI, so we missed to prevent regressions.

Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2020-01-30 18:39:56 +00:00
Valentin Rothberg 4ec893a748 speed up Makefile
Speed up the Makefile by removing variable references from the release
targets.  Now, the variables will only be (lazily) evaluated when they
are actually needed and not for each invocation of the Makefile which
has it down considerably.

Fixes: #4829
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-30 08:44:34 +01:00
Valentin Rothberg 7b14c02d0d Makefile: systemd: echo instead of warn
Just echo the message instead of warning to not impact the exit code.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-30 08:44:34 +01:00
Valentin Rothberg 79ceb31edf Makefile: remove redundant BUILDFLAGS
We don't set it, so there's no need to keep it.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-30 08:44:34 +01:00
Valentin Rothberg 9fa8b723c8 Makefile: consistent PHONY use
Add a .PHONY line over each target instead of mixing this notation with
a separate but incomplete single list.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-30 08:44:26 +01:00
Valentin Rothberg 0428eb6111 Makefile: remove dead vagrant target
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-30 08:44:10 +01:00
Valentin Rothberg 5aadd45f7c Makefile: move systemd buildtag check
Move the systemd-buildtag check into the `bin/podman` target.
No need to execute the check for all invocations of the
Makefile.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-30 08:44:10 +01:00
OpenShift Merge Robot 8241c1ae94
Merge pull request #5011 from vrothberg/fix-4814
run `varlink_generate` on Linux only
2020-01-29 05:49:47 -08:00
Valentin Rothberg 633610769e run varlink_generate on Linux only
Running the `varlink_generate` make target on non-Linux machines is not
supported, so restrict it to Linux only.

Fixes: #4814
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-29 12:17:42 +01:00
Brent Baude 54587335be [CI:DOCS]Binding overhauls
Add binding for networks and begin documentation for binding methods for godoc.  Also, add major functions to their own subpackages so reduce the amount of of method confusion.  So instead of: bindings.ListImages(), we now do a [bindings].images.List().

Also, the connection is passed to each binding method via a context to allow for future growth.

Lastly, add first set of tests.  There are a couple of things to work out for rootless tests yet.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-01-28 08:42:18 -06:00
Daniel J Walsh 4ab6a10d0c
Add link from docker.sock to podman.sock
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-27 09:52:25 -05:00
baude d4c2aaf38a Add service endpoint
add service endpoint for the new API.  Also supports the varlink
implementation.

Signed-off-by: baude <bbaude@redhat.com>

Refactor to allow developer more control of API server

* Add api.NewServerWithSettings() to create an API server with custom
  settings
* Add api.ListenUnix() to create a UDS net.Listener and setup UDS

Signed-off-by: Jhon Honce <jhonce@redhat.com>
Signed-off-by: baude <bbaude@redhat.com>

More service completion

Add podman service command that allows users to run either a RESTful or
varlink protocol API service.

Addition of docs and RESTful listening.

Signed-off-by: baude <bbaude@redhat.com>
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-01-21 16:35:45 -06:00
baude 9be6f30a42
post-process swagger yaml for publish
Signed-off-by: baude <bbaude@redhat.com>
Signed-off-by: Chris Evich <cevich@redhat.com>
2020-01-17 15:41:33 -05:00
Valentin Rothberg c3d90179dc make binaries: include service
Include the service into make binaries such that we're it's being build
in the CI.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-16 14:05:39 +01:00
OpenShift Merge Robot e1e405b70d
Merge pull request #4807 from ssbarnea/fix/pre-commit
Enable pre-commit linting
2020-01-15 23:51:22 +01:00
Valentin Rothberg b830d3eb07 make .install.golangci-lint: force specific version
Instead of only performing a presence check of the binary, also do a
version check and force installing the specified one if needed.  This
will prevent users and the CI from using a wrong version in the future.

Move the logic into a dedicated shell script as I find built-in bash in
Makefiles hard to maintain.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-15 08:55:46 +01:00
Valentin Rothberg b6155c1657 Makefile: remove gometalinter
Remove all references on gometalinter including the target to install
it.  We are not using it anymore since we have fully migrated to
golangci-lint.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-15 08:29:33 +01:00
Sorin Sbarnea e9cd3319cf Enable pre-commit tool linting
This should help use keep the codebase more consistent, and avoid sevel
whitespace related issues, or bad file permissions.

pre-commit allows us to easily introduce other linters in follow-ups,
like bashate.

Note: pre-commit tool does *not* install any git-hooks. Making commits
will will call the tool unless you deliverately tell it to install the
hooks.

Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
2020-01-14 13:42:59 +00:00
Valentin Rothberg cf1f3191d2 make lint: include unit tests
Include the unit tests (i.e., _test.go files) for linting to make the
tests more robust and enforce the linters' coding styles etc.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-14 10:51:59 +01:00
Valentin Rothberg a102869746 .golangci.yml: move swagger.go from Makefile
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-14 09:54:48 +01:00
OpenShift Merge Robot 796ae87b1a
Merge pull request #4850 from vrothberg/fix-linting
Fix linting
2020-01-13 21:03:21 +01:00
OpenShift Merge Robot e83a1b87da
Merge pull request #4817 from rhatdan/codespell
Add codespell to validate spelling mistakes in code.
2020-01-13 17:59:58 +01:00
Valentin Rothberg eeb61427bb bump golangci-lint to 1.18.0
The latest versions have regressions in --skip-dirs where some linters
will still run and error out.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-13 14:27:02 +01:00
Valentin Rothberg 6041f707ca rm contrib/perftest
Perftest was intended to be used for testing CPU intensive tasks of
Podman.  However, it does not compile for a long while and is not
integrated in the CI which clearly indicates that it has not been
used for a considerable amount of time.

Remove contrib/perftest entirely.  If the desire arises to revive it,
all code is still reachable in the git history.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-13 14:26:57 +01:00
Valentin Rothberg 17988f239e remove .tool/lint
We should only use `make golangci-lint` which is also used in `make
validate`.  However, we need to enable more linters which we can
do step by step in future commits.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-13 11:20:44 +01:00
Morten Linderud 627d71312f
[Makefile] Ensure .gopathok dependency is met for varlink
When executing make in parallel, e.g `make -j8`, there is a chance steps are
executed at the same time. There is a chance .gopathok and the actual varlink
generation happening at the same time, causing a race and ultimately failing the
build.

Ensuring the .gopathok dependency is met at the actual step fixes the problem.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2020-01-11 13:50:45 +01:00
Daniel J Walsh 4093b2c011
Add codespell to validate spelling mistakes in code.
Fix all errors found by codespell

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-11 06:32:19 -05:00
baude 25b34972f4 [CI:DOCS]update apiv2 documentation with swagger goods
Signed-off-by: baude <bbaude@redhat.com>
2020-01-10 09:41:54 -06:00
Jhon Honce d924494f56 Initial commit on compatible API
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Create service command

Use cd cmd/service && go build .

$ systemd-socket-activate -l 8081 cmd/service/service &
$ curl http://localhost:8081/v1.24/images/json

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Correct Makefile

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Two more stragglers

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Report errors back as http headers

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Split out handlers, updated output

Output aligned to docker structures

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Refactored routing, added more endpoints and types

* Encapsulated all the routing information in the handler_* files.
* Added more serviceapi/types, including podman additions. See Info

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Cleaned up code, implemented info content

* Move Content-Type check into serviceHandler
* Custom 404 handler showing the url, mostly for debugging
* Refactored images: better method names and explicit http codes
* Added content to /info
* Added podman fields to Info struct
* Added Container struct

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Add a bunch of endpoints

containers: stop, pause, unpause, wait, rm
images: tag, rmi, create (pull only)

Signed-off-by: baude <bbaude@redhat.com>

Add even more handlers

* Add serviceapi/Error() to improve error handling
* Better support for API return payloads
* Renamed unimplemented to unsupported these are generic endpoints
  we don't intend to ever support.  Swarm broken out since it uses
  different HTTP codes to signal that the node is not in a swarm.
* Added more types
* API Version broken out so it can be validated in the future

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Refactor to introduce ServiceWriter

Signed-off-by: Jhon Honce <jhonce@redhat.com>

populate pods endpoints

/libpod/pods/..

exists, kill, pause, prune, restart, remove, start, stop, unpause

Signed-off-by: baude <bbaude@redhat.com>

Add components to Version, fix Error body

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Add images pull output, fix swarm routes

* docker-py tests/integration/api_client_test.py pass 100%
* docker-py tests/integration/api_image_test.py pass 4/16
+ Test failures include services podman does not support

Signed-off-by: Jhon Honce <jhonce@redhat.com>

pods endpoint submission 2

add create and others; only top and stats is left.

Signed-off-by: baude <bbaude@redhat.com>

Update pull image to work from empty registry

Signed-off-by: Jhon Honce <jhonce@redhat.com>

pod create and container create

first pass at pod and container create.  the container create does not
quite work yet but it is very close.  pod create needs a partial
rewrite.  also broken off the DELETE (rm/rmi) to specific handler funcs.

Signed-off-by: baude <bbaude@redhat.com>

Add docker-py demos, GET .../containers/json

* Update serviceapi/types to reflect libpod not podman
* Refactored removeImage() to provide non-streaming return

Signed-off-by: Jhon Honce <jhonce@redhat.com>

create container part2

finished minimal config needed for create container.  started demo.py
for upcoming talk

Signed-off-by: baude <bbaude@redhat.com>

Stop server after honoring request

* Remove casting for method calls
* Improve WriteResponse()
* Update Container API type to match docker API

Signed-off-by: Jhon Honce <jhonce@redhat.com>

fix namespace assumptions

cleaned up namespace issues with libpod.

Signed-off-by: baude <bbaude@redhat.com>

wip

Signed-off-by: baude <bbaude@redhat.com>

Add sliding window when shutting down server

* Added a Timeout rather than closing down service on each call
* Added gorilla/schema dependency for Decode'ing query parameters
* Improved error handling
* Container logs returned and multiplexed for stdout and stderr
  * .../containers/{name}/logs?stdout=True&stderr=True
* Container stats
  * .../containers/{name}/stats

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Improve error handling

* Add check for at least one std stream required for /containers/{id}/logs
* Add check for state in /containers/{id}/top
* Fill in more fields for /info
* Fixed error checking in service start code

Signed-off-by: Jhon Honce <jhonce@redhat.com>

get rest  of image tests for pass

Signed-off-by: baude <bbaude@redhat.com>

linting our content

Signed-off-by: baude <bbaude@redhat.com>

more linting

Signed-off-by: baude <bbaude@redhat.com>

more linting

Signed-off-by: baude <bbaude@redhat.com>

pruning

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]apiv2 pods

migrate from using args in the url to using a json struct in body for
pod create.

Signed-off-by: baude <bbaude@redhat.com>

fix handler_images prune

prune's api changed slightly to deal with filters.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]enabled base container create tests

enabling the base container create tests which allow us to get more into
the stop, kill, etc tests. many new tests now pass.

Signed-off-by: baude <bbaude@redhat.com>

serviceapi errors: append error message to API message

I dearly hope this is not breaking any other tests but debugging
"Internal Server Error" is not helpful to any user.  In case, it
breaks tests, we can rever the commit - that's why it's a small one.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

serviceAPI: add containers/prune endpoint

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

add `service` make target

Also remove the non-functional sub-Makefile.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

add make targets for testing the service

 * `sudo make run-service` for running the service.

 * `DOCKERPY_TEST="tests/integration/api_container_test.py::ListContainersTest" \
 	make run-docker-py-tests`
   for running a specific tests.  Run all tests by leaving the env
   variable empty.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

Split handlers and server packages

The files were split to help contain bloat. The api/server package will
contain all code related to the functioning of the server while
api/handlers will have all the code related to implementing the end
points.

api/server/register_* will contain the methods for registering
endpoints.  Additionally, they will have the comments for generating the
swagger spec file.

See api/handlers/version.go for a small example handler,
api/handlers/containers.go contains much more complex handlers.

Signed-off-by: Jhon Honce <jhonce@redhat.com>

[CI:DOCS]enabled more tests

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]libpod endpoints

small refactor for libpod inclusion and began adding endpoints.

Signed-off-by: baude <bbaude@redhat.com>

Implement /build and /events

* Include crypto libraries for future ssh work

Signed-off-by: Jhon Honce <jhonce@redhat.com>

[CI:DOCS]more image implementations

convert from using for to query structs among other changes including
new endpoints.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]add bindings for golang

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]add volume endpoints for libpod

create, inspect, ls, prune, and rm

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]apiv2 healthcheck enablement

wire up container healthchecks for the api.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]Add mount endpoints

via the api, allow ability to mount a container and list container
mounts.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]Add search endpoint

add search endpoint with golang bindings

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]more apiv2 development

misc population of methods, etc

Signed-off-by: baude <bbaude@redhat.com>

rebase cleanup and epoch reset

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]add more network endpoints

also, add some initial error handling and convenience functions for
standard endpoints.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]use helper funcs for bindings

use the methods developed to make writing bindings less duplicative and
easier to use.

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]add return info for prereview

begin to add return info and status codes for errors so that we can
review the apiv2

Signed-off-by: baude <bbaude@redhat.com>

[CI:DOCS]first pass at adding swagger docs for api

Signed-off-by: baude <bbaude@redhat.com>
2020-01-10 09:41:39 -06:00