Skip to content

Commit

Permalink
feat: support new deployer args
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwwinter committed Jul 11, 2024
1 parent ba836f2 commit be0b5b7
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pr-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
context: ./
file: ./build/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: aamdigital/deployer-ms:pr-${{ github.event.number }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
Expand Down
22 changes: 21 additions & 1 deletion integrations/elementor-plugin/form-actions/aam-deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function get_label() {
/**
* Run action.
*
* Submit the data to
* Submit the data to
*
* @since 1.0.0
* @access public
Expand Down Expand Up @@ -72,7 +72,9 @@ public function run( $record, $ajax_handler ) {
'username' => $fields['username'],
'email' => $fields['email'],
'monitor' => $settings['monitor'] ? True : False,
'sentry' => $settings['sentry'] ? True : False,
'backend' => $settings['backend'] ? True : False,
'queryBackend' => $settings['queryBackend'] ? True : False,
'client' => $settings['client'],
'clientKey' => $settings['client-key'],
'base' => $settings['base'],
Expand Down Expand Up @@ -177,6 +179,15 @@ public function register_settings_section( $widget ) {
]
);

$widget->add_control(
'queryBackend',
[
'label' => esc_html__( 'Add am-backend-services (query-backend)', 'elementor-forms-aam-deploy' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'description' => esc_html__( 'Deploys aam-backend-services (e.g. reports).', 'elementor-forms-aam-deploy' ),
]
);

$widget->add_control(
'monitor',
[
Expand All @@ -186,6 +197,15 @@ public function register_settings_section( $widget ) {
]
);

$widget->add_control(
'sentry',
[
'label' => esc_html__( 'Add sentry monitoring', 'elementor-forms-aam-deploy' ),
'type' => \Elementor\Controls_Manager::SWITCHER,
'description' => esc_html__( 'Adds sentry monitoring for the deployment.', 'elementor-forms-aam-deploy' ),
]
);

$widget->add_control(
'msg_name_exists',
[
Expand Down
8 changes: 5 additions & 3 deletions src/app.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ describe('AppController', () => {
clientKey: 'test-key',
base: 'test-base',
backend: true,
queryBackend: true,
monitor: false,
sentry: false,
};

beforeEach(async () => {
Expand Down Expand Up @@ -174,7 +176,7 @@ describe('AppController', () => {

expect(res).resolves.toBeTruthy();
expect(mockWs.write).toHaveBeenCalledWith(
'test-name de [email protected] test-username test-base y n',
'test-name de [email protected] test-username test-base y y n n',
);
expect(mockWs.close).toHaveBeenCalled();
// Ensure tail is properly "unwatched"
Expand All @@ -185,7 +187,7 @@ describe('AppController', () => {
const emptyLocale = { ...deploymentData, locale: '' };
controller.deployApp(emptyLocale).subscribe(() => {
expect(mockWs.write).toHaveBeenCalledWith(
'test-name en [email protected] test-username test-base y n',
'test-name en [email protected] test-username test-base y y n n',
);
done();
});
Expand All @@ -198,7 +200,7 @@ describe('AppController', () => {
delete noLocale.locale;
controller.deployApp(noLocale).subscribe(() => {
expect(mockWs.write).toHaveBeenCalledWith(
'test-name en [email protected] test-username test-base y n',
'test-name en [email protected] test-username test-base y y n n',
);
done();
});
Expand Down
4 changes: 3 additions & 1 deletion src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export class AppController {
deploymentInfo.email
} ${deploymentInfo.username} ${deploymentInfo.base} ${
deploymentInfo.backend ? 'y' : 'n'
} ${deploymentInfo.monitor ? 'y' : 'n'}`;
} ${deploymentInfo.queryBackend ? 'y' : 'n'} ${
deploymentInfo.monitor ? 'y' : 'n'
} ${deploymentInfo.sentry ? 'y' : 'n'}`;
console.log('args', args);
const ws = fs.createWriteStream('dist/assets/arg-pipe');
ws.write(args);
Expand Down
11 changes: 11 additions & 0 deletions src/deployment-info.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,22 @@ export class DeploymentInfo {
})
backend: boolean;

@ApiProperty({
description:
'Whether the am-backend-services (query-backend) should be set up.',
})
queryBackend = true;

@ApiProperty({
description: 'Whether the new system should be added to uptime monitoring.',
})
monitor: boolean;

@ApiProperty({
description: 'Whether the new system should be added to sentry monitoring.',
})
sentry = true;

@ApiProperty({
description: 'Name of the Keycloak confidential client.',
})
Expand Down

0 comments on commit be0b5b7

Please sign in to comment.