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

api scopes for all build commands #420

Merged
merged 3 commits into from
Jan 21, 2025
Merged

api scopes for all build commands #420

merged 3 commits into from
Jan 21, 2025

Conversation

mcncl
Copy link
Contributor

@mcncl mcncl commented Dec 15, 2024

Changes

  • Introduce a pre-run check for API scope permissions
  • Error where permissions not included with token

Copy link
Contributor

@lizrabuya lizrabuya left a comment

Choose a reason for hiding this comment

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

@mcncl , everything looks good! But is it possible to move the command scope validation into the validation package since it will be reused across different commands?

Copy link
Contributor

@lizrabuya lizrabuya left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -28,6 +29,23 @@ func NewCmdBuildCancel(f *factory.Factory) *cobra.Command {
Long: heredoc.Doc(`
Cancel the given build.
`),
PreRunE: func(cmd *cobra.Command, args []string) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Request to optimise preRun function that appears on several portions in code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! How would you optimise this code? I'm not overly certain on a way to reduce it further

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, the code to check the scope is fine. But maybe move the implementation in one place (like in pkg/cmd/build/build.go) and refer to it in the other subcommands ?

Copy link
Contributor

Choose a reason for hiding this comment

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

hi @mcncl , we can implement this feedback in an enhancement.

Copy link
Contributor

@lizrabuya lizrabuya left a comment

Choose a reason for hiding this comment

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

👍

@mcncl mcncl merged commit ff0665d into main Jan 21, 2025
1 check passed
@mcncl mcncl deleted the bm/build_scopes branch January 21, 2025 01:42
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.

2 participants