Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Environment variable file path

Case 1: If the user provided an environment variable file path.

Consider this path as an example: (lambda-demo/EnvironmentFile/lambda-demo.json)

...

  • Consider the given path as an absolute path and check if a file exists on the given path.

  • If the file does not exist on the given path, then consider the path as a relative path and check the file in the Artifact directory. ( $FD_ARTIFACT_DIR/lambda-demo/EnvironmentFile/lambda-demo.json)

  • If no file is found using the above option, then check if the file is present under the temp Directory.

...

It can happen the file is present inside a zip file residing under the artifact folder(result of Consume Artifact). The plugin first extracts the content of the zip file under the temp directory. Then it will search the file pattern inside the temp File. (Any file path under $FD_TEMP_DIR ending withlambda-demo/EnvironmentFile/lambda-demo.json)

Note: While doing the pattern match for the file, in case more than one file is found then we are throwing the exception with the message: More than one environment Variable file present.

After performing above steps if we are not getting the file then we are throwing the exception. [ FDAWS_LAMBDA_00020_ADD_ENV_VARIABLE_FILE_NOT_FOUND, "File is not present on the given path: " + pGivenFilePath ]

Case 2: If no file path is given or the value of the file path is “NA”

Printing the message: LOG.logInfo(methodName, "Environment variable file path not provided or file path value is set as NA"); and continue the execution and check the input argument for environment variables.Example of Artifact directory, here we have both environment file and function code in our Artifact directory.

...

Artifact File Path ( Applicable only for local archive )

Case 1: If the user provided an Artifact file path.

Consider this path as an example: ( lambda-demo/FunctionCode/lambda-demo.zip )

...

After performing the above steps if we don’t get the file on the given path then we are throwing an exception, with the error message: "No zip file is found on given path:"

Case 2: If the user is not provided a path

If the user is not provided a path, then we are searching the Artifact directory for the file with the ‘zip’ extension and using that file to deploy the lambda function. In case more than one file is present we are throwing an exception.

...

${{FD_ARTIFACTS_DIR}}/lambda-demo/EnvironmentFile/lambda-demo.json

Example of Artifact directory file structure

Example-1: Here we have both environment file and function code in our Artifact directory.

...

Example-2: Users can also give a single Artifact file that contains both the Environment file and the zip file to update the function code. Just need to provide the right path pattern.

...

Artifact file path: FunctionCode/lambda-demo.zip

...

Extracted zip file:

...

Function Name ( Add environment variable operation )

[ Priority : user-provided function name > extract name of the file from the env file path and use it as function name ]

...

If the function name and environment variable file path both are not given in that case, we are throwing an exception with the error message: "Failed to retrieve the function name."

Function Name ( Update function code operation )

[ Priority : user-provided function name > ECR image name > S3 key name > extract file name from local archive path ]

...

  • If the ECR option is not given then check S3 option and if it’s given, then use the name of the S3 key as the function name.

  • If Both ECR/S3 option is not given then name of the local archive fill be use as function name.

Deployment Type

  • If the Amazon ECR option is given, then give priority to ECR. [ deploymentType = ECR ]

  • If ECR URL detail is not given then check S3 details, in case of S3, both the bucket name and the key name are required, in case one of the bucket/key name is missing then throw an exception with the error message: "To update the function code using S3, both S3 Bucket and S3 key name are required." [ deploymentType = S3 ]

  • If ECR/S3 detail is not given, then by default deployment type is set to local. [ deploymentType = LOCAL ]

...