Skip to content

feat(project): create named deployment archives - #1712

Merged
Soner (shyim) merged 2 commits into
mainfrom
feat/deployment-create
Oct 26, 2026
Merged

Soner (shyim) merged 2 commits into
mainfrom
feat/deployment-create

Conversation

@shyim

@shyim Soner (shyim) commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

What changed?

Registers the deploy create command which triggers the interface to create an deployment. For SSH we re-use project ci to create an tar.gz file

Why?

How was this tested?

Related issue or discussion

Summary by CodeRabbit

  • New Features
    • Added project deploy create to create an immutable deployment archive for SSH environments.
    • Choose a custom archive output path and whether to include development dependencies.
    • The deployment command is now available as deploy, with deployment retained as an alias.
  • Bug Fixes
    • Improved error messages when the project path cannot be checked or is not a directory.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 51c35fd1-3534-4523-82b0-bab34148d9ac
📥 Commits

Reviewing files that changed from the base of the PR and between ffb7077 and b5a4f29.

📒 Files selected for processing: 9
  • cmd/project/project_deployment.go
  • cmd/project/project_deployment_backend.go
  • cmd/project/project_deployment_create.go
  • cmd/project/project_deployment_disabled_test.go
  • cmd/project/project_deployment_test.go
  • internal/deployment/deployment.go
  • internal/deployment/factory.go
  • internal/deployment/ssh.go
  • internal/deployment/ssh_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The change adds an SSH deployment backend that creates local project archives and a project deploy create command that reports the resulting deployment reference.

Changes: Deployment archive creation

