I am trying to update my pipeline aws lambda deployment version so that it could include a later version of boto3.
I am using a multistep process to deploy to multiple aliases but it always gets stuck when publishing to a versioned alias (ie not $LATEST) before the step up was. the items in {} is just changed to reduce personal data
release/qa:
- step:
name: Build and package
script:
- apt-get update && apt-get install -y zip
- zip {files}
- file.zip
- pipe.meta.env
- step:
name: Update DEV Lambda
script:
# Update lambda code and publish a new version
- pipe: atlassian/aws-lambda-deploy:0.4.3
variables:
AWS_ACCESS_KEY_ID: {KEY ID}
AWS_SECRET_ACCESS_KEY: {KEY}
AWS_DEFAULT_REGION: {region}
FUNCTION_NAME: {function name}
COMMAND: 'update'
ZIP_FILE: 'file.zip'
- step:
name: Update QA Version
script:
# Update lambda code and publish a new version
- pipe: atlassian/aws-lambda-deploy:0.4.3
variables:
AWS_ACCESS_KEY_ID: {key id}
AWS_SECRET_ACCESS_KEY: {key}
AWS_DEFAULT_REGION: {region}
FUNCTION_NAME: {function name}
COMMAND: 'alias'
ALIAS: 'qa'
VERSION: '${function_version}'
However when I changed it to follow more like the example giving https://bitbucket.org/atlassian/aws-lambda-deploy/src/master/ so it would look more like this
release/qa:
- step:
name: Build and package
script:
- apt-get update && apt-get install -y zip
- zip {files}
artifacts:
- file.zip
- pipe.meta.env
- step:
name: Update DEV Lambda
script:
# Update lambda code and publish a new version
- pipe: atlassian/aws-lambda-deploy:1.10.0
variables:
AWS_ACCESS_KEY_ID: {key id}
AWS_SECRET_ACCESS_KEY: {key}
AWS_DEFAULT_REGION: {region}
FUNCTION_NAME: {function name}
COMMAND: 'update'
ZIP_FILE: 'file.zip'
WAIT: 'true'
- step:
name: Update QA Version
script:
# Update lambda code and publish a new version
- pipe: atlassian/aws-lambda-deploy:1.10.0
variables:
AWS_ACCESS_KEY_ID: {key id}
AWS_SECRET_ACCESS_KEY: {key}
AWS_DEFAULT_REGION: {region}
FUNCTION_NAME: {function_name}
COMMAND: 'alias'
ALIAS: 'qa'
WAIT: 'true'
I have been trying a few different things but end results always gives the same error.
✔ Lambda is ready for deployment.
INFO: Checking for existing lambda alias.
INFO: Existing alias found - updating alias.
Traceback (most recent call last):
File "/pipe.py", line 341, in <module>
pipe.run()
File "/pipe.py", line 324, in run
self.update_or_create_alias()
File "/pipe.py", line 159, in update_or_create_alias
self.update_alias()
File "/pipe.py", line 172, in update_alias
self.client.update_alias(
File "/usr/local/lib/python3.10/site-packages/botocore/client.py", line 530, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python3.10/site-packages/botocore/client.py", line 923, in _make_api_call
request_dict = self._convert_to_request_dict(
File "/usr/local/lib/python3.10/site-packages/botocore/client.py", line 991, in _convert_to_request_dict
request_dict = self._serializer.serialize_to_request(
File "/usr/local/lib/python3.10/site-packages/botocore/validate.py", line 381, in serialize_to_request
raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid length for parameter FunctionVersion, value: 0, valid min length: 1
Honestly just not sure what to do at this point because I tried
Read results from the update pipe into environment variables
But that didn't work either. Any suggestions would be great and of much help.
Hi @Javier Diez
Thank you for your question!
In the newest version pipe supports passing explicit version of the lambda function.
So, please, follow the example Combining Update with Alias of the README.md.
Make shure that after pipe execution with command "update" you fetch new version from the file $BITBUCKET_PIPE_SHARED_STORAGE_DIR/aws-lambda-deploy-env :
# Read results from the update pipe into environment variables - BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" - VERSION=$(jq --raw-output '.Version' $BITBUCKET_PIPE_SHARED_STORAGE_DIR/aws-lambda-deploy-env)
So, your pipeline workflow could be the next:
script: # Build Lambda - build-lambda.sh # Update lambda code and publish a new version - pipe: atlassian/aws-lambda-deploy:1.11.0 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: '{function_name}' COMMAND: 'update' ZIP_FILE: 'file.zip' WAIT: 'true' # Read results from the update pipe into environment variables - BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" - VERSION=$(jq --raw-output '.Version' $BITBUCKET_PIPE_SHARED_STORAGE_DIR/aws-lambda-deploy-env) # Point an alias to the new lambda version - pipe: atlassian/aws-lambda-deploy:1.11.0 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: '{function_name}' COMMAND: 'alias' ALIAS: 'qa' VERSION: '${VERSION}'
Additionally, we will investigate the issue according to your case and notify you.
Best regards,
Oleksandr Kyrdan
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.