Skip to content
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

Generate alias file #15

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Generate alias file #15

wants to merge 14 commits into from

Conversation

bomoko
Copy link
Contributor

@bomoko bomoko commented Jul 23, 2023

This introduces a command to generate a file of aliases - this is particularly useful when dealing with sites that live on separate clusters when accessing via the ssh-portal

@bomoko
Copy link
Contributor Author

bomoko commented Jul 24, 2023

Thanks @tobybellwood - should all be sorted now


foreach ($response->data->project->environments as $env) {
$details = [
"host" => $env->kubernetes->sshHost,
Copy link
Member

Choose a reason for hiding this comment

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

we need to handle existing deploytargets here that have no specific ssh host set - otherwise they will return null as the host?

I'm just not sure where to read it from - we could fall back to the lagoon aliases (or a hard coded default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tobybellwood - I think that should do it.

@@ -67,11 +77,10 @@ public function __construct() {
// Get default config.
$lagoonyml = $this->getLagoonYml();
$this->api = $lagoonyml['api'] ?? 'https://api.lagoon.amazeeio.cloud/graphql';
Copy link
Member

Choose a reason for hiding this comment

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

to accommodate uselagoon/build-deploy-tool#193

Suggested change
$this->api = $lagoonyml['api'] ?? 'https://api.lagoon.amazeeio.cloud/graphql';
$this->api = getenv('LAGOON_CONFIG_API_HOST') ?? $lagoonyml['api'] ?? 'https://api.lagoon.amazeeio.cloud/graphql';

Comment on lines +21 to +30
/**
* Default ssh host, used for fallback
*/
const DEFAULT_SSH_HOST = 'ssh.lagoon.amazeeio.cloud';

/**
* Default ssh port, used for fallback
*/
const DEFAULT_SSH_PORT = 32222;

Copy link
Member

Choose a reason for hiding this comment

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

we'd ideally make a function here to handle uselagoon/build-deploy-tool#193 and fallback defaults to use in a chained null coalesce as per the api. We can probably assume that the last chance fallback doesn't need to be host and port configurable though?

@tobybellwood
Copy link
Member

also getting failures on drush 12 (but not drush 11) trying to use one of the lg generated aliases

[drupal-seed]cli-drupal:/app$ drush --alias-path /tmp/drush @lagoon-ssh.test1 st
PHP Fatal error:  Uncaught TypeError: Symfony\Component\Process\Process::setTty(): Argument #1 ($tty) must be of type bool, string given, called in /app/vendor/drush/drush/src/Runtime/RedispatchHook.php on line 94 and defined in /app/vendor/symfony/process/Process.php:1016
Stack trace:
#0 /app/vendor/drush/drush/src/Runtime/RedispatchHook.php(94): Symfony\Component\Process\Process->setTty()
#1 /app/vendor/drush/drush/src/Runtime/RedispatchHook.php(66): Drush\Runtime\RedispatchHook->redispatch()
#2 /app/vendor/drush/drush/src/Runtime/RedispatchHook.php(54): Drush\Runtime\RedispatchHook->redispatchIfRemote()
#3 /app/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(44): Drush\Runtime\RedispatchHook->initialize()
#4 /app/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(36): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->doInitializeHook()
#5 /app/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php(29): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook()
#6 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(145): Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize()
#7 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(376): Consolidation\AnnotatedCommand\CommandProcessor->initializeHook()
#8 /app/vendor/symfony/console/Command/Command.php(292): Consolidation\AnnotatedCommand\AnnotatedCommand->initialize()
#9 /app/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run()
#10 /app/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand()
#11 /app/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun()
#12 /app/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
#13 /app/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#14 /app/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
#15 /app/vendor/drush/drush/drush(4): require('...')
#16 /app/vendor/bin/drush(119): include('...')
#17 {main}
  thrown in /app/vendor/symfony/process/Process.php on line 1016
 [warning] Drush command terminated abnormally.

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