带AWS弹性beantalk的Bitbucket CI / CD管道

时间:2020-02-28 12:24:35

标签: amazon-web-services asp.net-core bitbucket amazon-elastic-beanstalk bitbucket-pipelines

我正在尝试实现Bitbucket CI / CD管道,以在AWS Elastic beantalk上部署.net核心应用程序。 .net核心应用程序已成功发布,但是当我尝试在AWS Elastic beantalk上进行部署时,它发出了以下错误。

✖部署失败。环境“ {my-application-environment}”为 运行其他版本“ {version-number}”。

也在AWS Elastic beantalk上,我遇到以下错误,

在异常终止的部署过程中,某些实例可能已经部署了新的实例 应用程序版本。确保所有实例都运行相同 版本,然后重新部署相应的应用程序版本。

下面是我的bitbucket-pipelines.yml文件

image: microsoft/dotnet:3.0-sdk 

pipelines:
  default:
    - step:
       script:
          - echo "Hello Bitbucket !"

    - step: 
        name: build publish prepare and zip 
        caches: 
          - dotnetcore 
        script:
          - apt-get update && apt-get install --yes zip 
          - export PROJECT_NAME=$PROJECT_NAME
          - dotnet restore $PROJECT_NAME
          - dotnet build $PROJECT_NAME 
          - dotnet publish $PROJECT_NAME --self-contained --runtime win-x64 --configuration Debug
          - zip -j site.zip /opt/atlassian/pipelines/agent/build/{my-project-name}/bin/Debug/netcoreapp3.0/win-x64/publish/*  -x aws-windows-deployment-manifest.json
          - zip -r -j application.zip site.zip /opt/atlassian/pipelines/agent/build/{my-project-name}/bin/Debug/netcoreapp3.0/win-x64/publish/aws-windows-deployment-manifest.json 

        artifacts:
          - application.zip

    - step:
        name: upload to elasticbeanstalk
        script:
          - pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.0
            variables:
              APPLICATION_NAME: $APPLICATION_NAME
              AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
              AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
              AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
              #COMMAND: 'upload-only'
              ZIP_FILE: 'application.zip'
              ENVIRONMENT_NAME: $ENVIRONMENT_NAME
              WAIT: 'true'
              VERSION_LABEL: 'deploy-WebApi-$BITBUCKET_BUILD_NUMBER'

我已经在管道设置和管道中配置的变量也已启用。

.yml文件出问题了吗?

对此有任何帮助!

0 个答案:

没有答案