Skip to content

feat: support multi-step deployment hooks in project config schema#1109

Merged
Soner (shyim) merged 2 commits into
mainfrom
feat/deployment-hooks-multi-step
Jun 18, 2026
Merged

feat: support multi-step deployment hooks in project config schema#1109
Soner (shyim) merged 2 commits into
mainfrom
feat/deployment-hooks-multi-step

Conversation

@shyim

Copy link
Copy Markdown
Member

What

Update the .shopware-project.yml config schema so deployment hooks (pre, post, pre-install, post-install, pre-update, post-update) accept both the existing single-script form and the new multi-step form.

Why

The deployment-helper now allows a hook to be defined as a list of titled steps that are executed individually, for clearer per-step output. This PR keeps shopware-cli's schema and config parsing in sync so the new form validates in editors and doesn't break ReadConfig.

Companion to shopware/deployment-helper#89.

Supported forms

deployment:
  hooks:
    # old: single script (unchanged)
    pre: |
      echo "Before deployment"

    # new: list of titled steps
    post:
      - title: Warm up the cache
        script: |
          bin/console cache:warmup
      - title: Notify the team
        script: ./notify.sh

    # new: shorthand list of script strings (untitled steps)
    pre-update:
      - echo "first"
      - echo "second"

How

  • New ConfigDeploymentHook / ConfigDeploymentHookStep types in internal/shop/config.go.
    • UnmarshalYAML accepts a string, a list of {title, script} objects, or a shorthand list of script strings; errors on anything else. This matters because ReadConfig unmarshals the project config, so a plain string field would fail on the new list form.
    • JSONSchema() emits oneOf: [string, array<oneOf: [string, {title, script}]>], mirroring the existing custom-schema pattern used by ConfigDeploymentOverrides.
  • Regenerated internal/shop/config_schema.json via scripts/schema.go.

Backwards compatibility

Fully backwards compatible — string hooks parse and validate exactly as before.

Testing

  • New internal/shop/config_hook_test.go covers string, empty string, step list, string-list shorthand, and the invalid case.
  • go test ./internal/shop/, go vet, and gofmt all clean. Schema regeneration is stable.

Deployment hooks (pre, post, pre-install, post-install, pre-update,
post-update) previously accepted only a single script string. They can
now also be defined as a list of steps, each either a plain script
string or a { title, script } object, matching the new format in the
deployment-helper.

- Introduce ConfigDeploymentHook / ConfigDeploymentHookStep types with a
  custom UnmarshalYAML that accepts a string, a list of step objects, or
  a shorthand list of script strings (and errors on anything else).
- Add a JSONSchema() method emitting oneOf[string, array] so editor
  validation accepts both the old and new forms.
- Regenerate internal/shop/config_schema.json.

Companion to shopware/deployment-helper#89.
@github-code-quality

github-code-quality Bot commented Jun 18, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: Go

Go / code-coverage/go-test

The overall coverage in the branch remains at 54%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File 53c2ec3 01f4248 +/-
internal/shop/config.go 68% 62% -6%

Updated June 18, 2026 04:47 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 132cc242b4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread internal/shop/config.go
@shyim Soner (shyim) merged commit ebcf20e into main Jun 18, 2026
5 checks passed
@shyim Soner (shyim) deleted the feat/deployment-hooks-multi-step branch June 18, 2026 06:43
Su (sushmangupta) added a commit to shopware/docs that referenced this pull request Jun 18, 2026
* docs: document multi-step deployment hooks

Deployment hooks can now be defined as a list of steps, each either a
{ title, script } object or a plain script string, in addition to the
existing single-script form. Document both forms in the Deployment
Helper configuration guide.

Companion to shopware/deployment-helper#89 and shopware/shopware-cli#1109.

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Su <112690947+sushmangupta@users.noreply.github.com>
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.

1 participant