241 Commits

Author SHA1 Message Date
e3240c2fb4 hack: fix typo in hack/podman-registry
hack/podman-registry --help option does not exist.
We need to use -h option when we want to see the usage message.

[NO NEW TESTS NEEDED]

Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
2023-05-30 11:47:10 +09:00
dfba6ddd4c Man pages: fix broken tables
Work around a go-md2man bug, and add a check script to make sure
this doesn't hit us again.

Background: go-md2man can't deal with a left-hand column > 31 chars.
It produces man pages that look like:

    | Something With >31 Character |                |
    |                              | ..description  |

(should be all on one row). It also has trouble when the vertical
bars are misaligned: it completely removes the right-hand side.

There's almost certainly a better solution: fix go-md2man, or
use a different conversion tool, or maybe even pre/postprocess.
But this is a quick interim solution.

Sorry for the perl. This could be done in bash/sed/awk/grep,
but not with any sort of sane error messages.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-05-26 06:08:14 -06:00
9ec630f305 Buildah treadmill: several fixes
- treadmill script: run root & rootless in parallel, not
  sequentially. It's only four jobs, and it seems dumb
  to fix root tests, repush, then discover a rootless failure.

- apply-podman-deltas: implement skip_if_rootless(), and
  use it to skip a nasty longstanding flake

- bud-tests-in-podman diffs: ugly code to fix a rootless hang.
   background: rootless remote tests hang
   cause: stray podman server process
   root cause: no idea. No clue at all. I just gave up
   workaround: seek out and kill stray server processes

  Rootless buildah-bud tests are not run in regular CI,
  only in the buildah treadmill.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-05-08 05:28:11 -06:00
f877d7dcd0 Replace egrep/fgrep with grep -E/-F
There are days when I really, really, really hate GNU. Remember
when someone decided that 'head -1' would no longer work, and
that it was OK to break an infinite number of legacy production
scripts? Someone now decided that egrep/fgrep are deprecated,
and our CI logs (especially pr-should-include-tests) are now
filled with hundreds of warning lines, making it difficult
to find actual errors.

I expect that those warnings will be removed quickly after
furious community backlash, just like the 'head -1' fiasco
was quietly reverted, but ITM the warnings are annoying
so I capitulate.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-05-03 07:32:42 -06:00
2ce4e935be ginkgo v2: drop localbenchmarks
Porting them over to v2 requires a full rewrite.
IT is not clear who actually uses these benchmarks, Valentin who wrote
them originally is in favor of removing them. He recommends to use
script from hack/perf instead.

This commit also drop the CI integration, it is not clear who actually
uses this data. If it is needed for something please speak up.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-05-02 11:27:38 +02:00
7382494ca4 Add eBPF snooper that traces the entire fork/exec graph of podman
As long as podman uses a fork/exec model this eBPF program is able to trace the performance of each podman command and the resulting child processes from start to finish. This is an improvement to the already existing podmansnoop eBPF program which only looks at sched_process_exit and enter/exit sys_execve tracepoints.

Signed-off-by: Paul Wallrabe <54737071+raballew@users.noreply.github.com>
2023-04-20 11:30:47 +02:00
bb70d60f15 rm hack/release.sh
The script is not used anymore as it can't release off a branch, so
let's remove it.

[1] https://github.com/containers/podman/pull/18038#issuecomment-1495914827

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-04-04 14:55:58 +02:00
dd8574022d CI: retry the golangci install
It flakes once or twice a day:

   VERSION=1.51.1 ./hack/install_golangci.sh
   Installing golangci-lint v1.51.1 into ./bin/golangci-lint
   golangci/golangci-lint info checking GitHub for tag 'v1.51.1'
   golangci/golangci-lint crit unable to find 'v1.51.1' - use 'latest'
      or see https://github.com/golangci/golangci-lint/releases for details

No visibility into why, and no special reason to believe that
retrying five seconds later will work, but it seems worth a try.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-03-27 10:53:17 -06:00
7ed1c7fd99 buildah treadmill: also run rootless tests
In February we started running rootless bud tests in cron (#17608).
That's nice, but nobody ever looks at cron results. The idea behind
adding a rootless task was to run it in the manual treadmill, too.
This PR enables that, and more clearly documents the how and why.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-03-15 07:05:09 -06:00
3a9d14d4e9 man page --format xref: tighten the autocompletion check
Followup to #17486: stricter checks on --format.

  * If a subcommand offers autocompletion for templates,
    it must also offer a '--format json' option.

  * If a subcommand has a --format option that DOES NOT
    offer autocompletion for templates, it must be listed
    in a hardcoded grandparented-in table of commands
    where that's not applicable. (Mostly commands
    like build, commit, save, where "format" is used
    in the context of "oci/docker").

