-2

I'm unable to find a way to pass the GIT_COMMIT variable to the jenkins pipeline. There are two steps, first step checks out the repo and second step creates the codeql report. To publish the report I need the recent ccommit id from the repo and pass it in the shell command.

tarun
  • 17
  • 7

1 Answers1

0

Use something like this for checkout step:

def scm = checkout(...)
scm.each{ k, v -> env."${k}" = v }

All the env variables below will be set and can be used anywhere

GIT_BRANCH
GIT_CHECKOUT_DIR
GIT_COMMIT
GIT_PREVIOUS_COMMIT
GIT_PREVIOUS_SUCCESSFUL_COMMIT
GIT_URL
IonutS
  • 151
  • 7