4

How can I get current git sha of the commit that was git aws.push ? My container_commands need to download a file on a server that has that head git sha as the file name so I need a way to determine it.

I've been browsing around /opt/elasticbanstalk/ and found file /opt/elasticbeanstalk/deploy/configuration/appsourceurl which contains

"url": "https://elasticbeanstalk-us-west-43434324.s3.amazonaws.com/resources%2Fenvironments%2Dg-fea2ffeaf5%2F_runtime%2F_versions%2Fbb-test-eb%2Fgit-6cb3416a7a5a84ce864dd0213236984age4b0b9-2678564154681?Expires=1417813357&AWSAccessKeyId=-----&Signature=-----"

I could parse this and extract the git-sha the problem this git sha is different from my git head sha on local that I just git aws.pushed! Why?

Zword
  • 6,605
  • 3
  • 27
  • 52
user391986
  • 29,536
  • 39
  • 126
  • 205

1 Answers1

3

You can confirm version label (aka git commit) with AWS Elastic Beanstalk API Command Line Interface:

$ elastic-beanstalk-describe-applications
ApplicationName | ConfigurationTemplates | DateCreated | DateUpdated | Description | Versions
---------------------------------------------------------------------------------------------
angrywhopper |  | 2013-12-05 10:44:21 -0800 | 2013-12-05 10:44:21 -0800 | N/A | git-c069d943a152871a3a43898ce19ea20295b1307d-1386466726575

It should match your local commit:

$ git rev-parse HEAD
c069d943a152871a3a43898ce19ea20295b1307d

Also, look for archive operation in the log:

2013-12-08 03:51:31,830 [INFO] (10377 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Output from script: Archive:  /opt/elasticbeanstalk/deploy/appsource/source_bundle
c069d943a152871a3a43898ce19ea20295b1307d
   creating: /opt/python/ondeck/app/.ebextensions/
   ...
kukido
  • 10,431
  • 1
  • 45
  • 52
  • Hi Andrey thanks! I'm getting command not found with elastic-beanstalk-describe-applications. Do i need to set it up somewhow? – user391986 Dec 29 '13 at 05:54
  • Hi! Yes, you will need to set it up: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/usingCLI.html – kukido Dec 29 '13 at 07:38
  • If I go in the amazon beanstalk online system and select a previous git sha to deploy, won't this give me the wrong sha (i.e. the latest one and not the one I asked to deploy)? – user391986 Feb 03 '14 at 17:44
  • @user391986 It seems counterintuitive to me. If you pick another commit to deploy, then that commit should be reported in the deployment log. Do you see it differently? I will try to run the scenario later today. – kukido Feb 04 '14 at 18:18