Skip to content

(CDPE-4754) Migrate create_git_branch to V1 endpoint#75

Merged
Magisus merged 2 commits into
mainfrom
CDPE-4754/v1-create-git-branch
Jun 8, 2026
Merged

(CDPE-4754) Migrate create_git_branch to V1 endpoint#75
Magisus merged 2 commits into
mainfrom
CDPE-4754/v1-create-git-branch

Conversation

@Magisus

@Magisus Magisus commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Switches cd4pe_deployments::create_git_branch to call the new V1 endpoint POST /v1/deployments/{id}:create-git-branch instead of the legacy AJAX op=CreateGitBranch.
  • Maps V1 error bodies (which use BaseErrorV1 shape: {message, traceId, uriPath}) into the existing function-result error format consumed by Bolt plans.
  • Fixes a pre-existing missing comma in the Net::HTTPServerError raise.
  • Rewrites the spec to stub the V1 endpoint, asserts 204 → success, 4xx → mapped error, 5xx → `Puppet::Error`.

Dependency

This depends on the matching PipelinesInfra change that adds the V1 endpoint. Ship them together — until the PipelinesInfra side lands, this client will get 404s.

PipelinesInfra PR: https://github.com/puppetlabs/PipelinesInfra/pull/5155

Test plan

  • bundle exec rspec spec/functions/cd4pe/create_git_branch_spec.rb — 5 examples, 0 failures
  • Integration: run a real CD4PE deployment exercising the function (rolling / eventual_consistency / feature_branch plan) against a PE backend built from the PipelinesInfra PR

🤖 Generated with Claude Code

@Magisus Magisus requested a review from a team as a code owner May 23, 2026 01:14
@Magisus Magisus force-pushed the CDPE-4754/v1-create-git-branch branch from c007ee1 to 2d6c76f Compare June 5, 2026 19:40
Magisus and others added 2 commits June 5, 2026 12:52
Ruby client now POSTs to /api/v1/deployments/{id}:create-git-branch with
workspaceId as a query param. Puppet function handles 204 No Content and
maps V1 error bodies (which carry message/traceId/uriPath rather than the
legacy {error: {message, code}} shape) into the function-result format
the Bolt plans already consume.

Also fixes a pre-existing missing comma in the Net::HTTPServerError raise.

The corresponding V1 endpoint in PipelinesInfra is added in CDPE-4754
PR (puppetlabs/PipelinesInfra). Until that lands, this client method
will return 404. Ship them together.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Stubs the new V1 path with workspaceId query param. Asserts the V1
return shape: 204 maps to {'result' => 'success'}, 4xx maps the V1
error body's message to the function-result error shape, and 5xx
raises Puppet::Error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Magisus Magisus force-pushed the CDPE-4754/v1-create-git-branch branch from 2d6c76f to 8c6bc9c Compare June 5, 2026 19:52
@Magisus

Magisus commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Manually tested this using the local checkout of cd4pe_deployments, with the app running from source, HEAD of main. Everything looks good 👍

@Magisus Magisus merged commit b53eab4 into main Jun 8, 2026
3 checks passed
@Magisus Magisus deleted the CDPE-4754/v1-create-git-branch branch June 8, 2026 16:15
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