我正在尝试使用bitbucker CI / CD管道在AWS Elastic beantalk上部署Web api。下面是相同的配置。
image: microsoft/dotnet:sdk
pipelines:
default:
- step:
caches:
- dotnetcore
deployment: myapi-test1
script: # Modify the comma`nds below to build your repository.
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.4
variables:
AWS_ACCESS_KEY_ID: '<access_key>'
AWS_SECRET_ACCESS_KEY: '<secret_key>'
AWS_DEFAULT_REGION: 'us-east-1'
APPLICATION_NAME: 'myapi'
ENVIRONMENT_NAME: 'test'
ZIP_FILE: 'https://applicationxyz.s3.amazonaws.com/applicationxyz.zip'
S3_BUCKET: 'myapplication' # Optional.
# VERSION_LABEL: '<string>' # Optional.
# DESCRIPTION: '<string>' # Optional.
# WAIT: '<boolean>' # Optional.
# WAIT_INTERVAL: '<integer>' # Optional.
# COMMAND: '<string>' # Optional.
# DEBUG: '<boolean>' # Optional.
但是,我在压缩文件中遇到了以下错误。
INFO:应用程序源包没有已知文件扩展名(zip,jar或war)。这可能会引起一些问题。信息:上载到s3存储桶:myapplication。用户提供的路径https://applicationxyz.s3.amazonaws.com/applicationxyz.zip不存在。
我不确定为什么会收到此错误。在此之前,我们已经在弹性beantalk上手动部署了Web api,因此几乎没有可用的zip文件。因此,我什至尝试使用这些功能,但问题仍未解决。
对此有任何帮助!
编辑1:更新了bitbucket-pipelines.yml文件
image: atlassian/default-image:2
pipelines:
default:
- step:
name: "Build and Test"
script:
- echo "Everything is awesome!"
- apt-get update
- apt-get install -y zip
- zip -j application.zip MyApplication.WebAPI/*
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: $APPLICATION_NAME
COMMAND: 'upload-only'
ZIP_FILE: 'application.zip'
S3_BUCKET: 'bitbucketcicd'
VERSION_LABEL: 'deployApi-$BITBUCKET_BUILD_NUMBER-multiple'
- step:
name: "Deploy to Test"
deployment: test
script:
- echo "Deployment!"
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: $APPLICATION_NAME
COMMAND: 'deploy-only'
VERSION_LABEL: 'deployApi-$BITBUCKET_BUILD_NUMBER-multiple'
ENVIRONMENT_NAME: $ENVIRONMENT_NAME
WAIT: 'true'
ZIP_FILE参数用于指定带有源代码的本地档案。您不应该在S3中传递对象的URL。这是一个示例(README中提供了更多示例:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.4
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: 'us-east-1'
APPLICATION_NAME: 'my-app-name'
ENVIRONMENT_NAME: 'production'
ZIP_FILE: 'application.zip'