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

CodeAppPlane CodeBuild Project: Add support to clone private Git repository as the application source code. #120

Open
1 of 2 tasks
shaniru-aws opened this issue Dec 4, 2024 · 0 comments · May be fixed by #121
Open
1 of 2 tasks

Comments

@shaniru-aws
Copy link

Describe the feature

Enable support for private Git repositories (e.g., GitHub, Bitbucket) as a source for pulling code in the CodeBuild projects created by SBT in the App Plane.

Use Case

The CodeBuild Project generated by SBT during AppPlane creation currently lacks support for private Git repositories as a source for application code download and installation. This limitation forces users to rely solely on S3 as the source for pulling code into the AppPlane.

In scenarios where developers prefer to use private GitHub or BitBucket repositories as their source code location, the current setup presents challenges. While it's possible to create a CodeStar connection to a private GitHub repository, the process of cloning the repository in CodeBuild requires additional configuration.

Specifically, the git-credential-helper in the buildspec.yml file needs to be set to true to enable successful cloning from private Git repositories. However, this setting is not customizable in the current implementation, creating a barrier for users who wish to pull code from private GitHub repositories.

This lack of flexibility in source code management options limits the versatility of the AppPlane creation process and may not align with the preferred workflows of many development teams. Addressing this limitation would significantly enhance the utility and adaptability of the SBT-created CodeBuild Projects.

Proposed Solution

Solution involves updating the content of the file : script-job.ts

The CodeBuild project is created here

    const codebuildProject = new codebuild.Project(this, `codebuildProject`, {
      source: props.source,
      encryptionKey: codeBuildProjectEncryptionKey,
      environment: {
        buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_5,
        privileged: true,
        environmentVariables: environmentVariables,
      },
      buildSpec: codebuild.BuildSpec.fromObject({
        version: '0.2',
        env: {
          shell: 'bash',
          ...(codeBuildProjectExportedVariables.length > 0 && {
            'exported-variables': codeBuildProjectExportedVariables,
          }),
        },
        phases: {
          build: {
            commands: props.script,
          },
          post_build: {
            ...(props.postScript && { commands: props.postScript }),
          },
        },
      }),
    });

Adding a field in the env field would allow the use of git-credential-helper

Other Information

No response

Acknowledgements

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

CDK version used

2.166.0 (build 7bb9203)

Environment details (OS name and version, etc.)

MacOS Sonoma 14.7

@shaniru-aws shaniru-aws linked a pull request Dec 4, 2024 that will close this issue
2 tasks
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 a pull request may close this issue.

1 participant