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

DB-1369: Added support to specify profile at the time of installation. #432

Merged
merged 1 commit into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Commands/BuildToolsBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,8 @@ protected function doInstallSite(
'account-name' => '',
'account-pass' => '',
'site-mail' => '',
'site-name' => ''
'site-name' => '',
'profile' => ''
],
$app = 'Drupal'
)
Expand Down Expand Up @@ -761,7 +762,7 @@ protected function getInstallCommandTemplate($composer_json, $app)
'wp option update permalink_structure "/%postname%/"',
];
}
return 'drush site-install --yes --account-mail={account-mail} --account-name={account-name} --account-pass={account-pass} --site-mail={site-mail} --site-name={site-name}';
return 'drush site-install {profile} --yes --account-mail={account-mail} --account-name={account-name} --account-pass={account-pass} --site-mail={site-mail} --site-name={site-name}';
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Commands/EnvInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function installSite(
'account-name' => '',
'account-pass' => '',
'site-mail' => '',
'site-name' => ''
'site-name' => '',
'profile' => ''
])
{
if (empty($siteDir)) {
Expand Down
8 changes: 6 additions & 2 deletions src/Commands/ProjectCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public function copyCiFiles($ci_provider, $created_folder, $cms_version, $ci_tem
* @option template-repository Composer repository if package is hosted on a private registry or url to git.
* @option ci-template Git repo that contains the CI scripts that will be copied if there is no ci in the source project.
* @option clu-cron-pattern Specify a cron pattern to override the given CI provider's clu task schedule, if applicable. For example, '0 0 * * 1' to run once a week at midnight on monday.
* @option profile The profile to be used at the time of the installation.
*/
public function createProject(
$source,
Expand All @@ -264,6 +265,7 @@ public function createProject(
'template-repository' => '',
'ci-template' => '[email protected]:pantheon-systems/tbt-ci-templates.git',
'clu-cron-pattern' => '',
'profile' => ''
])
{
$this->warnAboutOldPhp();
Expand All @@ -278,6 +280,7 @@ public function createProject(
$region = $options['region'];
$use_ssh = $options['use-ssh'];
$ci_template = $options['ci-template'];
$profile = $options['profile'];

// Provide default values for other optional variables.
if (empty($label)) {
Expand Down Expand Up @@ -551,7 +554,7 @@ function ($state) use ($site_name, $siteDir, &$prePushTime) {
// Note that this also commits the configuration to the repository.
->progressMessage('Install CMS on Pantheon site {site}', ['site' => $site_name])
->addCode(
function ($state) use ($ci_env, $site_name, $siteDir, &$prePushTime, $app) {
function ($state) use ($ci_env, $site_name, $siteDir, &$prePushTime, $app, $profile) {
if (!$prePushTime) {
$prePushTime = time() - 1800;
}
Expand All @@ -568,7 +571,8 @@ function ($state) use ($ci_env, $site_name, $siteDir, &$prePushTime, $app) {
'account-pass' => $siteAttributes->adminPassword(),
'site-mail' => $siteAttributes->adminEmail(),
'site-name' => $siteAttributes->testSiteName(),
'site-url' => "https://dev-{$site_name}.pantheonsite.io"
'site-url' => "https://dev-{$site_name}.pantheonsite.io",
'profile' => $profile
];
$this->doInstallSite("{$site_name}.dev", $composer_json, $site_install_options, $app);

Expand Down
5 changes: 5 additions & 0 deletions src/ServiceProviders/SiteProviders/PantheonProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,17 @@ public function credentialRequests()
->setValidationErrorMessage(self::PASSWORD_ERROR_MESSAGE)
->setRequired(true);

$siteProfile = (new CredentialRequest('SITE_PROFILE'))
->setOptionKey('profile')
->setRequired(false);

return [
$siteNameRequest,
$testSiteNameRequest,
$gitEmailRequest,
$adminEmailRequest,
$adminPasswordRequest,
$siteProfile
];
}

Expand Down
12 changes: 12 additions & 0 deletions src/ServiceProviders/SiteProviders/SiteEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,16 @@ public function setComposerAuth($composerAuth) {
public function getComposerAuth() {
return $this['COMPOSER_AUTH'];
}

public function siteProfile()
{
return $this['SITE_PROFILE'];
}

public function setSiteProfile($site_profile)
{
$this['SITE_PROFILE'] = $site_profile;
return $this;
}

}