Adobe Commerce Cloud部署因封鎖的撰寫器版本而失敗

當先前釘選的Composer版本被更新的安全性建議封鎖時,雲端上的Adobe Commerce部署會在Composer建置階段失敗。 即使應用程式沒有變更,建置也會在標準部署流程完成之前停止。 更新設定中的釘選撰寫器版本會還原成功的組建。

若要解決此問題,請更新釘選的Composer版本並重新部署。

說明 description

環境

  • 雲端上的Adobe Commerce
  • 使用釘選撰寫器版本的雲端部署組建

問題/症狀

  • 在撰寫器建置或安裝階段期間,部署失敗
  • 若不變更應用程式程式碼,先前成功的部署就會失敗
  • 標準Adobe Commerce部署步驟完成前發生建置失敗
  • 建置記錄檔報告受安全性建議影響的已封鎖撰寫器版本

範例錯誤:

Your requirements could not be resolved to an installable set of packages.

Root composer.json requires composer/composer 2.2.27 (exact version match: 2.2.27 or 2.2.27.0), found composer/composer[ 2.2.27]  but these were not loaded, because they are affected by security advisories.

Go to https://packagist.org/security-advisories/ to find advisory details.

To ignore the advisories, add them to the audit "ignore" config.

To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.

解決方法 resolution

  1. 檢閱部署記錄檔,並識別組建輸出中報告的封鎖Composer版本。

  2. 開啟專案存放庫中的.magento.app.yaml檔案。

  3. dependencies > php區段下找到Composer相依性。 範例:

    code language-none
    dependencies:
      php:
        composer/composer: '2.2.27'
    
  4. 以與Adobe Commerce發行版本相容的支援安全版本取代封鎖的Composer版本。 設定範例:
    適用於Adobe Commerce 2.4.7或更新版本的

    code language-none
    dependencies:
      php:
        composer/composer: '2.9.8'
    

    適用於Adobe Commerce 2.4.5-2.4.6的

    code language-none
    dependencies:
      php:
        composer/composer: '2.2.28'
    
  5. 將設定變更提交到存放庫。

  6. 重新部署環境。

  7. 驗證Composer安裝階段是否順利完成,且沒有安全性建議錯誤。

recommendation-more-help
experience-cloud-kcs-help-kbarticles