refactor: extract pipeline logic into shared pkg/pipeline package#180
Closed
alexvcodesphere wants to merge 2 commits intocodesphere-cloud:mainfrom
Closed
refactor: extract pipeline logic into shared pkg/pipeline package#180alexvcodesphere wants to merge 2 commits intocodesphere-cloud:mainfrom
alexvcodesphere wants to merge 2 commits intocodesphere-cloud:mainfrom
Conversation
Refactor the standalone gh-action-deploy binary into two layers: - pkg/deploy/: generic, provider-agnostic deployment engine (find, create, update, delete workspace + run pipeline) - cli/cmd/deploy_github.go: GitHub-specific subcommand that reads GitHub Actions env vars and delegates to pkg/deploy New commands: cs deploy - parent command for CI/CD deployments cs deploy github - GitHub Actions integration The generic engine in pkg/deploy/ can be reused by future providers (e.g. cs deploy gitlab). Signed-off-by: Alex <132889147+alexvcodesphere@users.noreply.github.com>
Moves the pipeline polling logic (stage validation, IDE server checks, allRunning, shouldAbort, deploy landscape sync) from cli/cmd/start_pipeline.go into a shared pkg/pipeline package. Both start_pipeline.go and pkg/deploy now use pipeline.Runner, eliminating duplicated and incorrect polling logic. The deploy.Client interface now embeds pipeline.Client for shared pipeline operations (StartPipelineStage, GetPipelineState, DeployLandscape). The pipeline flow is: prepare → test (if present) → sync landscape → run. Signed-off-by: Alex <132889147+alexvcodesphere@users.noreply.github.com>
Member
Author
|
Reorganizing into cleaner PRs |
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.
Summary
Extracts the duplicated pipeline polling logic from
cli/cmd/start_pipeline.gointo a sharedpkg/pipelinepackage. Bothstart_pipeline.goandpkg/deploynow usepipeline.Runner, eliminating duplicated and incorrect polling code.Important
Depends on #178 — merge that first.
Changes
[NEW] pkg/pipeline/pipeline.go— sharedRunner, polling (IDE server checks), stage validation, landscape sync before runcli/cmd/start_pipeline.go— delegates topipeline.Runnercli/cmd/start_pipeline_test.go— updated error assertions +DeployLandscapemockspkg/deploy/deploy.go—Clientembedspipeline.Client,RunPipelineusespipeline.Runnerpkg/deploy/mocks.go— regeneratedPipeline flow
prepare → test (if present) → sync landscape → runTesting
make lint: 0 issuesmake test: all tests pass (69/69)make build: compiles cleanlySigned-off-by: Alex 132889147+alexvcodesphere@users.noreply.github.com