jacob-meacham / serverless-plugin-git-variables

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

if there is no git user, using `${git:user}` kills the deploy #103

Open xytxytxyt opened 7 months ago

xytxytxyt commented 7 months ago

sls deploy worked fine manually with ${git:user}

but we're trying to automate it, and we are using an ssh key instead of a user for git clone etc

however, when there is no user, the deploy process dies completely with

Error:
Cannot resolve serverless.yaml: Variables resolution errored with:
  - Cannot resolve variable at "functions.resampler.tags.LastDeployedBy": Error: Command failed: git config user.name

    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:517:28)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1098:16)
    at Socket.<anonymous> (node:internal/child_process:450:11)
    at Socket.emit (node:events:517:28)
    at Socket.emit (node:domain:489:12)
    at Pipe.<anonymous> (node:net:351:12)

Exited with code exit status 1

maybe it could put an empty string or 'null' or something for the git user in this scenario? or at least not kill the deploy?

Running "serverless" from node_modules
Framework Core: 3.25.1 (local) 3.1.0 (global)
Plugin: 6.2.2
SDK: 4.3.2