Conversation
Copy source team UUIDs and access levels for same-organization copies, and allow explicit --team UUID=ACCESS_LEVEL assignments on copy and create. Include teams in the initial REST creation request so non-admin users can create pipelines in Teams-enabled organizations. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-0cf40a11-b530-4f27-adf3-ff60561b5fea
Amp-Thread-ID: https://ampcode.com/threads/T-0cf40a11-b530-4f27-adf3-ff60561b5fea Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-0cf40a11-b530-4f27-adf3-ff60561b5fea Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-0cf40a11-b530-4f27-adf3-ff60561b5fea Co-authored-by: Amp <amp@ampcode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
bk pipeline cpcurrently omits team assignments when creating the copy. In organizations with Teams enabled, non-admin users must supply teams at creation time or the API rejects the request with a 422.This adds team assignments to the initial creation request, rather than attempting to attach them afterward. Same-organization copies preserve source teams and access levels by default; users can also select destination teams explicitly by slug.
Changes
--team SLUG=ACCESS_LEVELflags topipeline createandpipeline cp. Supported access levels areread_only,build_and_read, andmanage_build_and_read.read_teamsaccess required). Explicit assignments replace, rather than merge with, source assignments.--team. Cross-organization copies do not inherit teams.Review consideration: automatic same-org copying now requires the token's
graphqlscope, including for dry runs. Lookup failures stop the command before creation and suggest explicit--teamflags, which bypass GraphQL. Create without teams, and cross-org copy without teams, still rely on the API's existing authorization/validation rules.Testing
go test ./...).gofumpt).Runpaths.graphqlscope. No real pipeline creation was attempted.Disclosures / Credits
Amp implemented the code and tests, updated CLI help, ran validation and dry-run demonstrations, and drafted this PR description under the author's direction.