Skip to content

Commit

Permalink
occ:app_api:app:deploy - remove -e option (#222)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 authored Feb 2, 2024
1 parent 042b6da commit 6521901
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 23 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [2.x.x - 2024-02-xx]

### Changed

- Removed not needed `-e` parameter for `occ:app_api:app:deploy`. #

## [2.0.3 - 2024-02-01]

### Added
Expand Down
3 changes: 1 addition & 2 deletions docs/ManagingExternalApplications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ There are several commands to work with ExApps:
Deploy
------

Command: ``app_api:app:deploy [--info-xml INFO-XML] [-e|--env ENV] [--] <appid> <daemon-config-name>``
Command: ``app_api:app:deploy [--info-xml INFO-XML] [--] <appid> <daemon-config-name>``

The deploy command is the first ExApp installation step.

Expand All @@ -39,7 +39,6 @@ Options
*******

* ``--info-xml INFO-XML`` **[required]** - path to info.xml file (url or local absolute path)
* ``-e|--env ENV`` *[optional]* - additional environment variables (e.g. ``-e "MY_VAR=123" -e "MY_VAR2=456"``)

Register
--------
Expand Down
3 changes: 1 addition & 2 deletions docs/tech_details/Deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ This can be done by ``occ`` CLI command **app_api:app:deploy**:

.. code-block:: bash
app_api:app:deploy <appid> <daemon-config-name> [--info-xml INFO-XML] [-e|--env ENV] [--]
app_api:app:deploy <appid> <daemon-config-name> [--info-xml INFO-XML] [--]
.. note::
For development this step is skipped, as ExApp is deployed and started manually by developer.
Expand All @@ -85,7 +85,6 @@ Options
*******

* ``--info-xml INFO-XML`` **[required]** - path to info.xml file (url or local absolute path)
* ``-e|--env ENV`` *[optional]* - additional environment variables (e.g. ``-e "MY_VAR=123" -e "MY_VAR2=456"``)

Deploy result JSON
******************
Expand Down
7 changes: 1 addition & 6 deletions lib/Command/ExApp/Deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ protected function configure(): void {
$this->addArgument('daemon-config-name', InputArgument::OPTIONAL);

$this->addOption('info-xml', null, InputOption::VALUE_REQUIRED, '[required] Path to ExApp info.xml file (url or local absolute path)');
$this->addOption('env', 'e', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Docker container environment variables', []);
}

protected function execute(InputInterface $input, OutputInterface $output): int {
Expand Down Expand Up @@ -76,11 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 2;
}

$envParams = $input->getOption('env');

$deployParams = $this->dockerActions->buildDeployParams($daemonConfig, $infoXml, [
'env_options' => $envParams,
]);
$deployParams = $this->dockerActions->buildDeployParams($daemonConfig, $infoXml);

[$pullResult, $createResult, $startResult] = $this->dockerActions->deployExApp($daemonConfig, $deployParams);

Expand Down
12 changes: 2 additions & 10 deletions lib/DeployActions/DockerActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public function buildDeployParams(DaemonConfig $daemonConfig, SimpleXMLElement $
'storage' => $storage,
'system_app' => filter_var((string) $infoXml->xpath('external-app/system')[0], FILTER_VALIDATE_BOOLEAN),
'secret' => $secret ?? $this->random->generate(128),
], $params['env_options'] ?? [], $deployConfig);
], $deployConfig);

$containerParams = [
'name' => $appId,
Expand Down Expand Up @@ -400,7 +400,7 @@ private function extractDeployEnvs(array $envs): array {
return $deployEnvs;
}

public function buildDeployEnvs(array $params, array $envOptions, array $deployConfig): array {
public function buildDeployEnvs(array $params, array $deployConfig): array {
$autoEnvs = [
sprintf('AA_VERSION=%s', $this->appManager->getAppVersion(Application::APP_ID, false)),
sprintf('APP_SECRET=%s', $params['secret']),
Expand All @@ -420,14 +420,6 @@ public function buildDeployEnvs(array $params, array $envOptions, array $deployC
$autoEnvs[] = sprintf('NVIDIA_DRIVER_CAPABILITIES=%s', 'compute,utility');
}

foreach ($envOptions as $envOption) {
[$key, $value] = explode('=', $envOption, 2);
// Do not overwrite required auto generated envs
if (!in_array($key, DockerActions::AE_REQUIRED_ENVS, true)) {
$autoEnvs[] = sprintf('%s=%s', $key, $value);
}
}

return $autoEnvs;
}

Expand Down
3 changes: 1 addition & 2 deletions lib/DeployActions/IDeployActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@ public function buildDeployParams(DaemonConfig $daemonConfig, \SimpleXMLElement
* Build required deploy environment variables
*
* @param array $params
* @param array $envOptions
* @param array $deployConfig
*
* @return mixed
*/
public function buildDeployEnvs(array $params, array $envOptions, array $deployConfig): array;
public function buildDeployEnvs(array $params, array $deployConfig): array;

/**
* Load ExApp information from the target daemon.
Expand Down
2 changes: 1 addition & 1 deletion lib/DeployActions/ManualActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function buildDeployParams(DaemonConfig $daemonConfig, $infoXml, array $p
return null;
}

public function buildDeployEnvs(array $params, array $envOptions, array $deployConfig): array {
public function buildDeployEnvs(array $params, array $deployConfig): array {
// Not implemented. Deploy is done manually.
return [];
}
Expand Down

0 comments on commit 6521901

Please sign in to comment.