通过代码管道从 Github 部署失败

Posted

技术标签:

【中文标题】通过代码管道从 Github 部署失败【英文标题】:Deployment Failed from Github via Code Pipeline 【发布时间】:2022-01-14 15:34:12 【问题描述】:

我正在尝试在我们的服务器上部署新的东西。

每次我不知道为什么,每次我得到它都会失败:

[Instance: i-0767cd899da6be838] Command failed on instance. 
Return code: 2 Output: (TRUNCATED)... see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details. - 
It's a private package and you forgot to add a custom repository to find it Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_composer_install.sh failed. 
For more detail, check /var/log/eb-activity.log using console or EB CLI.

代码管道引发此消息:

Deployment completed, but with errors: 
During an aborted deployment, some instances may have deployed the new application version. 
To ensure all instances are running the same version, re-deploy the appropriate application version. 
Failed to deploy application. 
Unsuccessful command execution on instance id(s) 'i-0767cd899da6be838'. 
Aborting the operation. 
[Instance: i-0767cd899da6be838] Command failed on instance. 
Return code: 2 Output: (TRUNCATED)... see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details. - It's a private package and you forgot to add a custom repository to find it Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_composer_install.sh failed. 
For more detail, check /var/log/eb-activity.log using console or EB CLI.

我检查了弹性豆中的/var/log/eb-activity.log/var/log/httpd/error_log,但它们什么都没有。

这是composer.json 可能有助于跟踪问题:


    "require": 
        "php": "7.2",
        "algolia/algoliasearch-client-php": "^3.1",
        "authy/php": "3.0.5",
        "barryvdh/laravel-cors": "^0.11.3",
        "barryvdh/laravel-translation-manager": "^0.5.3",
        "berkayk/onesignal-laravel": "^1.0",
        "cviebrock/eloquent-sluggable": "^4.6",
        "darkaonline/l5-swagger": "5.7.*",
        "doctrine/dbal": "2.10.1",
        "dusterio/laravel-aws-worker": "^0.1.26",
        "fideloper/proxy": "^4.0",
        "google/apiclient": "^2.4",
        "guzzlehttp/guzzle": "^6.3",
        "intervention/image": "^2.4",
        "jenssegers/agent": "^2.6",
        "laravel/framework": "5.7.*",
        "laravel/scout": "^7.0",
        "laravel/slack-notification-channel": "v1.0.3",
        "laravel/socialite": "^4.4",
        "laravel/tinker": "^1.0",
        "laravelcollective/html": "^5.7",
        "league/flysystem-aws-s3-v3": "^1.0",
        "maatwebsite/excel": "3.1.25",
        "pusher/pusher-php-server": "^4.1",
        "segmentio/analytics-php": "^1.7",
        "sentry/sentry-laravel": "1.6.1",
        "spatie/laravel-activitylog": "v2.8.4",
        "spatie/laravel-medialibrary": "^6.19.0"
    ,
    "minimum-stability": "dev"


有什么帮助吗?

【问题讨论】:

你读过getcomposer.org/doc/articles/troubleshooting.md ??如果没有相应的composer.json,这个问题可能无法回答。没有产生它的代码的错误,这更像是一个投诉而不是一个问题。 @MartinZeitler 问题已更新为composer.json,我检查了你发送的内容,我还没有找到任何东西。 【参考方案1】:

我的问题解决了。 起初我尝试在post 应用解决方案,但它并没有解决我的问题。

解决我的问题的唯一方法是升级我的作曲家版本。

所以我将我的作曲家从 1.8.0 升级到 2.1.3 by:

composer self-update 2.1.3

我必须在弹性 beanstalk 配置文件中这样做:

commands:
  01updateComposer:
    command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update 2.1.3

希望有一天这对你们有所帮助。

【讨论】:

以上是关于通过代码管道从 Github 部署失败的主要内容,如果未能解决你的问题,请参考以下文章

Hexo部署到github的疑难杂症,通过hexo d发布到github失败

你能从部署在 GitHub 上的 heroku 应用程序写入 JSON 文件吗

AWS CodePipeline ElasticBeanstalk 部署失败

从 GitHub 持续部署在 Azure 中失败(ASP.NET 5 和 MVC 6)

部署到 DigitalOcean 时 GitHub 操作失败

作为 Azure DevOps 中发布管道的一部分,将更改推送到 GitHub 存储库