Layer / File(s) Summary
Deployment backend and archive creation
internal/deployment/*.go
Defines deployment creation options and backend resolution. The SSH backend validates its configuration and creates local archives. Tests cover backend selection, archive output, cancellation, and SSH connection behavior.
Project deploy command
cmd/project/project_deployment.go, cmd/project/project_deployment_create.go, cmd/project/project_deployment_test.go, cmd/project/project_deployment_disabled_test.go
Makes deploy the primary command name and deployment its alias. Adds the create command with output and development-dependency options, reports the deployment reference, and updates command-registration checks.

Priority: Not assessed

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ProjectDeploymentCreateCmd
  participant ResolveBackend
  participant SSH
  participant projectbuild.PackageArchive
  ProjectDeploymentCreateCmd->>ResolveBackend: resolve project backend
  ResolveBackend-->>ProjectDeploymentCreateCmd: return SSH backend
  ProjectDeploymentCreateCmd->>SSH: create deployment with options
  SSH->>projectbuild.PackageArchive: package archive locally
  projectbuild.PackageArchive-->>SSH: return archive reference
  SSH-->>ProjectDeploymentCreateCmd: return deployment reference
Loading
Merge Risk: Minimal · up to a8db2

No actionable merge risk has been established for this change.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the main change, but the required Why, How was this tested?, and Related issue or discussion sections are empty. Add the reason for the change, list the tests and validation commands run, and provide the related issue or discussion. Also correct the grammar in the change summary, such as “an deployment” and “an tar.gz file.”
Docstring Coverage Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: adding named deployment archives through the project deployment feature.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.51724% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.46%. Comparing base (ffb7077) to head (a8db2b1).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
internal/deployment/factory.go 44.44% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1712      +/-   ##
==========================================
- Coverage   66.54%   66.46%   -0.08%     
==========================================
  Files         474      478       +4     
  Lines       32010    32426     +416     
==========================================
+ Hits        21301    21553     +252     
- Misses      10709    10873     +164     
Flag Coverage Δ
go-test 66.46% <65.51%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread cmd/project/project_deployment_create.go Outdated
Comment thread internal/deployment/factory.go
Comment thread cmd/project/project_deployment_backend.go Outdated
Comment thread cmd/project/project_deployment_backend.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is nothing that I saw that blocks this, however some improvements could be considered, see the following report:

1. Earlier archives and local dumps end up in the next deployment. The staging copy takes everything in the checkout except a short fixed list, so local files get shipped. Inherited from #1539, but create is where people will hit it.
Observed: --output ./builds/v1.tar.gz and then ./builds/v2.tar.gz from the project root, v2 (122 MB) contains builds/v1.tar.gz (61 MB). A dump.sql from project dump is in there as well.
Desired: skip archives the command wrote itself and known CLI outputs like dump.sql, or honour .gitignore. A warning would already help.

2. .shopware-cli/deployments is not ignored in existing projects. Only project create puts /.shopware-cli into .gitignore. Shops from composer create-project shopware/production don't have it, and the command writes no ignore file.
Observed: after deploy create, git status shows ?? .shopware-cli/ with a 244 MB tarball inside, git add . stages it.
Desired: write a .gitignore with * into the deployments dir on first use, or a one-time hint.

3. The reference cannot be captured in a script. rollout will consume this value, so CI needs to grab it.
Observed: ref=$(shopware-cli project deploy create -e production) gives 28 lines: the Shopware version banner, the whole asset:install output and at the end Created deployment "name", quoted. Composer already goes to stderr, bin/ci does not.
Desired: only the reference on stdout, unquoted, everything else on stderr like the progress lines from #1718. Or a --format json.

4. Non-ssh environments fail without a hint. Without -e the command targets local, and an ssh: block without type: ssh counts as local too.
Observed: cannot create deployments for environment type "local": deployment not supported, in both cases and also without any config.
Desired: name the environment and the fix, e.g. environment "local" has type "local", deploy create needs an environment with type: ssh (-e <name>).

5. Ctrl+C reads like a build failure. Cleanup is fine, no archive and the temp dir is gone.
Observed: during composer install cannot create deployment archive: build archive: signal: killed, during bin/ci ... failed to warmup container cache (php bin/ci --version): signal: interrupt.
Desired: context canceled or "deployment cancelled, nothing written", like validate after #1718.

6. --output with a directory. The flag takes a file path, but directories are not handled as such.
Observed: an existing directory gives archive output ".../builds" already exists, and --output ./dist/ writes a 244 MB gzip file literally named dist.
Desired: treat a directory as the target folder and generate the name inside it, or reject it with "is a directory".

7. create vs package archive. Both produce the same tar.gz in the same place. create prints only the name and needs an ssh environment, package archive prints the path and takes any environment. deploy --help does not say which one to use.
Observed: Created deployment "lucid-resilient-hawking" vs Created archive ".../lucid-resilient-hawking.tar.gz".
Desired: one sentence in deploy --help on when to use which, and the path in the create output, since there is no rollout yet and people will upload the file by hand.

@shyim
Soner (shyim) merged commit b45daa1 into main Oct 26, 2026
4 of 5 checks passed
@shyim
Soner (shyim) deleted the feat/deployment-create branch October 26, 2026 06:38
@github-actions

Copy link
Copy Markdown
Contributor

Documentation check: no update needed

This PR adds project deploy create (with deploy as the primary name and deployment retained as an alias) plus supporting internal/deployment backend code.

However, the entire deployment/deploy command tree — including this new create subcommand — is gated behind the Go build tag deployment ((go/redacted):build deployment). That tag is only enabled in CI testing (GOFLAGS: -tags=deployment in .github/workflows/go_test.yml); it is not set in .goreleaser.yaml, which builds the binaries that are actually released to users. A companion test (TestDeploymentCommandsDisabled) explicitly asserts these commands must not be registered in normal (non-tagged) builds.

Since this command isn't reachable in any released shopware-cli binary yet, it doesn't currently change documented, user-facing behavior. No change to shopware/docs was made for this PR.

Changed-file category: new internal CLI command + backend code behind an unreleased feature flag (not yet user-facing).

If/when the deployment build tag is enabled for release builds, a docs update for project deploy create (and the deploy/deployment alias) should be added at that time — happy to revisit then. Thanks Soner (@shyim)!

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.

6 participants