coreos / coreos-assembler

Tooling container to assemble CoreOS-like systems
https://coreos.github.io/coreos-assembler/
Apache License 2.0
333 stars 165 forks source link

cmd: fix cmd-init detection failure when processing local sources dir #3769

Closed Littlemoon917 closed 4 months ago

Littlemoon917 commented 4 months ago

The '- f' option of the shell will give the opposite result as expected when a soft link is included in the path

openshift-ci[bot] commented 4 months ago

Hi @Littlemoon917. Thanks for your PR.

I'm waiting for a coreos member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
jlebon commented 4 months ago

Can you provide more details on what this fixes? The current logic should work fine regardless of whether e.g. manifest.yaml is a file or symlink to a file.

Littlemoon917 commented 4 months ago

ok,I got it.

This is an embarrassing mistake. Today I want to try building using the local sources directory. After reading the code, I found out that the configuration needs to be passed in with a path starting with/, but of course, it reported an error. Although cosa can create symbolic links, it is not possible to access valid paths within the container. However, after the container exits, check the path printed in the log in the host shell, at this point, the symbolic link is valid and definitily can work normally.

Why do I think it's symbolic links that cause shell detection to fail?

I will close this PR and may provide optimization suggestions for this part in the future to avoid others misunderstanding the log information like I do.It's not that the file doesn't exist, but rather that the incoming path cannot be accessed inside the container at all.

jlebon commented 4 months ago

Check out COREOS_ASSEMBLER_CONFIG_GIT in the docs to be able to also mount in the source config repo from some other local path.