aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

Github now uses main instead of master

Open OksanaH opened this issue 3 years ago • 17 comments

I was using CDKPipelines to create a CodePipeline with BitbucketAction (using a Github repo with one 'main' branch as the source, created by default when I created the repo), and did not specify a branch to pull from. I noticed when the action execution failed there was a message in the console 'No branch [master] found for the repository'. It looks like Github uses 'main' instead of 'master' now, so that error message probably needs changing? Where is the best place to report this issue if this is not relevant here (I imagine it is a Codebuild issue)?

OksanaH avatar Mar 02 '21 00:03 OksanaH

Hi @OksanaH ,

actually, it is an issue with the BitbucketAction, as it defaults to master here.

Unfortunately, this is not really a default we can change now - although when we introduce a better-named Action for this, something like CodeStarConnectAction, we can revisit this decision.

Same problem is present with GitHubSourceAction, CodeCommitSourceAction, etc.

skinny85 avatar Mar 02 '21 00:03 skinny85

We're in a bit of a pickle in that:

  • Even though main is the new default in most code repositories, many people will still be on old repositories that were created when master was the default.
  • If we change the default value, all existing infrastructure that happily uses master today will break if they upgrade CDK versions (as they will be implicitly switched to main)

The only way to do this is with a feature flag.

rix0rrr avatar Mar 16 '21 09:03 rix0rrr

I'm actually debating whether we should make branch required in V2 for all these Actions.

I feel like a feature flag is actually a pretty bad experience for this change, since it doesn't matter when you created the CDK application, it matters when the repository you're using as a source was created, and that can be much earlier than your CDK application. So, if you create a new CDK application , and it suddenly defaults to main, it's pretty irritating if you're using it with an old repository that's still on master.

We can then make the branch property in V2 optional again after enough time has passed, and the transition from main to master can be considered complete.

skinny85 avatar Mar 16 '21 16:03 skinny85

I like the idea of making branch required. @skinny85 @rix0rrr I'm looking to contribute to to CDK so if it's decided that the changes are needed and it can be classed as a good first issue, I'm happy to pick it up.

OksanaH avatar Mar 18 '21 20:03 OksanaH

@OksanaH if you're willing to work on this, that would be amazing!

Note that, since this is a change only in V2, the submitted PR would have to target the v2-main branch, not the current default of this repository, master.

Let me know if you're still interested in working on this!

skinny85 avatar May 14 '21 19:05 skinny85

@skinny85 sure I'm going to have a go! Just to double check since there's been conversation about feature flags as well - I need to make the branch name required, right?

OksanaH avatar May 14 '21 20:05 OksanaH

Let's go with the "make branch required" plan for now, yes.

skinny85 avatar May 14 '21 21:05 skinny85

And thanks!

skinny85 avatar May 14 '21 21:05 skinny85

@skinny85 so, I've switched to v2-main, and I'm getting an error Unable to locate jsii assembly for "@aws-cdk/aws-cloudformation". If this module is not jsii-enabled, it must also be declared under bundledDependencies, when I try to buildup or run yarn build. I've also tried to run some commands from the Troubleshooting section of the Contributing.MD document. Any idea what I might be doing wrong or is there anything that needs to be done differently for v2-main (I work in Gitpod, and have tried using an existing space, and creating a new space)? Thanks

OksanaH avatar May 16 '21 20:05 OksanaH

Did you run yarn install --frozen-lockfile after switching to v2-main?

skinny85 avatar May 17 '21 14:05 skinny85

@skinny85 I ran yarn install --frozen-lockfile and after that if I run scripts/buildup from a module folder or scripts/foreach.sh yarn build from the root, I get this error during the build of lambda-layer-awscli: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: write sysctl key net.ipv4.ip_unprivileged_port_start: open /proc/sys/net/ipv4/ip_unprivileged_port_start: read-only file system: unknown. Thanks

OksanaH avatar May 17 '21 21:05 OksanaH

@OksanaH I think that might be because lambda-layer-awscli uses Docker, which is tricky to make work in Gitpod - see here: https://github.com/gitpod-io/gitpod/issues/52#issuecomment-738629624 on how to start the Docker demon inside your Gitpod workspace.

if that's too difficult/doesn't work for some reason, you can also use Lerna with the --no-bail switch to "simulate" the buildup script. Execute something like this in the root of the CDK workspace:

$ ./node_modules/.bin/lerna run --stream build --include-dependencies --no-bail --scope @aws-cdk/aws-codepipeline

(Replace @aws-cdk/aws-codepipeline with whatever module you were running buildup from)

Let me know if this helps!

Thanks, Adam

skinny85 avatar May 18 '21 22:05 skinny85

Hi @skinny85, thanks for the suggestion; when I run the above command, no errors are thrown, but then the same error persists when I try to build the aws-codepipeline-actions module: Unable to locate jsii assembly for "@aws-cdk/aws-cloudformation". If this module is not jsii-enabled, it must also be declared under bundledDependencies. I've also tried VSCode but there I get a different error when I try to do the buildup of aws-codepipeline-actions or yarn build after having run yarn install --frozen-lockfile: \node_modules\jsii\bin\jsii' is not recognized as an internal or external command, operable program or batch file

It looks both errors happen when this is run.

Thanks, Oksana

OksanaH avatar May 20 '21 21:05 OksanaH

Hi @skinny85, thanks for the suggestion; when I run the above command, no errors are thrown, but then the same error persists when I try to build the aws-codepipeline-actions module:

Did you switch @aws-cdk/aws-codepipeline to @aws-cdk/aws-codepipeline-actions in the above command I gave?

$ ./node_modules/.bin/lerna run --stream build --include-dependencies --no-bail --scope @aws-cdk/aws-codepipeline-actions

skinny85 avatar May 20 '21 22:05 skinny85

@skinny85 yes I did. Am getting the same error now about unprivileged port start.

OksanaH avatar May 22 '21 06:05 OksanaH

Hmm, you're right, I was just able to reproduce this...

I see you asked https://community.gitpod.io/t/docker-inside-gitpod/3688/2, I've commented there as well - let's see what they say.

skinny85 avatar May 24 '21 15:05 skinny85

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

github-actions[bot] avatar Sep 21 '22 16:09 github-actions[bot]

[GitHub] No Branch [master] found for FullRepositoryName even though there is master branch

Sabin-K-Lama avatar Sep 29 '23 07:09 Sabin-K-Lama