Hello,
I am trying to setup a bitbucket pipeline to deploy a simlple zip artifact to an EC2 instance via Codedeploy. I am using the following article published by Atlassian: https://confluence.atlassian.com/bitbucket/deploy-to-amazon-aws-875304040.html.
The pipeline succeeds till uploading to S3 and then fails when doing the deploy with this error:
<span>INFO: Deploying app from revision.</span><span>aws deploy get-application-revision --application-name SampleCodeDeployPega --revision revisionType=S3,s3Location={bucket=SampleCodeDeployPega-codedeploy-deployment,bundleType=zip,key=SampleCodeDeployPega-13-e912d59c}<br></span><span>An error occurred (RevisionDoesNotExistException) when calling the GetApplicationRevision operation: No application revision found for revision.<br></span><span>✖ Failed to fetch revision.</span><span>Status: Downloaded newer image for bitbucketpipelines/aws-code-deploy:0.2.3</span>
I have all the proper IAM roles assigned to the user (AmazonS3FullAccess and AWSCodeDeployFullAccess) and I am using the correct access key and credentials.
I followed the steps in the article and below are the files:
bitbucket-pipeline.yml
image: atlassian/default-image:2
pipelines:
default:
- step:
name: Build
script:
- echo "Deploying to test environment"
artifacts:
- myapp.zip
- step:
name: Upload to S3
script:
# Test upload
- pipe: atlassian/aws-code-deploy:0.2.6
variables:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
COMMAND: 'upload'
APPLICATION_NAME: ${APPLICATION_NAME}
S3_BUCKET: ${S3_BUCKET}
ZIP_FILE: 'myapp.zip'
- step:
name: Deploy with CodeDeploy
script:
# Test upload
- pipe: atlassian/aws-code-deploy:0.2.6
variables:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
COMMAND: 'deploy'
APPLICATION_NAME: ${APPLICATION_NAME}
DEPLOYMENT_GROUP: ${DEPLOYMENT_GROUP}
VERSION_LABEL: 'my-app-1.0.0'
IGNORE_APPLICATION_STOP_FAILURES: 'true'
FILE_EXISTS_BEHAVIOR: 'OVERWRITE'
WAIT: 'true'
appspec.yml:
version: 0.0
os: linux
files:
- source: myapp.zip
destination: /opt/pega/staging
hooks:
BeforeInstall:
- location: scripts/import.sh
timeout: 300
runas: pguser
This is my directory structure in bitbucket repository:
All help, hints, suggestions welcome. Thank you for helping out.