Parker Stovall
Parker Stovall

Reputation: 1

Jenkins - Writing variable to log file

Running my jenkins pipeline I am able to have it output the commit message correctly using

gitnotes = sh ("git log -1 --pretty=%h%x09%an%x09%ad%x09%s")

8c65c33 NAME HERE Tue Nov 13 16:30:00 2018 -0500 Adjusted search/reset buttons' size in dashboard panel

However I now want to store those commit notes to a log file, but even when I use an echo it comes back as null.

echo "${gitnotes}"

I might be losing my mind, but how would I go about writing the above notes to a log file? I'm having a super bad day apparently as this is something I am just not looking at correctly.

Upvotes: 0

Views: 167

Answers (1)

Ravindranath Barathy
Ravindranath Barathy

Reputation: 791

Try setting returnStdout: true

Eg: gitnotes = sh script: "git log -1 --pretty=%h%x09%an%x09%ad%x09%s" , returnStdout: true

Upvotes: 0

Related Questions