Only likely to trigger on PRs which add new subcommands,
and is intended to catch oversights.

Also, test for alphanumeric order in man page tables.
Sort all existing tables.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-02-14 08:11:54 -07:00
34d412e13d man page xref: validate displayed man page names
command tables are chock full of duplication, hence they break.
Look for inconsistencies between the displayed man page name
and the actual man page name:

    |  foo    | [podman-foo(1)](podman-cmd-foo.1.md) | ...
                        ^^^

Inspired by #17474.

We can't actually check the subcommand name (the plain "foo")
because there are many existing subcommands whose name does
not match the man page: rmi vs image-rm, list vs podman-ps.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-02-13 07:54:57 -07:00
4334135491 [CI:DOCS] man-page checker: include --format (Go templates)
Very belated successor to #14046.

I don't know why this is so important to me. Probably because we're
doing a halfhearted sloppy job of documenting, and new options get
added, and not documented, and that's just wrong.

I've given up on documenting internal structs. This iteration
has a $Format_Exceptions table defined at the top of the xref
script, enumerating a hardcoded defined set of podman commands
and fields that should remain undocumented.

This iteration also forgives completely-undocumented formats.
If podman-foo has a --format, but podman-foo.1.md does not
list *any* valid fields, the script warns but does not fail.
This at least is better than documenting a random mix of fields.

This version of the xref script is much slower: 10s vs 4. I
think we can live with that in a CI-only script.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-02-08 15:33:45 -07:00
3464df2030 Merge pull request #17335 from vrothberg/hack/perf/bz-2162111.sh
[CI:DOCS] hack/perf/bz-2162111.sh: use custom network
2023-02-06 13:24:00 +01:00
4c8ad63568 Merge pull request #17331 from edsantiago/makedocs_parallel_safe
make hack/markdown-preprocess parallel-safe
2023-02-03 23:08:54 +01:00
8aa3776981 hack/perf: cleanup after benchmarks
To leave not leave some artifacts arounds.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-02 16:53:30 +01:00
cb5a9e9f44 hack/perf/bz-2162111.sh: use custom network
Create the containers with a custom network.  It has an impact on the
speed of container creation.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-02 16:52:32 +01:00
1a786ea537 hack/perf/bz-2162111.sh: measure stop
Add benchmarks for stopping the containers as well.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-02-02 13:58:09 +01:00
bd8937c504 make hack/markdown-preprocess parallel-safe
One of the tmpfiles was not uniquely named, resulting in
conflicts with parallel 'make docs'. Fix that.

A better solution would be to run only one instance of the
preprocess script, but the Makefile incantation for that
is beyond me. This approach is CPU-wasteful but good enough.

Fixes: #17322

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-02-02 05:32:38 -07:00
61db1d5aa1 [CI:DOCS] hack/perf: add script for BZ 216111
Add a script with reproducers for bugzilla.redhat.com/show_bug.cgi?id=2162111.
The results are not much different compared to the already existing
scripts.  Podman is faster despite for container removal.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-30 16:43:14 +01:00
74c0909736 Add gvproxy to Windows packages
Updated build scripts and installer build scripts to include gvproxy.exe.
Includes tutorial on setting up a Podman VM with QEMU and gvproxy on Windows.

Signed-off-by: Arthur Sengileyev <arthur.sengileyev@gmail.com>
2023-01-29 22:01:00 +02:00
4ed46c9847 add hack/perf for comparing two container engines
Add a set of scripts using hyperfine for comparing two container
engines.  I am currently using the scripts for comparing Podman
and Docker, and with older versions of Podman.

These scripts are not meant for production usage but to aid in tracking
down performance regressions and bottlenecks.

Run the scripts via `sudo sh $script.sh`.

