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

fix: check bind source file/dir exists #624

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

raharper
Copy link
Contributor

@raharper raharper commented Jun 4, 2024

Stacker does not check if a bind mount source exists and if the source is a directory then the container crashes with a stack trace that does not indicate that the missing source dir is the issue.

Check if the source exists and return an error indicating the source is missing instead of the container stack trace.

What type of PR is this?

bug

Which issue does this PR fix:

What does this PR do / Why do we need it:

If an issue # is not available please add repro steps and logs showing the issue:

$ mkdir test-binds && cd test-binds
$ cat > stacker.yaml <<EOF
hello-binds:
  from:
    type: docker
    url: docker://zothub.io/tools/busybox:stable
  binds:
    - mydir -> /mydir
  run: |
    mkdir -p /hello-stacker-app
    echo 'echo "Hello Stacker!"' > /hello-stacker-app/hello.sh
EOF
$ stacker build -f stacker.yaml

Testing done on this change:

Above test returns an error indicating that the source directory in binds is missing.

Automation added to e2e:

Will this break upgrades or downgrades?

Does this PR introduce any user-facing change?:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

pkg/stacker/build.go Outdated Show resolved Hide resolved
@raharper raharper force-pushed the fix/check-bind-source-exists branch from b2242c7 to 750964b Compare June 6, 2024 15:09
Stacker does not check if a bind mount source exists and if the source
is a directory then the container crashes with a stack trace that does
not indicate that the missing source dir is the issue.

Check if the source exists and return an error indicating the source
is missing instead of the container stack trace.

Signed-off-by: Ryan Harper <ryaharpe@cisco.com>
@raharper raharper force-pushed the fix/check-bind-source-exists branch from 750964b to 9f7f75b Compare June 10, 2024 19:28
@hallyn hallyn merged commit 8fbf329 into project-stacker:main Jun 11, 2024
9 checks passed
mikemccracken added a commit to mikemccracken/stacker that referenced this pull request Jun 11, 2024
Just copied Ryan's test from the description of project-stacker#624 with minimal
editing.

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
mikemccracken added a commit that referenced this pull request Jul 24, 2024
Just copied Ryan's test from the description of #624 with minimal
editing.

Signed-off-by: Michael McCracken <mikmccra@cisco.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants