部署beantalk应用程序时出现管道错误

时间:2019-10-05 15:51:04

标签: amazon-web-services azure-devops amazon-elastic-beanstalk

我正在使用azure DevOps设置CI管道。尝试手动运行管道时遇到错误:

err

我是否缺少pipeline.yml文件中的某些步骤?部署到Elastic Beanstalk之前需要发布吗?这是我的azure-pipelines.yml文件:

# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build- 
aspnet-4

trigger:
- master

pool:
vmImage: 'windows-latest'

variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'

- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package 
/p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true 
/p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'

- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'


- task: BeanstalkDeployApplication@1
inputs:
    awsCredentials: 'mypipelinetest'
    regionName: 'eu-west-1'
    applicationName: 'BookingSys'
    environmentName: 'BookingSys-env'
    applicationType: 'aspnet'

BeanstlakDeployApplicaion错误日志(我希望它提供了足够的信息来解决我的问题):

##[section]Starting: BeanstalkDeployApplication

==============================================================================
Task         : AWS Elastic Beanstalk Deploy Application
Description  : Deploys an application to Amazon EC2 instance(s) using AWS Elastic Beanstalk
Version      : 1.5.0
Author       : Amazon Web Services
Help         : Please refer to [AWS Elastic Beanstalk User Guide](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/Welcome.html) for more details on deploying applications with AWS Elastic Beanstalk.

More information on this task can be found in the [task reference](https://docs.aws.amazon.com/vsts/latest/userguide/elastic-beanstalk-deploy.html).

####Task Permissions
This task requires permissions to call the following AWS service APIs (not all APIs may be used depending on selected task options and environment configuration):
* autoscaling:DescribeScalingActivities
* autoscaling:DescribeAutoScalingGroups
* autoscaling:ResumeProcesses
* autoscaling:SuspendProcesses
* cloudformation:DescribeStackResource
* cloudformation:DescribeStackResources
* elasticbeanstalk:CreateApplicationVersion
* elasticbeanstalk:CreateStorageLocation
* elasticbeanstalk:DescribeApplications
* elasticbeanstalk:DescribeEnvironments
* elasticbeanstalk:DescribeEvents
* elasticloadbalancing:RegisterInstancesWithLoadBalancer
* elasticbeanstalk:UpdateEnvironment

The task also requires permissions to upload your application content to the specified Amazon S3 bucket. Depending on the size of the application bundle, either PutObject or the S3 multi-part upload APIs may be used.
==============================================================================
Deployment type set to aspnet
Configuring credentials for task
46da083f-a34f-46a7-a532-e33470f5c4bf exists true
...configuring AWS credentials from service endpoint '46da083f-a34f-46a7-a532-e33470f5c4bf'
...endpoint defines standard access/secret key credentials
Configuring region for task
...configured to use region eu-west-1, defined in task.
Configuring credentials for task
46da083f-a34f-46a7-a532-e33470f5c4bf exists true
...configuring AWS credentials from service endpoint '46da083f-a34f-46a7-a532-e33470f5c4bf'
...endpoint defines standard access/secret key credentials
Configuring region for task
...configured to use region eu-west-1, defined in task.
Determine S3 bucket elasticbeanstalk-eu-west-1-989127099484 to store application bundle
Uploading application bundle d:\a\1\s to object BookingSys/BookingSys-env/s-v1570289695608.zip in bucket elasticbeanstalk-eu-west-1-989127099484
Upload of application bundle failed with error: EISDIR: illegal operation on a directory, read { Error: EISDIR: illegal operation on a directory, read
    at Error (native) errno: -4068, code: 'EISDIR', syscall: 'read' }
##[error]Error: EISDIR: illegal operation on a directory, read
##[section]Finishing: BeanstalkDeployApplication

是否可以在GitHub存储库中错误地排列文件格式?这是我的Git存储库: https://github.com/craig1990/CampBookingSys-4th-Year-Project

如果我缺少一些简单的东西,请原谅我,尽管这是我第一次使用Azure DevOps。谁能看到我为什么出现上述错误?

1 个答案:

答案 0 :(得分:1)

如任务输出所述,您必须先将zip文件上载到S3存储桶,然后才能进行部署。

提供了一个示例here。显然,您将需要更改以下内容以反映您正在使用的文件的名称和您的AWS资源。

- task: S3Upload@1
  displayName: 'S3 Upload: angular-docker-bucket'
  inputs:
    awsCredentials: 'AWS-test'
    regionName: 'us-east-2'
    bucketName: 'angular-docker-bucket'
    sourceFolder: 'elastic-beanstalk'
    globExpressions: output.zip
    createBucket: true

- task: BeanstalkDeployApplication@1
  displayName: 'Deploy to Elastic Beanstalk: angular-docker-test'
  inputs:
    awsCredentials: 'AWS-test'
    regionName: 'us-east-2'
    applicationName: 'angular-docker-test'
    environmentName: 'AngularDockerTest-env'
    applicationType: s3
    deploymentBundleBucket: 'angular-docker-bucket'
    deploymentBundleKey: output.zip
    logRequest: true
    logResponse: true