Skip to content

Commit f2ee99b

Browse files
authored
VACMS-6434: Vets-website content release integration (#15523)
* VACMS-6434: Vets-website content release integration * Missed a method :( * Checkout vets-website. * Set `va_gov_vets_website_root` correctly on Tugboat. * A lot of stuff. * Fix remove-git-dirs.sh * Make -or a little clearer. * Tweak tests. * Fix status block. * Fix a couple fails. * Fix Tugboat path. * Buncha crap. * Fix some tests. * Kinda confused tbh. * Update Drush commands. * Improve function name and URL construction for build log link. * Tweaks to tests, forms, and content release status block. * Simplify selection a bit. * Remove code tags. * Refine logging a bit for clarity. * Fix typo in commands 😑 * Clarifying comments for log.
1 parent 37e4a0d commit f2ee99b

File tree

78 files changed

+1702
-969
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1702
-969
lines changed

READMES/drush.md

+21-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ See [SiteStatusCommands.php](../docroot/modules/custom/va_gov_build_trigger/src/
1414

1515
### Content Release
1616

17+
There is a gradual migration taking place from the existing system to a refactored version intended to decouple behavior from environment, accomodate multiple frontends, etc.
18+
19+
#### Current
20+
21+
The current system's commands mostly relate to continuous builds and management of the content release state machine:
22+
1723
See [ContentReleaseCommands.php](../docroot/modules/custom/va_gov_build_trigger/src/Commands/ContentReleaseCommands.php).
1824

1925
- `va-gov:content-release:advance-state` -- Advance the state like an external system would do through HTTP.
@@ -22,19 +28,32 @@ See [ContentReleaseCommands.php](../docroot/modules/custom/va_gov_build_trigger/
2228
- `va-gov:content-release:get-frontend-version` -- Get the frontend version that was requested by the user.
2329
- `va-gov:content-release:get-state` -- Get the current release state.
2430
- `va-gov:content-release:is-continuous-release-enabled` -- Check continuous release state.
25-
- `va-gov:content-release:request-frontend-build` -- Request a frontend build (but do not initiate it).
2631
- `va-gov:content-release:reset-frontend-version` -- Reset the content release frontend version.
2732
- `va-gov:content-release:reset-state` -- Reset the content release state.
2833
- `va-gov:content-release:toggle-continuous` -- Toggle continuous release.
2934

35+
#### New
36+
37+
Housed in the new system:
38+
39+
See [RequestCommands.php](../docroot/modules/custom/va_gov_content_release/src/Commands/RequestCommands.php).
40+
41+
- `va-gov-content-release:request:submit` -- Request a frontend build (but do not initiate it).
42+
43+
See [FrontendVersionCommands.php](../docroot/modules/custom/va_gov_content_release/src/Commands/FrontendVersionCommands.php).
44+
45+
- `va-gov-content-release:frontend-version:get` -- Get the currently selected version of the selected frontend (defaults to `content_build`).
46+
- `va-gov-content-release:frontend-version:reset` -- Reset (to default, or `main`) the currently selected version of the selected frontend (defaults to `content_build`).
47+
- `va-gov-content-release:frontend-version:set` -- Set the currently selected version of the selected frontend (defaults to `content_build`).
48+
3049
### Metrics
3150

3251
See [MetricsCommands.php](../docroot/modules/custom/va_gov_backend/src/Commands/MetricsCommands.php).
3352

3453
- `va-gov:metrics:send` -- Send various application metrics to DataDog.
3554

36-
3755
### Outdated Content
56+
3857
See
3958
[CMS Notification System](https://github.com/department-of-veterans-affairs/va.gov-cms/tree/main/docroot/modules/custom/va_gov_notifications/README.md) for commands to test or
4059
execute the various outdated content sends.

cypress.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const path = require("path");
1313
// This function is called when a project is opened or re-opened (e.g. due to
1414
// the project's config changing)
1515

16-
const BASE_URL = "http://va-gov-cms.ddev.site";
16+
const BASE_URL = process.env.BASE_URL || "https://va-gov-cms.ddev.site";
1717

1818
async function setupNodeEvents(on, config) {
1919
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,

docroot/modules/custom/va_gov_build_trigger/css/build_trigger_form.css

-42
This file was deleted.

docroot/modules/custom/va_gov_build_trigger/drush.services.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
arguments:
1010
- '@va_gov_build_trigger.release_state_manager'
1111
- '@va_gov_build_trigger.build_scheduler'
12-
- '@va_gov_build_trigger.build_requester'
12+
- '@va_gov_content_release.request'
1313
- '@state'
1414
- '@logger.factory'
1515
tags:

docroot/modules/custom/va_gov_build_trigger/js/content_release_status_block.es6.js

-23
This file was deleted.

docroot/modules/custom/va_gov_build_trigger/js/content_release_status_block.js

-22
This file was deleted.

docroot/modules/custom/va_gov_build_trigger/src/Commands/ContentReleaseCommands.php

+12-49
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
use Drupal\Core\State\StateInterface;
77
use Drupal\va_gov_build_trigger\Controller\ContentReleaseNotificationController;
88
use Drupal\va_gov_build_trigger\EventSubscriber\ContinuousReleaseSubscriber;
9-
use Drupal\va_gov_build_trigger\Service\BuildRequester;
10-
use Drupal\va_gov_build_trigger\Service\BuildRequesterInterface;
119
use Drupal\va_gov_build_trigger\Service\BuildSchedulerInterface;
1210
use Drupal\va_gov_build_trigger\Service\ReleaseStateManager;
1311
use Drupal\va_gov_build_trigger\Service\ReleaseStateManagerInterface;
12+
use Drupal\va_gov_content_release\Request\RequestInterface;
1413
use Drush\Commands\DrushCommands;
1514

1615
/**
@@ -25,18 +24,18 @@ class ContentReleaseCommands extends DrushCommands {
2524
protected $releaseStateManager;
2625

2726
/**
28-
* The build requester service.
27+
* The build scheduler service.
2928
*
30-
* @var \Drupal\va_gov_build_trigger\Service\BuildRequesterInterface
29+
* @var \Drupal\va_gov_build_trigger\Service\BuildSchedulerInterface
3130
*/
32-
protected $buildRequester;
31+
protected $buildScheduler;
3332

3433
/**
35-
* The build scheduler service.
34+
* The content release request service.
3635
*
37-
* @var \Drupal\va_gov_build_trigger\Service\BuildSchedulerInterface
36+
* @var \Drupal\va_gov_content_release\Request\RequestInterface
3837
*/
39-
protected $buildScheduler;
38+
protected $requestService;
4039

4140
/**
4241
* The state management service.
@@ -59,8 +58,8 @@ class ContentReleaseCommands extends DrushCommands {
5958
* The release state manager service.
6059
* @param \Drupal\va_gov_build_trigger\Service\BuildSchedulerInterface $buildScheduler
6160
* The build scheduler service.
62-
* @param \Drupal\va_gov_build_trigger\Service\BuildRequesterInterface $buildRequester
63-
* The build requester service.
61+
* @param \Drupal\va_gov_content_release\Request\RequestInterface $requestService
62+
* The request service.
6463
* @param \Drupal\Core\State\StateInterface $state
6564
* The state service.
6665
* @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $loggerChannelFactory
@@ -69,13 +68,13 @@ class ContentReleaseCommands extends DrushCommands {
6968
public function __construct(
7069
ReleaseStateManagerInterface $releaseStateManager,
7170
BuildSchedulerInterface $buildScheduler,
72-
BuildRequesterInterface $buildRequester,
71+
RequestInterface $requestService,
7372
StateInterface $state,
7473
LoggerChannelFactoryInterface $loggerChannelFactory
7574
) {
7675
$this->releaseStateManager = $releaseStateManager;
7776
$this->buildScheduler = $buildScheduler;
78-
$this->buildRequester = $buildRequester;
77+
$this->requestService = $requestService;
7978
$this->state = $state;
8079
$this->logger = $loggerChannelFactory->get('va_gov_build_trigger');
8180
}
@@ -91,19 +90,6 @@ public function resetState() {
9190
$this->logger()->info('Content release state has been reset to \'ready\'.');
9291
}
9392

94-
/**
95-
* Reset the content release frontend version.
96-
*
97-
* @command va-gov:content-release:reset-frontend-version
98-
* @aliases va-gov-content-release-reset-frontend-version
99-
*/
100-
public function resetFrontendVersion() {
101-
$this->state->delete(BuildRequester::VA_GOV_FRONTEND_VERSION);
102-
$this->logger()->info('Content release state has been reset to @state.', [
103-
'@state' => ReleaseStateManager::STATE_DEFAULT,
104-
]);
105-
}
106-
10793
/**
10894
* Advance the state like an external system would do through HTTP.
10995
*
@@ -131,17 +117,6 @@ public function advanceState($state) {
131117
]);
132118
}
133119

134-
/**
135-
* Get the frontend version that was requested by the user.
136-
*
137-
* @command va-gov:content-release:get-frontend-version
138-
* @aliases va-gov-content-release-get-frontend-version
139-
*/
140-
public function getFrontendVersion() {
141-
$state = $this->state->get(BuildRequester::VA_GOV_FRONTEND_VERSION, '__default');
142-
$this->io()->write($state);
143-
}
144-
145120
/**
146121
* Get the current release state.
147122
*
@@ -153,18 +128,6 @@ public function getReleaseState() {
153128
$this->io()->write($state);
154129
}
155130

156-
/**
157-
* Request a frontend build (but do not initiate it).
158-
*
159-
* @command va-gov:content-release:request-frontend-build
160-
* @aliases va-gov-content-release-request-frontend-build
161-
*/
162-
public function requestFrontendBuild() {
163-
$this->buildRequester->resetFrontendVersion();
164-
$this->buildRequester->requestFrontendBuild('Build requested via Drush.');
165-
$this->io()->writeln('Frontend build has been requested');
166-
}
167-
168131
/**
169132
* Make sure builds are going out at least hourly during business hours.
170133
*
@@ -184,7 +147,7 @@ public function checkScheduledBuild() {
184147
public function checkStale() {
185148
if ($this->releaseStateManager->releaseStateIsStale()) {
186149
$this->resetState();
187-
$this->requestFrontendBuild();
150+
$this->requestService->submitRequest('Submitting new request due to staleness.');
188151
}
189152
}
190153

docroot/modules/custom/va_gov_build_trigger/src/Controller/ContentReleaseRequestController.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace Drupal\va_gov_build_trigger\Controller;
44

55
use Drupal\Core\Controller\ControllerBase;
6+
use Drupal\va_gov_content_release\Request\RequestInterface;
67
use Symfony\Component\DependencyInjection\ContainerInterface;
7-
use Symfony\Component\HttpFoundation\Response;
8-
use Drupal\va_gov_build_trigger\Service\BuildRequesterInterface;
98
use Symfony\Component\HttpFoundation\RequestStack;
9+
use Symfony\Component\HttpFoundation\Response;
1010
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1111

1212
/**
@@ -15,11 +15,11 @@
1515
class ContentReleaseRequestController extends ControllerBase {
1616

1717
/**
18-
* The release state manager.
18+
* The request service.
1919
*
20-
* @var \Drupal\va_gov_build_trigger\Service\BuildRequesterInterface
20+
* @var \Drupal\va_gov_content_release\Request\RequestInterface
2121
*/
22-
protected $buildRequester;
22+
protected $requestService;
2323

2424
/**
2525
* The current request stack.
@@ -31,13 +31,13 @@ class ContentReleaseRequestController extends ControllerBase {
3131
/**
3232
* Constructor for the content release request controller.
3333
*
34-
* @param \Drupal\va_gov_build_trigger\Service\BuildRequesterInterface $buildRequester
34+
* @param \Drupal\va_gov_content_release\Request\RequestInterface $requestService
3535
* The build requester service.
3636
* @param \Symfony\Component\HttpFoundation\RequestStack $requestStack
3737
* The current request stack.
3838
*/
39-
public function __construct(BuildRequesterInterface $buildRequester, RequestStack $requestStack) {
40-
$this->buildRequester = $buildRequester;
39+
public function __construct(RequestInterface $requestService, RequestStack $requestStack) {
40+
$this->requestService = $requestService;
4141
$this->requestStack = $requestStack;
4242
}
4343

@@ -46,7 +46,7 @@ public function __construct(BuildRequesterInterface $buildRequester, RequestStac
4646
*/
4747
public static function create(ContainerInterface $container) {
4848
return new static(
49-
$container->get('va_gov_build_trigger.build_requester'),
49+
$container->get('va_gov_content_release.request'),
5050
$container->get('request_stack')
5151
);
5252
}
@@ -63,7 +63,7 @@ public function requestBuild() {
6363
throw new BadRequestHttpException('Must provide a reason for requesting a frontend build.');
6464
}
6565

66-
$this->buildRequester->requestFrontendBuild($reason);
66+
$this->requestService->submitRequest($reason);
6767

6868
return new Response('Build requested.');
6969
}

0 commit comments

Comments
 (0)