13987 Commits

Author SHA1 Message Date
4543fd463e Merge pull request #12571 from vrothberg/fix-12566
compat build: adhere to q/quiet
2021-12-13 14:54:03 -05:00
b6ce7e19ec Merge pull request #12581 from cevich/disable_gitlab
[CI:DOCS] Cirrus: Temp. ignore gitlab task failures
2021-12-13 16:57:25 +01:00
8cb93ac103 Cirrus: Temp. ignore gitlab task failures
Appears related to https://gitlab.com/gitlab-org/gitlab-runner/-/issues/28732
Log: https://cirrus-ci.com/task/5708221852680192?logs=setup#L433

Marking test to be ignored until I can figure out where/how to fix it.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-12-13 10:31:01 -05:00
81a0a79844 compat build: adhere to q/quiet
Fixes: #12566
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-13 09:52:24 +01:00
e993b88c03 Merge pull request #12573 from Luap99/fix-test
fix e2e test missing network cleanup
2021-12-10 17:56:28 +00:00
5bbcfaf4aa Make XRegistryAuthHeader and XRegistryConfigHeader private
... now that they have no public users.

Also remove the HeaderAuthName type, we don't need the type-safety
so much for private constants, and using plain strings results in
less visual noise.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:27 +01:00
3cfefa1248 Remove the authfile parameter of MakeXRegistryAuthHeader
Having a parameter that modifies the provides types.SystemContext
seems rather unexpected and risky to have around - and the only
user of that is actually a no-op, others only provide a nil
SystemContext; so, remove that option and simplify (well, somewhat;
many callers now have extra &types.SystemContext{AuthFilePath}
boilerplate; at least that's consistent with that code carrying
a TODO to create a larger-scope SystemContext).

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:27 +01:00
d79414c54f Simplify the header decision in pkg/bindings/images.Build a bit
... now that two of the three cases are the same.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:26 +01:00
f9be326274 Remove the authfile parameter of MakeXRegistryConfigHeader
Having a parameter that modifies the provides types.SystemContext
seems rather unexpected and risky to have around - and the only
user of that is actually a no-op; so, remove that option and simplify.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:26 +01:00
935dcbb008 Remove no-longer-useful name variables
which used to contain more context, but now are just
a pointless copy.

Should not change (test) behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:25 +01:00
0e29b89753 Consolidate creation of SystemContext with auth.json into a helper
Should not change (test) behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:25 +01:00
fe1230ef70 Remove pkg/auth.Header
It is no longer used.

Split the existing tests into MakeXRegistryConfigHeader
and MakeXRegistryAuthHeader variants. For now we don't modify
the implementations at all, to make review simpler; cleanups
will follow.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:24 +01:00
3725a34cbf Call MakeXRegistryAuthHeader instead of Header(..., XRegistryAuthHeader)
All callers hard-code a header value, so this is actually shorter.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:24 +01:00
78dd797520 Turn headerAuth into MakeXRegistryAuthHeader
... which can be called independently.

For now, there are no new callers, to test that the behavior
has not changed.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:23 +01:00
d073b1275d Call MakeXRegistryConfigHeader instead of Header(..., XRegistryConfigHeader)
All callers hard-code a header value, so this is actually shorter.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:23 +01:00
8155fb5658 Turn headerConfig into MakeXRegistryConfigHeader
... which can be called independently.

For now, there are no new callers, to test that the behavior
has not changed.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:22 +01:00
29f4088713 Move the auth file creation to GetCredentials
This shares the code, and makes getConfigCredentials
and getAuthCredentials side-effect free and possibly easier to test.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:22 +01:00
9d56ebb611 Consolidate the error handling path in GetCredentials
We'll share even more code here in the future.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:21 +01:00
da86a23285 Only look up HTTP header values once in GetCredentials
... and have GetCredentials pass the values down to
getConfigCredentials and getAuthCredentials.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:21 +01:00
1589d70bcb Use Header.Values in GetCredentials.has
It's possibly a bit more expensive, but semantically safer
because it does header normalization.

And we'll regain the cost by not looking up the value repeatedly.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:20 +01:00
2946e83493 Beautify GetCredentials.has a bit
Use separate lines, and use the provided .String() API.

Should not change behaivor.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:20 +01:00
1ecc6ba728 Pass a header value directly to parseSingleAuthHeader and parseMultiAuthHeader
Both have a single caller, so there's no point in looking up
the header value twice.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:19 +01:00
6f1a26b04f Simplify parseSingleAuthHeader
In the "no input" case, return a constant instead of
continuing with the decode/convert path, converting empty data.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:19 +01:00
7674f2f76b Simplify the interface of parseSingleAuthHeader
Don't create a single-element map only for the only caller
to laboriously extract an element of that map; just return
a single entry.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:18 +01:00
2aeb690d37 Don't return a header name from auth.GetCredentials
Almost every caller is using it only to wrap an error
in exactly the same way, so move that error context into GetCredentials
and simplify the users.

