aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.57k stars 3.88k forks source link

Automatically push updated snapshots for PRs #23759

Open PatMyron opened 1 year ago

PatMyron commented 1 year ago

Describe the feature

Small CDK contributions would be much easier if a Github action could run cdk-integ --dry-run and push updated snapshots, especially for PRs that are only failing those

Use Case

I mostly send drive-by PRs and haven't been able to get CDK building in Gitpod lately: https://github.com/aws/aws-cdk/pull/21914

Even when I had CDK building successfully in Gitpod, it took hours to spin up the environment on Gitpod, build everything, and figure out Github auth in Gitpod

skinny85 commented 1 year ago

Hey Pat! Not saying this is a bad idea, but I want to specifically focus on the Gitpod parts:

Even when I had CDK building successfully in Gitpod, it took hours to spin up the environment on Gitpod, build everything, and figure out Github auth in Gitpod

This is interesting, because:

  1. CDK should be running pre-builds, meaning your Gitpod environment should be ready to go the moment you create it, no waiting required.
  2. Gitpod integrates with GitHub, so no auth setup should be needed - you should be allowed to push to your fork without any issues.

Is either (or both) of those things not working currently?

PatMyron commented 1 year ago

1) Believe it's pre-built if you have a recently active Gitpod workspace for the project, which I never have: https://www.gitpod.io/docs/introduction/learn-gitpod/the-life-of-a-workspace or if you're part of a Gitpod team with a Gitpod project set up, which requires repo permissions: https://www.gitpod.io/docs/configure/projects/prebuilds so it takes hours to build for me: https://github.com/aws/aws-cdk/pull/7987#discussion_r426135140

2) To clarify, Gitpod Github auth isn't specific to CDK either. I had just only used Gitpod for small changes before and never bothered to properly authenticate, but the amount of snapshot changes are too much to copy-paste out of Gitpod instead of properly git pushing 🙈


All of the above is inconvenient but surmountable after a few hours; my main issue is that I often can't get the whole CDK to build after that time/effort. I think it'd be simpler to automate this for everyone making simple contributions

gricey432 commented 1 year ago

I want to echo what @PatMyron said, I've tried to use gitpod for the integration tests a few times and every time it takes most of an hour to do the setup. Usually I end up tabbing away and then when I come back it's been suspended due to inactivity. It's a frustrating experience, especially knowing it could be solved by automation.

pahud commented 1 year ago

Hi @PatMyron @gricey432

I think aws-cdk has enabled the pre-build since Nov 2022. https://github.com/aws/aws-cdk/discussions/23118

What made you think the pre-build is not enabled?

PatMyron commented 1 year ago

Adam asked that last month, here's that part of my reply again:

  1. Believe it's pre-built if you have a recently active Gitpod workspace for the project, which I never have: https://www.gitpod.io/docs/introduction/learn-gitpod/the-life-of-a-workspace or if you're part of a Gitpod team with a Gitpod project set up, which requires repo permissions: https://www.gitpod.io/docs/configure/projects/prebuilds so it takes hours to build for me

tl;dr pre-builds for CDK team but not us

pahud commented 1 year ago

Hi @PatMyron

aws-cdk has configured gitpod to prebuild all PR branches, which means if you submit a PR draft, this PR branch will be prebuilt and you don't have to have an active Gitpod workspace for aws-cdk or be part of a Gitpod team.

Can you just submit a PR draft and see if the prebuild works? I personally use gitpod literally everyday and we really care about the prebuild experience. Let me know if it works with you.

btw, we recently have some udpates on the contributing guide including gitpod improvement and it's potentially saving up to 21 minutes from the prebuild. Please check it out and let me know what's still missing.

https://github.com/aws/aws-cdk/pull/25245 https://github.com/aws/aws-cdk/pull/25299 https://github.com/aws/aws-cdk/pull/25321 https://github.com/aws/aws-cdk/pull/25361

github-actions[bot] commented 1 year ago

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

PatMyron commented 1 year ago

@pahud took time to figure out Gitpod's new billing dark pattern (Gitpod now creates personal "organizations" with no credits and prompts to buy credits; free personal usage only resumed after deleting that new personal "organization"). After sorting that out, prebuild failed the aws-cdk-lib:build target (potentially because of my changes?)

Instead of detouring to improving Gitpod experiences, I'd still prefer not dealing with Gitpod and having updated snapshots pushed automatically since I'm just trying to make tiny contributions without spending hours fixing snapshots

PatMyron commented 9 months ago

@guyernest ran into similar frustrations with other boilerplate commands like linting/formatting: https://github.com/aws/aws-cdk/pull/27490


Automating boilerplate commands rather than expecting all contributors to set up environments to run all boilerplate commands seems quicker and simpler than explaining all the steps to every new contributor

pahud commented 9 months ago

Hi @PatMyron

I feel your pain points. One of our recommended IDE is Amazon CodeCatalyst DevEnv and I am thinking we should create a walkthrough episode on CDK Live to share how to setup everything with some boilerplate commands.