Use the following environment variables to change the default behavior:
* `ENGINE_A` to set container engine A (default `/usr/bin/podman`)
* `ENGINE_B` to set container engine B (default `/usr/bin/docker`)
* `RUNS` to change the runs/repetitions of each benchmarks (default `100`)
* `NUM_CONTAINERS` to change the number of created containers for some benchmarks (e.g., `ps`) (default `100`)
* `IMAGE` to change the default container image (default `docker.io/library/alpine:latest`)

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-01-23 16:38:12 +01:00
7826e1ced6 Preprocess files in UTF-8 mode
Some (?) Python versions assume that text files are encoded as 7-bit ASCII and abort when encountering other encoding. Some of podman's markdown documentation files are encoded as UTF-8, and this needs to be specified explicitly when opening files.

Closes https://github.com/containers/podman/issues/16996.

[NO NEW TESTS NEEDED]

Signed-off-by: Erik Schnetter <schnetter@gmail.com>
2023-01-05 14:15:44 -05:00
710eeb3403 hack/bats: improve usage message
Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-04 14:26:26 -07:00
d7ac11005c hack/bats: add --remote option
Even though we still rely on the user to start the podman
system service, enable the option anyway. It's much, much
friendlier than requiring 'env PODMAN=etc-etc'.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-04 14:04:27 -07:00
1a2e54ce65 hack/bats: fix root/rootless logic
The ROOT{,LESS}_ONLY logic is confusing and unmaintainable.
Change it to an easier-to-read positive check.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-04 14:04:27 -07:00
d92bfd244f Man page checker: require canonical name in SEE ALSO
The man-page cross-reference script checks the SEE ALSO section
to confirm that all references are to existing man pages (#12258).
However, it's a little too forgiving: it allows aliases, the
short '.so' files under the 'links/' subdirectory. That means
we could link to non-default command names, and were doing so.

As of this PR, we no longer allow that. Any podman command
referenced in SEE ALSO must be the canonical command name
(and man page). Fix existing non-canonical names, and
remove the exception so we don't allow this again.

See #16848 for discussion of context.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-01-03 10:24:55 -07:00
236f0cc504 hacks/bats: keep QUADLET env var in test env
This is needed for the bats test to work

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-21 12:48:40 +01:00
80878f20bc Add initial system tests for quadlets
This adds basic container and volume system tests for quadlet. These
install and run actual systemd units and ensure they work.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
2022-12-16 15:35:51 +01:00
08741496d8 parse-localbenchmarks: separate standard deviation
Go benchmark results include an Average, represented as

    <mean> ± <standard deviation>

This is suboptimal for many reasons:

  * Some web server somewhere in our CI pipeline (Cirrus?
    Google? Gitlab? I have no idea) sends the wrong mime-type
    header, rendering the CSV weird-looking in a browser.
    Not that it's intended for a browser, but we have to
    debug/verify manually once in a while.

  * The spaces and +/- makes it less machine-readable.

Solution: split the "Average" field into two: Average, and
Standard Deviation. And, as a courtesy to human readers,
add a new column with SD as a percentage.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-12-10 13:34:41 -07:00
7665bbc127 Remove 'you' from man pages
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-12-07 09:29:29 -05:00
68d41c68d9 hack/podmansnoop: print arguments
Update the snoop script to also include the arguments to make the output
more useful.

```
$ sudo hack/podmansnoop
PCOMM            PID     PPID    AGE(ms) ARGV
conmon           14964   14952   1.01    /usr/bin/conmon --version
podman           14952   14139   26.07   /usr/bin/podman ps
```

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-11-30 10:38:08 +01:00
c7827957a4 ginkgo: restructure install work flow
- move the ginkgo deps into test/tools which is more consitent with the
  other tools there, listing in dependencies always causes errors with
  linters
- do not install it globally on the system, instead we use it in a
  subdir of this project

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-11-25 14:41:43 +01:00
3a392d9111 Merge pull request #16430 from edsantiago/xref-docker-options
[skip ci] Formalize our compare-against-docker mechanism
2022-11-11 15:51:32 +00:00
c0a9c6ebc9 Formalize our compare-against-docker mechanism
Long-term followup to #14917. This adds a new one-off script,
to be run periodically, which runs our man-page crossref
against docker, highlighting commands and options that docker
lists in its --help but we don't list in our man pages.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-11-10 05:47:32 -07:00
aa47e05ae4 libpod: Add pasta networking mode
Conceptually equivalent to networking by means of slirp4netns(1),
with a few practical differences:

- pasta(1) forks to background once networking is configured in the
  namespace and quits on its own once the namespace is deleted:
  file descriptor synchronisation and PID tracking are not needed

- port forwarding is configured via command line options at start-up,
  instead of an API socket: this is taken care of right away as we're
  about to start pasta

- there's no need for further selection of port forwarding modes:
  pasta behaves similarly to containers-rootlessport for local binds
  (splice() instead of read()/write() pairs, without L2-L4
  translation), and keeps the original source address for non-local
  connections like slirp4netns does

- IPv6 is not an experimental feature, and enabled by default. IPv6
  port forwarding is supported

- by default, addresses and routes are copied from the host, that is,
  container users will see the same IP address and routes as if they
  were in the init namespace context. The interface name is also
  sourced from the host upstream interface with the first default
  route in the routing table. This is also configurable as documented

- sandboxing and seccomp(2) policies cannot be disabled

- only rootless mode is supported.

See https://passt.top for more details about pasta.

Also add a link to the maintained build of pasta(1) manual as valid
in the man page cross-reference checks: that's where the man page
for the latest build actually is -- it's not on Github and it doesn't
match any existing pattern, so add it explicitly.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2022-11-08 00:16:35 +01:00
3ad5827b2d hack/podmansnoop
Add a script to measure the execution times of podman, crun, run and
conmon.  It's a trimmed down version of the exitsnoop tool and intended
to guide us in future performance optimizations.

The below output was generated when running

`podman run --net=host docker.io/library/alpine:latest true`

```
podman (snoop) $ sudo ./hack/podmansnoop
PCOMM            PID     PPID    TID     AGE(ms)
conmon           51580   51569   51580   1.67
conmon           51583   51569   51583   3.53
crun             51591   51590   51591   18.28
crun             51593   51569   51593   2.48
conmon           51606   51594   51606   0.85
crun             51608   51594   51608   2.50
podman           51594   51590   51594   176.27
conmon           51590   1950    51590   214.78
podman           51569   40964   51569   431.36
```

In the future, it would be helpful to add the arguments of the commands.
`execsnoop` can reveal them quite nicely but I did not manage to merge
the two scripts due to time constraints.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-28 15:51:53 +02:00
c9c2f644da markdown-preprocess: cross-reference where opts are used
In each options/foo.md, keep a list of where the option is used.
This will be valuable to anyone making future edits, and to
those reviewing those edits.

This may be a controversial commit, because those crossref lists
are autogenerated as a side effect of the script that reads them.
It definitely violates POLA. And one day, some kind person will
reconcile (e.g.) --label, using it in more man pages, and maybe
forget to git-commit the rewritten file, and CI will fail.

I think this is a tough tradeoff, but worth doing. Without this,
it's much too easy for someone to change an option file in a way
that renders it inapplicable/misleading for some podman commands.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-10-20 10:57:51 -06:00
8fef5eb12c Merge pull request #16170 from edsantiago/manpage_generic_include
[CI:DOCS] markdown-preprocess: add generic include mechanism
2022-10-17 09:53:06 -04:00
bb2b47dc70 Add swagger install + allow version updates in CI
Support swagger testing and optional runtime updates similar to
the current golangci-lint tool.  This allows developers to update the
version of swagger at runtime if needed.  Otherwise new CI VM images
will pick up the prescribed version at image build-time via
`make install.tools`.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-10-14 08:18:52 -04:00
5113343a5d hack/tree_status.sh: print diff at the end
Print the diff at the end of the report to help better understand what's
going on.

```
tree is dirty, please run "make vendor" and commit all changes.

 M go.mod
 M go.sum
 M hack/tree_status.sh
 M vendor/github.com/containers/storage/store.go
 M vendor/modules.txt

---------------------- Diff below ----------------------

diff --git a/go.mod b/go.mod
index e36d3fb95c57..167d769c378f 100644
--- a/go.mod
+++ b/go.mod
@@ -17,7 +17,7 @@ require (
        github.com/containers/image/v5 v5.23.0
        github.com/containers/ocicrypt v1.1.6
        github.com/containers/psgo v1.7.3
-       github.com/containers/storage v1.43.1-0.20221013143630-714f4fc6e80e
+       github.com/containers/storage v1.43.1-0.20221014072257-a144fee6f51c
        github.com/coreos/go-systemd/v22 v22.4.0
        github.com/coreos/stream-metadata-go v0.0.0-20210225230131-70edb9eb47b3
        github.com/cyphar/filepath-securejoin v0.2.3
```

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-10-14 09:39:37 +02:00
bd4ee2d578 markdown-preprocess: add generic include mechanism
This is what was supposed to be an easy two-or-three-line
change to enable a more general-purpose include mechanism
than '@@option'; one that could include an arbitrary file.

This is commit 2 of 2, the "easy" part. Unfortunately, it's
not looking good. The source .md file has UTF8 checkmarks,
and nroff is not happy with those: the generated man pages
are gross.

Another problem: the source .md might need tweaking, because
we don't want a level 1 header in the man page. Obvious solution
is to make kubernetes_support.md a .md.in file as well, and
move the tables to a separate file (or files). Deferred for later.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-10-13 15:57:43 -06:00
9cdea7fb37 markdown-preprocess: almost complete OO rewrite
Refactoring needed in order to add a more general-purpose
include mechanism. Functionality remains the same, and
oh, how I've tested! Unfortunately it's not possible to
review this, at least, not via diffs. Should you be
inclined to review, you'll need to treat it as a
completely brand-new script and test.

This is commit 1 of 2: basically, retain 100% compatibility
with what we have at the moment. Commit 2 will add the
new include mechanism. That one is easy to review.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-10-13 15:56:52 -06:00
0fb95f95d2 CI: only make install.tools when needed
Reintroduce .install.foo targets into Makefile, and invoke
only the bare-minimum ones needed for each individual CI
step in setup_environment.sh.

Also add a retry to the golangci-lint curl, in hopes of
dealing with network flakes. And remove the -f (fail)
because it produces unhelpful logs.

Reason: saw about 25% CI flakes yesterday due to the golangci-lint
fetch, something about a timeout, and this was especially frustrating
because none of the steps actually needed lint. Quick reminder:
avoid network fetches unless absolutely necessary.

Fixes: #15892

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-09-27 05:52:34 -06:00
fde4d21be5 man page xref: verify page title
Issue #15923 should have never happened: the problem should've
been autodetected. Make it so henceforth (and fix another
existing discrepancy)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-09-26 06:19:15 -06:00
8ff54cbe8c Fix libsubid detection
Library arguments must be positioned after sources when invoking GCC.

Signed-off-by: Sam Morris <sam@robots.org.uk>
2022-09-23 09:58:39 +01:00
ccee741973 Merge pull request #15829 from edsantiago/shlint
Cleanup: fix problems reported by shell lint
2022-09-16 09:55:56 +02:00
a8a56b188c Merge pull request #15722 from edsantiago/treadmill_improvements
[CI:DOCS] Buildah treadmill script: various fixes
2022-09-16 09:39:04 +02:00
cfbc4aaeb5 Cleanup: fix problems reported by shell lint
Followup to #15616, which is not usable as it is (way, way, way
too much noise) but actually found a few real nits that should
be fixed.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-09-15 20:10:34 -06:00
a1fa9faa48 Buildah treadmill script: various fixes
...gathered up from the last few months of almost-daily runs.

The principal difference is, ditching the git-am approach in
favor of git-cherry-pick. It's so much nicer! I keep forgetting
how clumsy git-am is. With the new approach, saved checkpoints
are kept as git branches, not in an easy-to-lose text file.
And, conflict resolution is MUCH EASIER. (Conflict resolution
is necessary when, e.g., the treadmill PR includes fixes for
some new vendoring that buildah has done but not podman, then
podman vendors in that same module but fixes broken tests in
a different way than I did).

Also a lot of smaller fixes for bugs reported by @Luap99.
Thank you for testing and for letting me know of problems!

Cursory review is OK: this will not break anything in the repo,
and I've been testing/finetuning these changes heavily over
the past month or two.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2022-09-12 08:38:31 -06:00
2c63b8439b Fix stutters
Podman adds an Error: to every error message.  So starting an error
message with "error" ends up being reported to the user as

Error: error ...

This patch removes the stutter.

Also ioutil.ReadFile errors report the Path, so wrapping the err message
with the path causes a stutter.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-09-10 07:52:00 -04:00