Skip to content

expose git commit revision id as environmental variable to hook steps #36

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

Closed
woodhull opened this issue Nov 8, 2015 · 20 comments
Closed

Comments

@woodhull
Copy link

woodhull commented Nov 8, 2015

Our CI systems precompiles some artifacts and stores them in S3 with the git revision as the unique identifier.

We'd like the scripts that run on deploy to download the correct version based on the deployed git commit id. Right now it's awkward, since we need to query for the deployment ID and then get the git commit id from there.

@surybala
Copy link
Contributor

surybala commented Dec 2, 2015

Seems like a reasonable feature request. Thanks.

@koitsu
Copy link

koitsu commented Jan 16, 2016

Seconding this feature. Some usage details so you understand our use case:

We don't use S3, but instead deploy via CodeDeploy directly from GitHub (GUI: "My application is stored in GitHub" checkbox). We really need a way within an AfterInstall hooks script to be able to get the git commit SHA (GUI: "Commit ID") so it can be put into a file on the server. This would save me having to tell our developers "Just use the GUI" to find out what code is actively on the box (and yes I'm well aware the agent has this information deep within /opt/codedeploy-agent). An environment variable would be absolutely perfect.

@elijahchancey
Copy link

I have the exact same issue and workaround as woodhull. Querying the deployment ID to get the commit id. +1 for this feature request!

@gergnz
Copy link

gergnz commented Mar 2, 2016

+1

9 similar comments
@piercus
Copy link

piercus commented Mar 24, 2016

+1

@fabiopaiva-praxis
Copy link

+1

@joncon
Copy link

joncon commented Mar 16, 2017

+1

@jcramb
Copy link

jcramb commented Apr 19, 2017

+1

@shogochiai
Copy link

+1

@RAR
Copy link

RAR commented Aug 14, 2017

+1

@richardowen
Copy link

+1

@dilip-grexit
Copy link

+1

@apoorv-kumar
Copy link

+1

@apoorv-kumar
Copy link

I think this solves it - https://forums.aws.amazon.com/thread.jspa?threadID=226646

@sebastianreloaded
Copy link

@apoorv-kumar it doesn't, as far as i understand, the linked thread is about codepipeline and not plain codedeploy

@annamataws
Copy link

Added to our task list so we can review this new design decision with the team

@mpdude
Copy link

mpdude commented May 31, 2020

I also have a use case that would benefit.

As a workaround, is it possible to query the commit ID through the API (using the AWS CLI, possibly)?

@dicato
Copy link

dicato commented Aug 25, 2021

👍 on this request.

As others have noted, the workaround is to use the DEPLOYMENT_ID environment variable to query for the commit ID.

For example:

aws deploy get-deployment --deployment-id $DEPLOYMENT_ID  --query "deploymentInfo.revision.gitHubLocation.commitId" --output text 

mwjones-aws pushed a commit that referenced this issue Sep 16, 2022
This patch exposes the commit hash as `BUNDLE_COMMIT`
when we are deploying from Github.

GHI #36
@mwjones-aws mwjones-aws moved this to Researching in CodeDeploy Public Roadmap Oct 14, 2022
@mwjones-aws
Copy link
Contributor

This feature has been added as part of the 1.4.0 release.

Repository owner moved this from Researching to Coming Soon in CodeDeploy Public Roadmap Dec 14, 2022
@mwjones-aws mwjones-aws moved this from Coming Soon to Just Shipped in CodeDeploy Public Roadmap Dec 14, 2022
@mpdude
Copy link

mpdude commented Dec 16, 2022

The 1.4.0 release exposes the commit SHA-1, but does not (yet) provide the repository URL itself for/from which die deployment was triggered. However, that information can be queried through the API when needed.

aws deploy get-deployment --deployment-id $DEPLOYMENT_ID  --query  ".deploymentInfo.revision.gitHubLocation.repository" --output text 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests