I am trying to deploy web api on aws elastic beanstalk using bitbucker CI/CD pipeline. Below is the configuration for the same.
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.
However, I am getting below error for the zip file.
INFO: The application source bundle doesn't have a known file extension (zip, jar or war). This might cause some issues. INFO: Uploading to s3 bucket: myapplication. The user-provided path https://applicationxyz.s3.amazonaws.com/applicationxyz.zip does not exist.
I am not sure why I am getting this error. Prior to this we are already deploying the web api manually on elastic beanstalk, so there are few zip files already available. So, I have even tried to use those, still the issue is not resolved.
Any help on this appreciated !
EDIT 1: Updated bitbucket-pipelines.yml files
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'
you need to define artifats in the first step and pass them to next step.
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'
# Define an artifact to pass the zip file to the next step
artifacts:
- application.zip
The ZIP_FILE parameter is used to specify the local archive with your source code. You shouldn't pass the URL of an object in S3. Here is an example (more examples are available on in the 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'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.