jacob-meacham / serverless-plugin-git-variables

:zap: Expose git variables to serverless
MIT License
87 stars 32 forks source link

Failing build when more then one tag points to commit #54

Closed maciejdzikowicki closed 4 years ago

maciejdzikowicki commented 4 years ago

When more then one tags points to a commit, deployment fails with following exception:

An error occurred: SomeLambdaFunction - 1 validation error detected: Value '{GIT_COMMIT_LONG=xxxxx, GIT_TAGS=prd-1.2.3,stg-1.2.3, GIT_COMMIT_SHORT=xxx}' at 'tags' failed to satisfy constraint: Map value must satisfy constraint: [Member must have length less than or equal to 256, Member must have length greater than or equal to 0, Member must satisfy regular expression pattern: ^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$] (Service: AWSLambdaInternal; Status Code: 400; Error Code: ValidationException; Request ID: xxx).
jacob-meacham commented 4 years ago

Hi @maciejdzikowicki thanks for the report! What version are you using?

maciejdzikowicki commented 4 years ago

I'm using 3.4.0

dvictory commented 4 years ago

I am also having this issue. You can get around it by adding the tag 'GIT_TAGS' to the function manually. You lose the usefulness of the tag, but it's available as in env var. @jacob-meacham maybe add the ability to disable env vars and tags separately version all or none. Like:

exportGitVariablesToTags: false
exportGitVariablesToEnv: true

or fix the tag output to adhere to the required regex.

jacob-meacham commented 4 years ago

Thanks @maciejdzikowicki @dvictory! I just published two new releases: 3.5.0 includes the ability to specify a whitelist of variables that you'd like to set on tags/env - see the README for using it. 4.0.0 changes the tags separator from ',' to '::' which should conform to the AWS regex but is a breaking change so I wanted to rev bump.