-
Notifications
You must be signed in to change notification settings - Fork 60
[Do not Merge] CLI-1793: Consume Cloud API v3 OpenAPI spec in ACLI #2018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
deepakmishra2
wants to merge
16
commits into
main
Choose a base branch
from
feature/meo-v3-gateway
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c2df57a
CLI-1793: Consume Cloud API v3 OpenAPI spec in ACLI (#2011)
deepakmishra2 201a90f
conflict resolution fix.
deepakmishra2 70dc746
CLI-1827: Automate v3 API spec updates via daily cron PR (#2019)
deepakmishra2 3cb208a
Merge branch 'main' into feature/meo-v3-gateway
deepakmishra2 7744b83
fix: use GH_TOKEN secret for automated spec update PRs
deepakmishra2 4ec1492
Merge branch 'main' into feature/meo-v3-gateway
deepakmishra2 5c26045
chore: update v3 spec URL to mesh endpoint
deepakmishra2 5294a3e
Merge branch 'main' into feature/meo-v3-gateway
deepakmishra2 a114b8c
chore: report initial conflict resolution plan
Copilot a8afcf8
Merge branch 'main' into feature/meo-v3-gateway
Copilot af617af
chore: remove internal mesh URL from automated PR body
deepakmishra2 972ab0b
Merge branch 'main' into feature/meo-v3-gateway
deepakmishra2 94ad2ba
add api:v3 commands in list command.
deepakmishra2 66f9625
CLI-1829: Update v3 spec to canonical staging URL and refresh spec
deepakmishra2 10d1a60
update spec.
deepakmishra2 e7f301e
mutation test fixes.
deepakmishra2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: Update Acquia v3 API spec | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 3 * * *' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| update-spec: | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Install Redocly CLI | ||
| run: npm install -g @redocly/cli@latest | ||
|
|
||
| - name: Download and dereference v3 spec | ||
| run: | | ||
| curl -fsSL https://staging.api.acquia.com/v3/openapi.yaml -o /tmp/acquia-v3-raw.yaml | ||
| redocly bundle --dereferenced /tmp/acquia-v3-raw.yaml -o /tmp/acquia-v3-deref.json | ||
| jq 'del(.paths["/openapi.yaml"])' /tmp/acquia-v3-deref.json > assets/acquia-v3-spec.json | ||
|
|
||
| - name: Check for changes | ||
| id: diff | ||
| run: | | ||
| if git diff --quiet assets/acquia-v3-spec.json; then | ||
| echo "changed=false" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "changed=true" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Create PR if spec changed | ||
| if: steps.diff.outputs.changed == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
| run: | | ||
| BRANCH="automated/update-acquia-v3-spec-${{ github.run_id }}" | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git checkout -b "$BRANCH" | ||
| git add assets/acquia-v3-spec.json | ||
| git commit -m "chore: update Acquia v3 OpenAPI spec" | ||
| git push origin "$BRANCH" | ||
| gh pr create \ | ||
| --title "chore: update Acquia v3 OpenAPI spec" \ | ||
| --body "Automated update of the Acquia v3 OpenAPI spec." \ | ||
| --label "chore" \ | ||
| --base "${{ github.ref_name }}" \ | ||
| --head "$BRANCH" | ||
| gh pr merge "$BRANCH" --auto --squash | ||
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 199d128f014624cedeed3a984d059ee7e064596f |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,6 +87,21 @@ public function getBaseUri(): ?string | |
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * Base URI for Cloud API v3 (MEO) commands registered under `api:v3:*`. | ||
| * Set `ACLI_CLOUD_API_V3_BASE_URI` to point to a specific environment: | ||
| * QA: https://qa.api.acquia.com/v3 | ||
| * Stage: https://staging.api.acquia.com/v3 | ||
| * Prod: TBD — hardcode here once confirmed | ||
|
Comment on lines
+93
to
+95
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be removed once we have the prod url because we will always be pointing this to prod |
||
| */ | ||
| public function getV3BaseUri(): ?string | ||
| { | ||
| if ($uri = getenv('ACLI_CLOUD_API_V3_BASE_URI')) { | ||
| return $uri; | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| public function getAccountsUri(): ?string | ||
| { | ||
| if ($uri = getenv('ACLI_CLOUD_API_ACCOUNTS_URI')) { | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Acquia\Cli\CloudApi; | ||
|
|
||
| use Acquia\Cli\Application; | ||
|
|
||
| /** | ||
| * Client service for Cloud API v3 (MEO) commands. Shares credentials with the | ||
| * v2 ClientService but resolves its base URI via CloudCredentials::getV3BaseUri(), | ||
| * so `ACLI_CLOUD_API_V3_BASE_URI` can point v3 traffic at the dedicated gateway | ||
| * once it exists. Until then, getV3BaseUri() falls back to the v2 URL. | ||
| */ | ||
| class V3ClientService extends ClientService | ||
| { | ||
| public function __construct(ConnectorFactory $connectorFactory, Application $application, CloudCredentials $credentials) | ||
| { | ||
| parent::__construct($connectorFactory, $application, $credentials); | ||
| } | ||
| } |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we had to do this because Spec is not dereferenced and the YAML served has internal $ref entries (e.g. $ref: '#/components/parameters/Failover_Service_API_Offset').