-
Couldn't load subscription status.
- Fork 37
feat(cli): extend workflow contract with apply #2469
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
feat(cli): extend workflow contract with apply #2469
Conversation
| # Apply to a specific project | ||
| chainloop workflow contract apply --contract my-contract.yaml --project my-project`, | ||
| PreRunE: func(_ *cobra.Command, _ []string) error { | ||
| if filePath == "" && name == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would make more sense if this validates that either the explicit name or a name in the spec is available, this new helper can probably be made generically as you did in the middleware
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
| } | ||
|
|
||
| // extractContractNameFromContent tries to extract the contract name from the contract file content | ||
| func extractContractNameFromRawSchema(content []byte) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function could be made generically by marshalling to anything with meta and run from cmd as part of the validation as mentioned above.
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
| } | ||
|
|
||
| cmd.Flags().StringVarP(&filePath, "contract", "f", "", "workflow contract file path (optional)") | ||
| cmd.Flags().StringVar(&name, "name", "", "contract name (required if no contract file provided)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't match with the command description nor the examples (Apply a contract from a file. This command will create the contract if it doesn't exist). How would it work then? I would expect that the file was mandatory.
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
|
I've decided to remove support for schema v2 from this PR, all schema v2 related code will be a part of #2467. Here we have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks!
This PR adds apply command that combines create and update functionality into one.
Example