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

Add CI/CD Pipeline #1

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open

Conversation

kevasync
Copy link

@kevasync kevasync commented Aug 6, 2021

No description provided.

cdk/bin/api.ts Outdated
@@ -6,12 +6,16 @@ import { VpcStack } from "../lib/vpc-stack";
import { RDSStack } from "../lib/rds-stack";

const app = new cdk.App();
const rdsPasswordArnSsmParamName = "rds-password-secret-arn"
Copy link
Owner

Choose a reason for hiding this comment

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

Ah nice that way we don't need to define it multiple times. Do you mind copying the arn from here https://github.com/austinloveless/awsmug-serverless-graphql-api/blob/master/cdk/lib/api-stack.ts#L22 and added it on line 9

Copy link
Author

Choose a reason for hiding this comment

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

I'm not a big fan of the hard coded arn, also that doesnt work outside of your account

@@ -0,0 +1,11 @@
#!/usr/bin/env node
Copy link
Owner

Choose a reason for hiding this comment

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

Why not add this stack as part of the root api.ts? I think naming is a bit confusing and I will update the file names to be a more vague umbrella, but I think the idea is to have everything specific for this API inside that bin/api.ts file that supports deploying and hosting that service. What are your thoughts

Copy link
Owner

Choose a reason for hiding this comment

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

This also uses a new logical "App()" instead of the existing one.

Copy link
Author

Choose a reason for hiding this comment

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

I'm not running api.ts at all when deploying the pipeline stack

@@ -1,5 +1,7 @@
require("dotenv").config();
Copy link
Owner

Choose a reason for hiding this comment

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

If we're removing the ARN from the file and moving it to the root in bin/api.ts can you remove instances of require("dotenv").config(); and add that to bin/api.ts. It's no longer needed if we're not pulling env variables.


const secretArn = StringParameter.valueForStringParameter(this, props.rdsPwdSecretArnSsmParameterName);
this.rdsPassword = Secret.fromSecretAttributes(this, "rdsPassword", {
secretArn: secretArn
Copy link
Owner

Choose a reason for hiding this comment

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

nitpicky but you can reduce this to just secretArn and remove the key.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah but that hard codes the arn again, which would have to be changed in every account it gets deployed in. Prob best to see if the partial arn search feature of CDK secrets actually works

@@ -38,7 +46,7 @@ export class RDSStack extends Stack {
vpc: props.vpc,
credentials: {
username: this.rdsDbUser,
password: this.secret.secretValue,
password: this.rdsPassword.secretValue,
Copy link
Owner

Choose a reason for hiding this comment

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

does this need .toString() I saw in api-stack.ts it had .secretValue.toString() appended to it?

Copy link
Author

Choose a reason for hiding this comment

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

Nay, the RDS construct takes an ISecret or something, according to the typing on the constructor for RDS. The Lambda constructor takes a string tho, feels like the two teams weren't on the same page.

"@aws-cdk/core": "1.115.0",
"@aws-cdk/core": "^1.115.0",
"@aws-cdk/pipelines": "^1.115.0",
"apollo-server": "^3.1.2",
Copy link
Owner

Choose a reason for hiding this comment

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

I think we can remove all the packages below "@aws-cdk/pipelines": "^1.115.0", I think those are only needed in api/

Copy link
Owner

Choose a reason for hiding this comment

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

oops keep source-map-support though.

Copy link
Owner

Choose a reason for hiding this comment

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

im guessing you had to add those when testing this to get the API to build with all npm packages? I think we can change this to be two pipelines one for API changes and one for cdk changes.

Copy link
Author

Choose a reason for hiding this comment

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

I couldnt get it to build until I added those

Copy link
Author

Choose a reason for hiding this comment

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

it was failing in codebuild FWIW

@kevasync kevasync force-pushed the master branch 3 times, most recently from 5844aca to 313c264 Compare October 6, 2021 17:27
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.

2 participants