Edit to add: i updated the pipe version to 1.6.0 and updated path to config file to './stagingconfig.json' and it worked fine.
I'm updating and aliasing. I can't seem to figure out the syntax/order of operations to properly update the environment variables when doing the update.
The variables that I want to use are stored with the bitbucket-pipelines.yml file.
bitbucket-pipelines.yml:
pipelines:
default:
- step:
# Build and package the Lambda function.
name: Build and package
script:
- apt-get update && apt-get install -y zip
- zip code.zip lambda-name/*
# Upload the Lambda - make the version number
#available to subsequent steps via artifacts.
- pipe: atlassian/aws-lambda-deploy:0.2.1
variables:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
FUNCTION_NAME: 'lambda-name'
COMMAND: 'update'
ZIP_FILE: 'code.zip'
WAIT: 'true'
# The pipe exports the newly published
# Lambda version to a file.
artifacts:
- pipe.meta.env
# You can optionally use AWS Lambda aliases
# to map the newly published Lambda
# function version to conceptual environments.
- step:
name: Deploy to Staging
deployment: Staging
script:
# Read the 'function_version' from
# the update pipe into environment variables.
- source pipe.meta.env
# Point the 'staging' alias to the function.
- pipe: atlassian/aws-lambda-deploy:0.2.1
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
SecretName: $SecretName
FUNCTION_NAME: 'eip-put-rrt'
COMMAND: 'alias'
FUNCTION_CONFIGURATION: '~/stagingconfig.json'
ALIAS: 'dev'
VERSION: '${function_version}'
stagingconfig.json (in root folder):
{
"Environment": {
"Variables": {
"Region": "$AWS_DEFAULT_REGION",
"SecretName": "$SecretName",
"BucketName": "$BUCKET_NAME"
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.