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

vendir sync --json swallows error #357

Open
hans-d opened this issue Jan 21, 2024 · 8 comments
Open

vendir sync --json swallows error #357

hans-d opened this issue Jan 21, 2024 · 8 comments
Labels
bug This issue describes a defect or unexpected behavior carvel-accepted This issue should be considered for future work and that the triage process has been completed

Comments

@hans-d
Copy link

hans-d commented Jan 21, 2024

What steps did you take:

  • have a vendir.yaml that produces an error, eg
vendir: Error: Syncing directory 'foo':
  Copying another directory contents into directory 'bar': lstat ../src/foo: no such file or directory
  • run vendir sync: produces a nice error
  • run vendir sync --json

What happened:
produces no error, but does exit with code 1

What did you expect:
error message like without --json, in json and/or to stderr

Environment:

  • vendir version (execute vendir --version): vendir version 0.38.0
  • OS (e.g. from /etc/os-release): debian bookworm

Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

@hans-d hans-d added bug This issue describes a defect or unexpected behavior carvel-triage This issue has not yet been reviewed for validity labels Jan 21, 2024
@kumaritanushree
Copy link
Contributor

@hans-d I tried to reproduce the issue with config

apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
- path: sponnet
  contents:
  - path: xyz
    http:
      url: https://github.com/spinnaker/sponnet/archive/refs/tags/v1.26.0.tar.gz123

First I run without --json and got error message in output:

$ vendir sync -f vendir.yaml 
Fetching: sponnet + xyz (http from https://github.com/spinnaker/sponnet/archive/refs/tags/v1.26.0.tar.gz123)

vendir: Error: Syncing directory 'sponnet':
  Syncing directory 'xyz' with HTTP contents:
    Downloading URL:
      Expected 200 OK, but was '404 Not Found'

With --json, it exited without any error or any log:

$ vendir sync -f vendir.yaml --json

Did you get something different output if yes can you please add here your config and steps you followed? (It will be helpful in future)

After trying out above config I can see there is bug in vendir sync --json output. In case of failure with flag --json as well it should show error message.

@hans-d
Copy link
Author

hans-d commented Jan 29, 2024

This is the kind of thing i'm facing. It should produce an error (stderr or in json), and exit with a non-zero status

@Zebradil
Copy link
Member

Zebradil commented Jan 30, 2024

@Zebradil what do you think about this?

@100mik I think that, in case of an error, vendir --json should:

  • print nothing to the stdout
  • print a plain text error to the stderr
  • exit with a non-zero exit code

@joaopapereira
Copy link
Member

Hey @hans-d can you provide a sample vendir.yaml for us to look at?
It sounds like you have ../ as part of a path, is that correct?

@hans-d
Copy link
Author

hans-d commented Jan 30, 2024

The '../' is part of the source directory:

apiVersion: vendir.k14s.io/v1alpha1
kind: Config

directories:

  - path: somewhere
    contents:
      - path: over/the/rainbow
        directory:
          path: ../src/foo # non-existing

@renuy renuy added carvel-accepted This issue should be considered for future work and that the triage process has been completed and removed carvel-triage This issue has not yet been reviewed for validity labels Feb 6, 2024
@renuy renuy moved this to Prioritized Backlog in Carvel Feb 6, 2024
@renuy
Copy link

renuy commented Feb 6, 2024

This issue is seen in kbld & imgpkg too?

@hans-d
Copy link
Author

hans-d commented Feb 6, 2024

Not using those, so can't say.

@kumaritanushree
Copy link
Contributor

Same issues seen in imgpkg and kbld as well. Issues created are:
carvel-dev/kbld#455
carvel-dev/imgpkg#631

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a defect or unexpected behavior carvel-accepted This issue should be considered for future work and that the triage process has been completed
Projects
Status: Prioritized Backlog
Development

No branches or pull requests

5 participants