(The one other caller, build, was even wrapping the error incorrectly
talking about query parameters; so let it use the same text as the others.)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:18 +01:00
491951d66e Fix normalizeAuthFileKey to use the correct semantics
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:17 +01:00
1b6bf97130 Rename normalize and a few variables
... to refer to auth file keys instead of servers and the like.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:17 +01:00
d29a4a6d17 Add TestHeaderGetCredentialsRoundtrip
... as an end-to-end unit test of the header creation/parsing
code.

Leave the docker.io and docker.io/vendor test cases commented out,
because they are currently failing.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:15 +01:00
ad7e5e34f2 Add tests for auth.Header
Just a single function that handles all of Header,
headerConfig and headerAuth; we will split that later.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:16:14 +01:00
5a5aa6009f Improve TestAuthConfigsToAuthFile
Remove the created temporary file.

Use more appropriate assertion calls.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:09:55 +01:00
ff003928b2 Add unit tests for singleAuthHeader
Also rename it to parseSingleAuthHeader

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:09:55 +01:00
b162d8868c Add unit tests for multiAuthHeader
Also rename it to parseMultiAuthHeader.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-12-10 18:09:55 +01:00
47f4f149bd Merge pull request #12569 from vrothberg/fix-12167
pprof CI flakes: enforce 5 seconds grace period
2021-12-10 15:42:27 +00:00
bc191ca7d3 fix e2e test missing network cleanup
I noticed that this test will fail its flake rerun because the network
was not removed and it tried to create a network with the same name.
Also network disconnect works rootless now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-10 16:23:40 +01:00
a7690048b8 Merge pull request #12564 from Darkness4/main
rootless: declare TEMP_FAILURE_RETRY before usage (Fixes: #12563)
2021-12-10 15:10:30 +00:00
99bc00421b pprof CI flakes: enforce 5 seconds grace period
This gives the service 5 seconds to digest the signal and 5 more seconds
to shutdown.  Create a new variable to make bumping the timeout easier
in case we see re-flake in the future.

Fixes: #12167
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-10 15:01:44 +01:00
1d781ccbea [NO NEW TESTS NEEDED] rootless: declare TEMP_FAILURE_RETRY before usage (Fixes: #12563)
Signed-off-by: Nguyen Marc <nguyen_marc@live.fr>
2021-12-10 14:20:35 +01:00
f80a7fda74 Merge pull request #12555 from rhatdan/pod
--hostname should be set with podman create --pod new:PODNAME
2021-12-09 16:30:58 -05:00
b24f2ae901 Merge pull request #12547 from cevich/cached_swagger
[CI:DOCS] Cirrus: Use cached swagger binary
2021-12-09 18:11:28 +00:00
593d0907c5 --hostname should be set when using --pod new:foobar
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2030599

When you create pod, it shares the UTS namespace with Containers.
Currently the --hostname is not passed to the pod created when
you create a container and pod in the same command.

Also fix error message on supported --share flags

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-09 13:09:02 -05:00
c7ed2be8d2 Merge pull request #12556 from edsantiago/rm_rm_podman_pause_image
System tests: remove rm_pause_image()
2021-12-09 18:07:19 +00:00
9cfdffdfa3 Merge pull request #12557 from vrothberg/fix-11825
inotify: make sure to remove files
2021-12-09 17:45:22 +00:00
a63035be20 Cirrus: Use cached swagger binary
An error was observed in another PR while downloading the swagger
binary.  The error was relating to the upstream egress quota.  Obviously
our downloading it every time for each CI run isn't helping.  Fix this
by moving the download into the image-build process, and simply re-use
the already present binary here.

Ref: https://github.com/containers/automation_images/pull/103

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-12-09 12:14:44 -05:00
6d19ecadc8 inotify: make sure to remove files
Issue #11825 suggests that *rootless* Podman can run into situations
where too many inotify fds are open.  Indeed, rootless Podman has a
slightly higher usage of inotify watchers than the root counterpart
when using slirp4netns

Make sure to not only close all watchers but to also remove the files
from being watched.  Otherwise, the fds only get closed
when the files are removed.

[NO NEW TESTS NEEDED] since we don't have a way to test it.

Fixes: #11825
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-09 17:06:21 +01:00
18854f5666 System tests: remove rm_pause_image()
...it's not needed: teardown() already does it. Or, it would,
if it had been updated to deal with the new pause image naming
convention, which I've just done.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-12-09 08:23:43 -07:00
4a52a457d1 Merge pull request #12545 from vrothberg/fix-12477
generate systemd: support entrypoint JSON strings
2021-12-09 08:41:29 +00:00
02eaebda46 Merge pull request #12541 from flouthoc/remote_blank_entrypoint
specgen: honor empty args for entrypoint specified as `--entrypoint ""`
2021-12-08 16:50:20 +00:00
b526a0ccdc specgen: honor empty args for entrypoint
Users should be able to override containers entrypoint using
`--entrypoint ""` following works fine for podman but not for podman
remote.

Specgen ignores empty argument for entrypoint so make specgen honor
empty arguments.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-12-08 20:26:36 +05:30
2d517b687b generate systemd: support entrypoint JSON strings
Make sure to preserve the quoting of entrypoint JSON strings.

Fixes: #12477
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-08 15:51:23 +01:00
d6079debd8 Merge pull request #12529 from vrothberg/fix-12436
remove runlabel test for global opts
2021-12-08 14:42:19 +00:00