Last active
October 7, 2023 10:29
-
-
Save rupertbg/78f8eca2cee34b78c64b8c7e9528af37 to your computer and use it in GitHub Desktop.
Use the buildspec.yml from another (Secondary Source) repo for your Source repo in AWS CodeBuild (Demonstrated with Cloudformation)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CodeBuildProject: | |
Type: AWS::CodeBuild::Project | |
Properties: | |
Name: !Ref GitHubRepoName | |
BadgeEnabled: true | |
Description: Builds a Docker image using a BuildSpec from another repo | |
ServiceRole: !ImportValue Your-CodeBuild-Role | |
TimeoutInMinutes: 15 | |
Artifacts: | |
Type: NO_ARTIFACTS | |
Source: | |
SourceIdentifier: my-repo | |
Type: GitHub | |
Location: !Sub https://github.com/${GitHubRepoOwner}/${GitHubRepoName}.git | |
ReportBuildStatus: true | |
GitCloneDepth: 1 | |
BuildSpec: ../the-name-of-the-buildspec-repo/buildspec.yml | |
SecondarySources: | |
- SourceIdentifier: the-buildspec-repo | |
Type: GitHub | |
Location: !Sub https://github.com/rupertbg/the-name-of-the-buildspec-repo.git | |
ReportBuildStatus: false | |
GitCloneDepth: 1 | |
Environment: | |
Type: LINUX_CONTAINER | |
ComputeType: BUILD_GENERAL1_SMALL | |
Image: aws/codebuild/standard:3.0 | |
PrivilegedMode: true | |
EnvironmentVariables: | |
- Name: CONTAINER_NAME | |
Value: !Ref ContainerName | |
- Name: ECR_REPO | |
Value: !Ref ECRRegistry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey bud, this is just a snippet of a template, a single resource you would add to a complete Cloudformation template.