amazon-web-servicescontinuous-integrationcontinuous-deploymentaws-codepipelineaws-codebuild

Getting Commit ID in CodePipeline


I am using CodePipeline with CodeCommit. Builds are triggered automatically with push to master branch. In CodePipeline console it is clearly visible that i am receiving commit id but i need to get it in the build environment so i can add them as a tag to the ECS image when i build it. Is there a way to get in in build environment. This is the id i am looking for


Solution

  • You can use the CODEBUILD_RESOLVED_SOURCE_VERSION environment variable to retrieve the commit hash displayed in CodePipeline at build time.