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

Use aws-codedeploy-hook. Remove preHook.ts and postHook.ts #1644

Merged
merged 6 commits into from
Sep 3, 2024

Conversation

aurelius0523
Copy link
Contributor

@aurelius0523 aurelius0523 commented Aug 31, 2024

Overview

Use aws-codeploy-hooks and remove existing codedeploy code. Resolves #1640

Note

I am unsure if this approach should be used to replace current implementation in skuba. skuba currently creates pre and post hooks that are not account-global which would allow the template consumer to do more specific smoke tests like checking for existence of a dynamodb table.

By using aws-codedeploy-hooks as it is now we lose that ability. Happy to iterate aws-codedeploy-hooks to support that or update this PR if I am just missing how to do that

@aurelius0523 aurelius0523 requested a review from a team as a code owner August 31, 2024 09:09
Copy link

changeset-bot bot commented Aug 31, 2024

🦋 Changeset detected

Latest commit: 49d7a55

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@AaronMoat AaronMoat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this one!

Any chance you could add a changeset?

which would allow the template consumer to do more specific smoke tests like checking for existence of a dynamodb table.

To your note on this, the idea of these pre-hooks is that they don't contain the logic themselves, but instead ask the lambda function being deployed to check. If you wanted to ensure dynamodb existence, that could be part of the worker's smokeTest function.

template/lambda-sqs-worker-cdk/infra/appStack.ts Outdated Show resolved Hide resolved
@@ -15,3 +16,11 @@ new AppStack(app, 'appStack', {
// 'seek:system:name': 'TODO: add system name',
},
});

// eslint-disable-next-line no-new
const hookStack = new HookStack(app, 'hookStack');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting one; if we're recommending deploying per-application, it probably needs a unique stack name / function names / etc baked in. I'm unsure on the best approach here!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's normally a from function you can use to reference existing resources but not sure that solves where the hooks are deployed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which function name are you referring to? Even if we allow HookStack to be created with different stack name (it is now hardcoded to aws-codedeploy-hooks), it will still fail if we try to deploy multiple HookStacks because lambda names are not unique. I feel like I am missing something here

Also, sorry that I am commenting after work hours, please enjoy your evening! 😄

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, those two functions.

I'm wondering if we could consider merging this as-is (for this thread anyway), with a comment like

// TODO: If deploying multiple stacks in one AWS account, deploy HookStack centrally rather than here

(Somewhat per @72636c's comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just purely because it reduces the complexity of the template I'm happy to merge as is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AaronMoat, @samchungy. I have added that comment and also created a changeset. Using changeset for the first time. Let me know if I am not doing that right

Copy link
Contributor

@AaronMoat AaronMoat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! @samchungy @72636c might be worth a look from you as well

.changeset/shiny-parents-sit.md Outdated Show resolved Hide resolved
Co-authored-by: Aaron Moat <2937187+AaronMoat@users.noreply.github.com>
Copy link
Contributor

@AaronMoat AaronMoat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should get formatting happy

.changeset/shiny-parents-sit.md Outdated Show resolved Hide resolved
template/lambda-sqs-worker-cdk/infra/index.ts Outdated Show resolved Hide resolved
template/lambda-sqs-worker-cdk/infra/appStack.ts Outdated Show resolved Hide resolved
Co-authored-by: Aaron Moat <2937187+AaronMoat@users.noreply.github.com>
@AaronMoat
Copy link
Contributor

Gonna force merge and hope for the best 🙈

@AaronMoat AaronMoat merged commit 2cc0adc into seek-oss:main Sep 3, 2024
9 of 11 checks passed
@seek-oss-ci seek-oss-ci mentioned this pull request Sep 2, 2024
@AaronMoat AaronMoat mentioned this pull request Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lambda-sqs-worker-cdk: use aws-codedeploy-hooks
3 participants