Skip to content

refactor: Admin UI Trigger Deploy uses LagoonClientService directly (not Artisan CLI wrapper)#97

Merged
dan2k3k4 merged 2 commits intoadd-trigger-deploy-and-lagoon-commandfrom
copilot/sub-pr-56-again
Mar 16, 2026
Merged

refactor: Admin UI Trigger Deploy uses LagoonClientService directly (not Artisan CLI wrapper)#97
dan2k3k4 merged 2 commits intoadd-trigger-deploy-and-lagoon-commandfrom
copilot/sub-pr-56-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 16, 2026

The Trigger Deploy admin action was calling the polydock:app-instance:trigger-deploy Artisan command via Artisan::call(), obscuring that the mechanism is the Lagoon API — not the CLI. Both the deployment action and the deployment info form section now call LagoonClientService directly.

Changes

ViewPolydockAppInstance.php

  • Action: Replaced Artisan::call('polydock:app-instance:trigger-deploy', ...) with a direct LagoonClientService::getAuthenticatedClient() + deployProjectEnvironmentByName() call
  • Form: Replaced duplicated inline SSH/config setup with LagoonClientService::getLagoonToken() (cached) + buildClientWithToken() — same caching behaviour, no more duplicated config wiring
  • Separate, specific error messages for missing project name vs. missing branch
  • Removed unused imports: Artisan, Client, Ssh

LagoonClientService.php

  • getLagoonToken() promoted from protected to public with an optional $config param (defaults to getClientConfig()) — enables external token caching
  • New buildClientWithToken(array $config, string $token): Client — constructs a configured client from a pre-fetched token; getAuthenticatedClient() now delegates to it
// Before: opaque Artisan indirection
Artisan::call('polydock:app-instance:trigger-deploy', [
    'instance_uuid' => $instanceUuid,
    '--environment' => $environment,
    '--force' => true,
]);

// After: explicit API call via LagoonClientService
$client = app(LagoonClientService::class)->getAuthenticatedClient();
$result = $client->deployProjectEnvironmentByName(
    projectName: $projectName,
    deployBranch: $environment,
);

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…tion

Co-authored-by: dan2k3k4 <158704+dan2k3k4@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on Lagoon Deployments for App Instances refactor: Admin UI Trigger Deploy uses LagoonClientService directly (not Artisan CLI wrapper) Mar 16, 2026
Copilot AI requested a review from dan2k3k4 March 16, 2026 11:46
@dan2k3k4 dan2k3k4 marked this pull request as ready for review March 16, 2026 12:01
@dan2k3k4 dan2k3k4 merged commit 88fc20e into add-trigger-deploy-and-lagoon-command Mar 16, 2026
@dan2k3k4 dan2k3k4 deleted the copilot/sub-pr-56-again branch March 16, 2026 12:02
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.

2 participants