feat: use sdk for reviewapps enable and disable commands - #3897
Open
jdodson wants to merge 1 commit into
Open
Conversation
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
Why:
reviewapps:enableandreviewapps:disableduplicated the logic for looking up a pipeline's GitHub repository across the Platform API, Repositories API, and Kolkrabbi.That logic also had a correctness issue: when the
dashboard-repositories-apiaccount feature returned{enabled: false}, the commands continued without a repository name instead of falling back to the pipeline repository service.Moving repository resolution into
@heroku/sdkgives both commands one consistent implementation while preserving existing command behavior, including flags, output, warnings, and the request body sent when disabling Review Apps.How:
@heroku/sdk@0.6.1.reviewapps:enableandreviewapps:disablewith the SDK.platform.pipeline.info().platform.reviewAppConfig.resolveRepoName().reviewapps:disableby applying it throughplatform.withOptions()before calling the generated DELETE method.reviewapps:disable.V12-CHANGES.md.Type of Change
Breaking Changes (major semver update)
!after your change type to denote a change that breaks current behaviorFeature Additions (minor semver update)
Patch Updates (patch semver update)
Testing
These commands change Review App configuration. Use a disposable app and pipeline rather than production resources.
Prerequisites
heroku auth:whoami)Set unique test values, replacing the repository placeholder:
Setup
Install dependencies and build the CLI:
Confirm authentication:
Create a disposable app and pipeline:
Connect the test GitHub repository:
Test Commands
These manual steps exercise all three migrated live Platform API operations using the SDK's
3.sdkmedia type: enabling without flags validates POST, changing settings validates PATCH, and disabling without flags validates DELETE with the preserved request body. A successfulConfiguring pipeline... doneconfirms that the deployed endpoint accepted the SDK request.Enable Review Apps without changing individual settings:
./bin/run reviewapps:enable --pipeline "$TEST_PIPELINE"Expect
Configuring pipeline... done.Enable all supported settings:
./bin/run reviewapps:enable \ --pipeline "$TEST_PIPELINE" \ --autodeploy \ --autodestroy \ --wait-for-ciExpect messages for enabling auto deployment, auto destroy, and waiting for CI, followed by
Configuring pipeline... done.Disable each setting through the visible flags:
./bin/run reviewapps:disable \ --pipeline "$TEST_PIPELINE" \ --no-autodeploy \ --no-autodestroy \ --no-wait-for-ciExpect messages for disabling all three settings, followed by
Configuring pipeline... done.Verify a hidden positive alias remains backward compatible:
./bin/run reviewapps:disable --pipeline "$TEST_PIPELINE" --autodeployExpect
Disabling auto deployment...followed byConfiguring pipeline... done.Verify the deprecated app warning remains unchanged:
Expect a warning containing
Specifying an app via --app or --remote is no longer needed with Review Appsand a successful configuration result.Disable Review Apps entirely:
./bin/run reviewapps:disable --pipeline "$TEST_PIPELINE"Expect
Configuring pipeline... done. Run this last among the manual command checks so the pipeline is left with Review Apps disabled.Run the automated Review Apps tests:
npx mocha 'test/unit/commands/reviewapps/*.unit.test.ts' --reporter minExpect all Review Apps tests to pass.
Run the focused lint, type, and build checks:
Expect each command to exit successfully without new diagnostics.
Tear Down
Run these steps even if a manual test fails:
Disable Review Apps if they are still enabled:
Destroy the disposable pipeline and app:
Clear the test variables:
unset TEST_ID TEST_APP TEST_PIPELINE TEST_REPOThe disabled-account-feature fallback is covered by the SDK resolver tests because that account feature cannot be safely toggled as part of manual CLI testing.
Screenshots (if applicable)
Related Issues
GUS work item: https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE00002eLUGnYAO/view