Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Add duffle claim show --output #815

Merged
merged 2 commits into from
Aug 21, 2019

Conversation

astrieanna
Copy link
Contributor

@astrieanna astrieanna commented Jul 25, 2019

Part of #747

After making the code compile against the cnab-go library with outputs support implemented, this PR adds a --output flag to duffle claim show. This allows users to dump the contents of output files to stdout.

  • The output flag takes the name of an output as stated in the bundle; by showing a claim the user can view the names of all the outputs that are part of the bundle.
  • Because the cnab-go library implementation returns all the outputs that were generated, even if errors occurred during execution, users will be able to see what output files the invocation image produced during failed runs.

cc @youreddy @jeremyrickard

},
}

cmd.Flags().BoolVarP(&onlyBundle, "bundle", "b", false, "only show the bundle from the claim")
cmd.Flags().BoolVarP(&cmdData.OnlyBundle, "bundle", "b", false, "only show the bundle from the claim")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not make this show the bundle from the claim, but not necessarily only the bundle? Then users would mix -o and -b if they wanted to?

Choose a reason for hiding this comment

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

A reason not to enable -o and -b to be used together is that it is not obvious what such a command should do.

Some options:

  • If you think of each of these as a filter on what output should be produced, then specifying both gives you no output (because they filter for different parts of the claim, there is not intersection).
  • Since of -o and -b has a specific output, using both gives you both (in some order).
  • Since -b says you want part of the bundle and -o selects an output listed in the bundle, both gives the specification of the output from the bundle in the claim (rather than the contents of the file).

We tend to think of the CLI behavior through the first mental model (filtering), so the use-case of combining the flags is very limited. However, if users did want to mix -o and -b, we should decide what that behavior should be and how to easily convey that to the user.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was also wondering if --output could be a string slice, and then print all the selected outputs ? 🤔

Copy link

@youreddy youreddy Aug 6, 2019

Choose a reason for hiding this comment

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

I'm fine fine with either a string slice or the way it's implemented in the PR; both implementations fit our use case. I'll leave it to the repo owners to decide what the cli user experience should be.

cmd/duffle/claims_show.go Show resolved Hide resolved
cmd/duffle/claims_show.go Outdated Show resolved Hide resolved
Gopkg.toml Outdated Show resolved Hide resolved
@astrieanna
Copy link
Contributor Author

@silvin-lubecki does this side of the PR look good?

@radu-matei
Copy link
Member

/brig run

@youreddy youreddy force-pushed the pr/duffle-outputs branch from 9ddd4f7 to a4c2465 Compare August 8, 2019 21:57
@youreddy
Copy link

youreddy commented Aug 8, 2019

The PR in cnab-go was merged, going to update the Gopkg.toml file to point to the updated version!

@jeremyrickard
Copy link
Member

@youreddy should we release cnab-go or are you planning on pinning to a commit #? I'd prefer a released version, but we can always update to that once we have a few more things in.

@youreddy
Copy link

youreddy commented Aug 8, 2019

@jeremyrickard, I was going to specify master but you're right we should do a released version. And yes to releasing cnab-go!

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

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

LGTM

@jeremyrickard
Copy link
Member

/brig run

- Bump to cnab-go released version where outputs are implemented.
- Add --output flag to claim show.
- Run flag validation in PreRunE hook.
- Uses subtests to separate happy path from error cases.

Signed-off-by: Leah Hanson <lhanson@pivotal.io>
@astrieanna astrieanna changed the title Add duffle claim show --output [DO NOT MERGE] Add duffle claim show --output Aug 15, 2019
@astrieanna
Copy link
Contributor Author

@jeremyrickard /brig run ?

@radu-matei
Copy link
Member

/brig run

@jeremyrickard
Copy link
Member

@astrieanna sorry for the delayed response. Were you asking me to re-run it, or what "/brig run" does? Happy to explain what it does if you'd like!

Copy link
Member

@jeremyrickard jeremyrickard left a comment

Choose a reason for hiding this comment

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

LGTM

@jeremyrickard
Copy link
Member

/brig run

@jeremyrickard
Copy link
Member

Thanks for the persistence on this @astrieanna and @youreddy, much appreciated.

@jeremyrickard jeremyrickard merged commit 313847b into cnabio:master Aug 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants