question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[aws-codepipeline-actions] fetchSubmodules support for all Sources

See original GitHub issue

BitBucketSourceAction is required to setup a pipeline using BitBucket. It’s easy enough to setup codestar to work with this for private repos. The issue I am running into, is that submodules are not being included in the source code. This makes it impossible to use the pipeline in it’s current state.

Please add the ability to specify submodule in the action and ideally, make it match what is possible in the console. I cannot even choose the events I want to trigger either which is a big issue as well but one I have been dealing with for a while now.

Use Case

Submodules are a necessary part of all git projects I am working on. This limitation is making using pipelines extremely difficult because now the only solution is to use keys and checkout the repo in codebuild. This is not only redundant, it makes this action useless for anything other than a simple git project. Again, you cannot even control the events so you cannot stop building on every commit to the repo. No ability to add a nobuild comment or control the events you want to trigger the build.

Proposed Solution

Ideal solution would be to allow the same props as the Codebuild BitBucketSourceProps: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-codebuild.BitBucketSourceProps.html

It seems you cannot use that for the pipeline with the CDK and that really stinks because it has everything I need…

Other

I am currently using:

          new BitBucketSourceAction({
            actionName: 'BitBucket',
            branch: this._props.git.branch,
            codeBuildCloneOutput: true,
            connectionArn: this._props.git.codeStartArn,
            output: this._artifactBaseSource,
            owner: this._props.git.owner,
            repo: this._props.git.repo,
          }),

This is what I used to use before I figured out this was not possible to use with code pipeline:

        const bbSource = codebuild.Source.bitBucket({
          branchOrRef: this._props.git.branch,
          cloneDepth: 1,
          fetchSubmodules: true,
          owner: this._props.git.owner,
          repo: this._props.git.repo,
          webhook: true,
          webhookFilters: [
            // Only on PUSH and PR Merged do we build (no support for message yet to allow for no builds)
            codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH, codebuild.EventAction.PULL_REQUEST_MERGED).andBranchIs(GIT_REPO_BRANCH)
          ]
        });

The codebuild props allow more control. Ideally, I would prefer the ability to use that over the BitBucketSourceAction but this is not possible.

It should also be noted that codeBuildCloneOutput is not very clear on what it does. I cannot find any examples of how to use this properly so not really sure if I even need this.

I cannot select full clone for the repo even though it is an option when I go to edit the source in the pipeline. I bring this up because there is a work-a-round here: https://stackoverflow.com/a/64163023/650206

Basically, I cannot use CDK pipelines yet due to this limitation with the CDK. This seems like a pretty serious issue and moving from BitBucket is not an option. May need to go back to Terraform for this and that is not ideal.

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
skinny85commented, Nov 10, 2020

Hey @jpSimkins ,

thanks for opening the issue. Unfortunately, I’m pretty sure this is a CodePipeline limitation, and there’s not much CDK can do here. If you have premium support, I would suggest opening a feature request through there.

One trick I see a lot of customers use is to have a CodeBuild Project that watches the BitBucket repository with a webhook and fetchSubmodules: true, which then publishes the contents as an artifact to S3, and then a CodePipeline gets triggered from that S3 Bucket. A little roundabout, but should work.

Thanks, Adam

0reactions
lschierercommented, Feb 5, 2022

as a work around, in the commands section of the ShellStep, I included ‘git submodule init’ and ‘git submodule update’ after the ‘npm run build’ which seems to have worked. It is a bit fragile though, as it seems to not work if you put it before that command, even though it shouldn’t matter.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS CodePipeline now Supports git clone for Source Actions
AWS CodePipeline Source Actions for AWS CodeCommit, GitHub.com, GitHub Enterprise Server, and Bitbucket.org now support cloning of your git ...
Read more >
Appendix A: GitHub version 1 source actions
For a pipeline with a GitHub GitHub version 1 source action, CodePipeline uses OAuth-based tokens to connect to your GitHub repository. By contrast,...
Read more >
Tutorial: Use full clone with a CodeCommit pipeline source
In this tutorial, you create a pipeline that accesses your CodeCommit repository, uses the full clone option for source data, and runs a...
Read more >
AWS::CodeBuild::Project GitSubmodulesConfig
GitSubmodulesConfig is a property of the AWS CodeBuild Project Source property type that specifies information about the Git submodules configuration for ...
Read more >
Troubleshooting CodePipeline - AWS Documentation
When your pipeline has a CodeCommit source action, there are two ways you can pass the input artifact to the build: ... Full...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found