image: python:3.8
pipelines:
default:
- parallel:
- step:
name: Test
caches:
- pip
script:
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- python manage.py test
- step:
name: Lint code
script:
- pip install flake8
- flake8 . --extend-exclude=dist,build --show-source --statistics
branches:
develop:
- step:
name: 'Build and Upload'
script:
- echo "Building application"
- apt-get update
- apt-get install zip
- zip -r application.zip .
- pipe: atlassian/aws-elasticbeanstalk-deploy:1.0.1
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: $AWS_APPICATION_NAME
COMMAND: 'upload-only'
ZIP_FILE: 'application.zip'
S3_BUCKET: $AWS_EB_DEPLOYMENT_BUCKET
VERSION_LABEL: '$AWS_APPICATION_NAME-$BITBUCKET_BUILD_NUMBER-$AWS_DEVELOPMENT_ENV'
- step:
name: 'Deployment to development'
deployment: test
script:
- echo "Deploying to development environment"
- pipe: atlassian/aws-elasticbeanstalk-deploy:1.0.1
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: $AWS_APPICATION_NAME
ENVIRONMENT_NAME: $AWS_DEVELOPMENT_ENV
COMMAND: 'deploy-only'
VERSION_LABEL: '$AWS_APPICATION_NAME-$BITBUCKET_BUILD_NUMBER-$AWS_DEVELOPMENT_ENV'
WAIT: 'true'
staging:
- step:
name: 'Build and Upload'
script:
- echo "Building application"
- apt-get update
- apt-get install zip
- zip -r application.zip .
- pipe: atlassian/aws-elasticbeanstalk-deploy:1.0.1
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: $AWS_APPICATION_NAME
COMMAND: 'upload-only'
ZIP_FILE: 'application.zip'
S3_BUCKET: $AWS_EB_DEPLOYMENT_BUCKET
VERSION_LABEL: '$AWS_APPICATION_NAME-$BITBUCKET_BUILD_NUMBER-$AWS_STAGING_ENV'
- step:
name: 'Deployment to staging'
deployment: staging
script:
- echo "Deploying to staging environment"
- pipe: atlassian/aws-elasticbeanstalk-deploy:1.0.1
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: $AWS_APPICATION_NAME
ENVIRONMENT_NAME: $AWS_STAGING_ENV
COMMAND: 'deploy-only'
VERSION_LABEL: '$AWS_APPICATION_NAME-$BITBUCKET_BUILD_NUMBER-$AWS_STAGING_ENV'
WAIT: 'true'
master:
- step:
name: 'Build and Upload'
script:
- echo "Building application"
- apt-get update
- apt-get install zip
- zip -r application.zip .
- pipe: atlassian/aws-elasticbeanstalk-deploy:1.0.1
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: $AWS_APPICATION_NAME
COMMAND: 'upload-only'
ZIP_FILE: 'application.zip'
S3_BUCKET: $AWS_EB_DEPLOYMENT_BUCKET
VERSION_LABEL: '$AWS_APPICATION_NAME-$BITBUCKET_BUILD_NUMBER-$AWS_PRODUCTION_ENV'
- step:
name: 'Deployment to production'
deployment: production
script:
- echo "Deploying to production environment"
- pipe: atlassian/aws-elasticbeanstalk-deploy:1.0.1
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: $AWS_APPICATION_NAME
ENVIRONMENT_NAME: $AWS_PRODUCTION_ENV
COMMAND: 'deploy-only'
VERSION_LABEL: '$AWS_APPICATION_NAME-$BITBUCKET_BUILD_NUMBER-$AWS_PRODUCTION_ENV'
WAIT: 'true'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.