I am trying to get the commitId using the bitbucket classes running it in script posthooks
import com.atlassian.bitbucket.commit.AbstractCommitRequest;
import com.atlassian.bitbucket.commit.CommitRequest;
import com.atlassian.bitbucket.commit.CommitService;
def commitId = commit.getCommitId()
It throws me below error
[static type checking] variable commit is undeclared.