Add --app-scope option for variables (legacy)#51
Closed
pjcdawkins wants to merge 2 commits intomainfrom
Closed
Conversation
Adds an `--app-scope` option to `var:create` and `var:update`, allowing variables to be scoped to specific applications within a project. - The option accepts multiple values: `--app-scope app1 --app-scope app2`. - App names are validated against the current deployment when one is available, and validation is skipped for inactive environments without a deployment. - The new `application_scope` property already shows in `variable:get` output without further code changes. Reimplemented from platformsh/legacy-cli#1590 against the 5.x architecture in `legacy/`: the field and `listApps()` helper live in `Service/VariableCommandUtil.php` (the 5.x equivalent of `Command/Variable/VariableCommandBase.php`), and the integration tests were ported to `integration-tests/variable_write_test.go` (replacing the original `go-tests/` location). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds legacy CLI support for scoping project-level variables to specific applications via a new --app-scope option, aligned with the 5.x legacy/ architecture.
Changes:
- Introduces an
application_scopeArrayField (CLI option--app-scope) for variable create/update flows, with validation against deployed app names when available. - Adds deployment-based app-name discovery helper (
listApps()) to support validation and safely skip it when a deployment can’t be determined. - Ports/extends integration coverage in Go to exercise
--app-scope(single, multiple, invalid, and no-deployment scenarios).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
legacy/src/Service/VariableCommandUtil.php |
Adds the new application_scope field and deployment-aware validation helper for --app-scope. |
integration-tests/variable_write_test.go |
Adds integration tests covering var:create/var:update with --app-scope, including validation skip behavior without a deployment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
Author
|
Already included in #19 |
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.
Reimplemented from platformsh/legacy-cli#1590 against the 5.x architecture in
legacy/.Adds
--app-scopetovar:createandvar:update, allowing variables to be scoped to specific applications within a project. The option accepts multiple values (--app-scope app1 --app-scope app2), validates app names against the current deployment when one is available, and skips validation when no deployment exists (e.g. inactive environments). Theapplication_scopeproperty already shows invariable:getoutput without further code changes.The original PR's diff did not apply because:
legacy/tree has noCommand/Variable/VariableCommandBase.php; variable form fields now live inService/VariableCommandUtil::getFields(). The newapplication_scopeArrayFieldwas added there, with the validator using the lazy$getSelection()callable to reach the project/environment.listApps()helper was added as a private method on the same service, calling$this->api->getCurrentDeployment()(now a 2-arg signature in 5.x) and catching exceptions in place of the old "throw=false" flag.go-tests/directory tointegration-tests/variable_write_test.go, usingt.Cleanupand the existingmockapihelpers (SetCurrentDeployment,MakeHALLinks).