Skip to content

Commit

Permalink
HSD8-1152 Automate content staging (#969)
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish authored Sep 27, 2021
1 parent 2f7139d commit 765ff1a
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 98 deletions.
33 changes: 32 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,24 @@ update_dependencies: &update_dependencies
vendor/bin/blt circleci:update
- save_cache: *save_cache

# Declare all of the jobs we should run.
run-content-stage: &run-content-stage
docker:
- image: cimg/php:7.4
steps:
- checkout
- run: composer install --optimize-autoloader
- *disable_telemetry
- run: vendor/bin/blt stage --no-interaction
- slack/notify:
event: fail
channel: C750VBZCZ
template: basic_fail_1
- slack/notify:
event: pass
channel: C750VBZCZ
template: basic_success_1

# Declare all the jobs we should run.
jobs:
run-updates:
<<: *update_dependencies
Expand All @@ -212,8 +228,12 @@ jobs:
<<: *deploy_branch
run-deploy-tag:
<<: *deploy_tag
run-content-stage:
<<: *run-content-stage

version: 2.1
orbs:
slack: circleci/[email protected]
# Declare a workflow that runs all of our jobs in parallel.
workflows:
version: 2.1
Expand Down Expand Up @@ -260,3 +280,14 @@ workflows:
- /9\..*-release/
jobs:
- run-updates
'Stage Content from Production':
jobs:
- run-content-stage:
context: slack-secrets
triggers:
- schedule:
cron: "0 23 * * 3"
filters:
branches:
only:
- /develop/
11 changes: 10 additions & 1 deletion blt/src/Blt/Plugin/Commands/HsAcquiaApiCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function syncStaging(array $options = [
$this->connectAcquiaApi();

$sites = $this->getSitesToSync($task_started, $options);
if (!$this->confirm(sprintf('Are you sure you wish to stage the following sites: <comment>%s</comment>', implode(', ', $sites)))) {
if (empty($options['no-interaction']) && !$this->confirm(sprintf('Are you sure you wish to stage the following sites: <comment>%s</comment>', implode(', ', $sites)))) {
return;
}
$count = count($sites);
Expand Down Expand Up @@ -243,6 +243,15 @@ protected function getMachineName($message) {
* {@inheritDoc}
*/
protected function connectAcquiaApi() {
$acquia_conf = $_SERVER['HOME'] . '/.acquia/cloud_api.conf';
$key = getenv('ACQUIA_KEY');
$secret = getenv('ACQUIA_SECRET');
if ($key && $secret && !file_exists($acquia_conf)) {
mkdir(dirname($acquia_conf), 0777, TRUE);
$conf = ['key' => $key, 'secret' => $secret];
file_put_contents($acquia_conf, json_encode($conf, JSON_PRETTY_PRINT));
}

if (!$this->acquiaApplications) {
$this->traitConnectAcquiaApi();
}
Expand Down
Loading

0 comments on commit 765ff1a

Please sign in to comment.