Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user-defined dependencies to podman generate systemd #12887

Merged
merged 1 commit into from
Jan 20, 2022

Conversation

esendjer
Copy link
Contributor

@esendjer esendjer commented Jan 17, 2022

What does this PR do?

Add the new features - user-defined dependencies (--wants, --after, --requires) in generate systemd

This PR includes three commits:

  • Handlers for generate systemd with custom dependencies
  • Tests for generate systemd with custom dependencies
  • Documented custom dependencies options for systemd generate

UPD

Added one commit with a fix - Removed unnecessary trailing newline (whitespace)

Motivation

The issue #12809

Additional Notes

None

@rhatdan
Copy link
Member

rhatdan commented Jan 17, 2022

Thanks @esendjer
LGTM
/approve
@vrothberg PTAL

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 17, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: esendjer, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 17, 2022
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to add e2e tests (see test/e2e/generate_systemd.go). That will reveal that the new code only runs on the local client but not on the remote client. That means we have to extend the pkg/api and pkg/bindings with the new parameters.

Once the nits are addressed, could you squash the last three commits into one so we have one commit adding all the code and the tests etc.?

cmd/podman/generate/systemd.go Outdated Show resolved Hide resolved
docs/source/markdown/podman-generate-systemd.1.md Outdated Show resolved Hide resolved
pkg/systemd/generate/containers.go Outdated Show resolved Hide resolved
pkg/systemd/generate/containers.go Outdated Show resolved Hide resolved
pkg/domain/entities/generate.go Outdated Show resolved Hide resolved
pkg/systemd/generate/containers.go Outdated Show resolved Hide resolved
pkg/systemd/generate/pods.go Outdated Show resolved Hide resolved
cmd/podman/generate/systemd.go Outdated Show resolved Hide resolved
cmd/podman/generate/systemd.go Outdated Show resolved Hide resolved
@esendjer
Copy link
Contributor Author

esendjer commented Jan 18, 2022

Hi @vrothberg
I added e2e tests but not sure that all was done well. Could you please have a look?
UPD Now it should be better, but needs attention and review.

@TomSweeneyRedHat
Copy link
Member

one doc nit, the rest LGTM once the tests are hip

@esendjer
Copy link
Contributor Author

esendjer commented Jan 19, 2022

Hey folk!
Sorry for the noise, but I've got a strange (for me) test failure in the places that I didn't touch as well as related files, and it's more strange because failure happens in different places. I have no idea how I can fix this failure.

Examples
[+1904s] Summarizing 4 Failures:
[+1904s] 
[+1904s] [Fail] Podman pod create [It] podman create pod with network portbindings 
[+1904s] /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_create_test.go:122
[+1904s] 
[+1904s] [Fail] Podman pod create [It] podman create pod with network portbindings 
[+1904s] /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_create_test.go:122
[+1904s] 
[+1904s] [Fail] Podman pod create [It] podman create pod with network portbindings 
[+1904s] /var/tmp/go/src/github.com/containers/podman/test/e2e/pod_create_test.go:122
[+1904s] 
[+1904s] [Fail] Podman build [It] podman build with a secret from file and verify if secret file is not leaked into image 
[+1904s] /var/tmp/go/src/github.com/containers/podman/test/e2e/build_test.go:94
[+1904s] 
[+1904s] Ran 1471 of 1634 Specs in 1837.283 seconds
[+1904s] FAIL! -- 1470 Passed | 1 Failed | 1 Flaked | 0 Pending | 163 Skipped

[+1698s] Summarizing 3 Failures:
[+1698s] 
[+1698s] [Fail] podman system service verify pprof endpoints [It] are not available 
[+1698s] /var/tmp/go/src/github.com/containers/podman/test/e2e/system_service_test.go:117
[+1698s] 
[+1698s] [Fail] podman system service verify pprof endpoints [It] are not available 
[+1698s] /var/tmp/go/src/github.com/containers/podman/test/e2e/system_service_test.go:117
[+1698s] 
[+1698s] [Fail] podman system service verify pprof endpoints [It] are not available 
[+1698s] /var/tmp/go/src/github.com/containers/podman/test/e2e/system_service_test.go:117
[+1698s] 
[+1698s] Ran 1417 of 1647 Specs in 1630.018 seconds
[+1698s] FAIL! -- 1416 Passed | 1 Failed | 0 Flaked | 0 Pending | 230 Skipped

UPD A simple restart of the test helped

@esendjer
Copy link
Contributor Author

🎉 all tests passed

@mheon
Copy link
Member

mheon commented Jan 19, 2022

LGTM
@Luap99 PTAL

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the new api fields to the swagger documentation here: https://github.com/containers/podman/blob/main/pkg/api/server/register_generate.go#L11-L74

pkg/domain/infra/tunnel/generate.go Show resolved Hide resolved
This commit includes:
* Handlers for generate systemd unit
  with manually defined dependencies such as:
  Wants=, After= and Requires=

* The new unit and e2e tests for checking generated systemd units
  for container and pod with custom dependencies

* Documented descriptions for custom dependencies options

Signed-off-by: Eugene (Evgenii) Shubin <[email protected]>
@Luap99
Copy link
Member

Luap99 commented Jan 19, 2022

/lgtm
/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 19, 2022
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 19, 2022
@TomSweeneyRedHat
Copy link
Member

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 20, 2022
@openshift-merge-robot openshift-merge-robot merged commit 7fc8bf4 into containers:main Jan 20, 2022
@esendjer esendjer changed the title Add custom defined dependencies to podman generate systemd Add user-defined dependencies to podman generate systemd Jan 20, 2022
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants