Specify a GitHub repository version with a commit ID (original) (raw)
You can specify a source version with only a commit ID, such as12345678901234567890123467890123456789
. If you do this, CodeBuild must download the entire repository to find the version.
To specify a GitHub repository version with a commit ID
- Open the AWS CodeBuild console at https://console.aws.amazon.com/codesuite/codebuild/home.
- Create a build project. For information, see Create a build project (console) and Run a build (console). Leave all settings at their default values, except for these settings:
- In Source:
* For Source provider, chooseGitHub. If you are not connected to GitHub, follow the instructions to connect.
* For Repository, choose Public repository.
* For Repository URL, enterhttps://github.com/aws/aws-sdk-ruby.git
. - In Environment:
* For Environment image, chooseManaged image.
* For Operating system, chooseAmazon Linux 2.
* For Runtime(s), chooseStandard.
* For Image, chooseaws/codebuild/amazonlinux-x86_64-standard:4.0.
- In Source:
- For Build specifications, choose Insert build commands, and then choose Switch to editor.
- In Build commands, replace the placeholder text with the following:
version: 0.2
phases:
install:
runtime-versions:
ruby: 2.6
build:
commands:
- echo $CODEBUILD_RESOLVED_SOURCE_VERSION
The runtime-versions
section is required when you use the Ubuntu standard image 2.0. Here, the Ruby version 2.6 runtime is specified, but you can use any runtime. The echo
command displays the version of the source code stored in the CODEBUILD_RESOLVED_SOURCE_VERSION
environment variable.
5. On Build configuration, accept the defaults, and then choose Start build.
6. For Source version, enter046e8b67481d53bdc86c3f6affdd5d1afae6d369
. This is the SHA of a commit in the https://github.com/aws/aws-sdk-ruby.git
repository.
7. Choose Start build.
8. When the build is complete, you should see the following:
- On the Build logs tab, which version of the project source was used. Here is an example.
[Container] Date Time Running command echo $CODEBUILD_RESOLVED_SOURCE_VERSION
046e8b67481d53bdc86c3f6affdd5d1afae6d369
[Container] Date Time Phase complete: BUILD State: SUCCEEDED
- On the Environment variables tab, theResolved source version matches the commit ID used to create the build.
- On the Phase details tab, the duration of the
DOWNLOAD_SOURCE
phase.
Source version sample
Specify a GitHub repository version with a reference and commit ID
Did this page help you? - Yes
Thanks for letting us know we're doing a good job!
If you've got a moment, please tell us what we did right so we can do more of it.
Did this page help you? - No
Thanks for letting us know this page needs work. We're sorry we let you down.
If you've got a moment, please tell us how we can make the documentation better.