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

Simplify CDK templates and avoid VPC lookups during synth step #170

Merged
merged 6 commits into from
Jul 22, 2024

Conversation

pcholakov
Copy link
Contributor

@pcholakov pcholakov commented Jul 22, 2024

With this PR, we're making sure that any test failing causes the entire GitHub workflow to fail fast. Previously, intermediate build failures were not causing the action to report an error.

Secondly, the CDK examples are updated so that they can build on GH without AWS creds; this also serves to make the more general and leaves it up to the user to decide whether to deploy to EC2 (commented out) or target an existing Restate server (either externally managed, or a Restate Cloud environment).

Ideally we should be testing the bun/deno/cloudflare templates with their respective deployment tools but that's outside of the scope of the current PR. I'll submit a separate change to include those in the test checks.

Copy link
Contributor

@slinkydeveloper slinkydeveloper left a comment

Choose a reason for hiding this comment

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

Seems like something fails :)

@pcholakov
Copy link
Contributor Author

You're too quick! ;-) Indeed it does, and that was the intended result! @gvdongen pointed out that the cdk synth test in the Lambda/CDK samples has been quietly failing - I wanted to make sure that the workflow fails before merging the fix.

This change simplifies the CDK examples slightly, making them more general.
A side effect of this is that we no longer require a VPC lookup, which needs
AWS credentials - and was thus previously failing during Unknown command: "build"

To see a list of supported npm commands, run:
  npm help in CI.
@pcholakov pcholakov changed the title CI test scripts should fail when any command fails Simplify CDK templates and avoid VPC lookups during synth step Jul 22, 2024
@pcholakov pcholakov changed the title Simplify CDK templates and avoid VPC lookups during synth step [WIP] Simplify CDK templates and avoid VPC lookups during synth step Jul 22, 2024
@pcholakov pcholakov requested a review from gvdongen July 22, 2024 12:54
@pcholakov pcholakov changed the title [WIP] Simplify CDK templates and avoid VPC lookups during synth step Simplify CDK templates and avoid VPC lookups during synth step Jul 22, 2024
@@ -12,7 +14,7 @@ npm_install_check $PROJECT_ROOT/basics/basics-typescript
npm_install_check $PROJECT_ROOT/templates/typescript
npm_install_check $PROJECT_ROOT/templates/typescript-lambda-cdk
npm_install_check $PROJECT_ROOT/templates/cloudflare-worker
npm_install_check $PROJECT_ROOT/templates/bun
#npm_install_check $PROJECT_ROOT/templates/bun
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll re-enable this in a follow-up PR, once I add a suitable bun-specific test.

@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -eufx -o pipefail
Copy link
Contributor Author

Choose a reason for hiding this comment

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

set -e is the crucial part - without it intermediate tests can be failing arbitrarily, and won't cause the overall workflow to fail!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this also makes remembering to the explicitly || exit all the tests redundant.

Copy link
Collaborator

@gvdongen gvdongen 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 jumping on this so quickly. A few things were commented out but not removed. Not sure if that was intentional. Besides that LGTM.

@@ -12,7 +14,7 @@ npm_install_check $PROJECT_ROOT/basics/basics-typescript
npm_install_check $PROJECT_ROOT/templates/typescript
npm_install_check $PROJECT_ROOT/templates/typescript-lambda-cdk
npm_install_check $PROJECT_ROOT/templates/cloudflare-worker
npm_install_check $PROJECT_ROOT/templates/bun
#npm_install_check $PROJECT_ROOT/templates/bun
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to be commented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it does because there's no "build" target there - fixed in #172 :-)

deployer.deployService("Greeter", greeter.currentVersion, restateEnvironment, {
insecure: true, // self-signed certificate
// insecure: true, // accept self-signed certificate for SingleNodeRestateDeployment
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we remove this if it's commented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to leave it in, in case someone uncomments the restate. restate.SingleNodeRestateDeployment(...) construct above which needs this. If we remove it, someone might lose a bunch of time troubleshooting why this fails with the self-hosted EC2 option. Open to removing both if you think it's cleaner?

This really should go away in the long run but I didn't want to open a non-TLS listener over the internet in the restate.SingleNodeRestateDeployment construct.

@@ -75,9 +62,10 @@ export class LambdaTsCdkStack extends cdk.Stack {
});

deployer.deployService("Greeter", greeter.currentVersion, restateEnvironment, {
insecure: true, // self-signed certificate
// insecure: true, // accept self-signed certificate for SingleNodeRestateDeployment
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we remove this if it's commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above :-)

@pcholakov pcholakov merged commit 863bc79 into main Jul 22, 2024
2 checks passed
@pcholakov pcholakov deleted the update-cdk-examples branch July 22, 2024 16:25
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.

3 participants