【问题标题】:amazon beanstalk ec2 instance current git sha亚马逊 beanstalk ec2 实例当前 git sha
【发布时间】:2013-12-23 01:07:04
【问题描述】:

如何获得提交的当前 git sha git aws.push ? 我的 container_commands 需要在以 git sha 作为文件名的服务器上下载一个文件,所以我需要一种方法来确定它。

我一直在浏览/opt/elasticbanstalk/ 并找到了文件 /opt/elasticbeanstalk/deploy/configuration/appsourceurl 其中包含

"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=-----"

我可以解析这个并提取 git-sha 这个 git sha 与我在本地的 git head sha 不同的问题,我只是 git aws.pushed!为什么?

【问题讨论】:

    标签: git amazon-web-services amazon-elastic-beanstalk


    【解决方案1】:

    您可以使用AWS Elastic Beanstalk API Command Line Interface 确认版本标签(又名 git commit):

    $ 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
    

    它应该与您的本地提交匹配:

    $ git rev-parse HEAD
    c069d943a152871a3a43898ce19ea20295b1307d
    

    另外,在日志中查找归档操作:

    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/
       ...
    

    【讨论】:

    • 嗨,安德烈,谢谢!我在 elastic-beanstalk-describe-applications 中找不到命令。我需要以某种方式进行设置吗?
    • 嗨!是的,您需要进行设置:docs.aws.amazon.com/elasticbeanstalk/latest/dg/usingCLI.html
    • 如果我进入 amazon beanstalk 在线系统并选择以前的 git sha 进行部署,这不会给我错误的 sha(即最新的而不是我要求部署的那个)吗?
    • @user391986 这对我来说似乎违反直觉。如果您选择另一个提交进行部署,则应在部署日志中报告该提交。你有不同的看法吗?我将在今天晚些时候尝试运行该场景。
    猜你喜欢
    • 2010-12-28
    • 2014-10-08
    • 2014-03-30
    • 2020-05-12
    • 2012-12-05
    • 2014-09-04
    • 2013-09-28
    • 2016-04-27
    • 1970-01-01
    相关资源
    最近更新 更多