Skip to content

Instantly share code, notes, and snippets.

@porfirion
Created March 28, 2019 13:39
Show Gist options
  • Save porfirion/d947f435d6764256f11a629b48060b8a to your computer and use it in GitHub Desktop.
Save porfirion/d947f435d6764256f11a629b48060b8a to your computer and use it in GitHub Desktop.
Example of generation version.json file from git commit info to use in Jenkins
git log -1 --pretty=format:' {"id": "%H", "id_short": "%h", "message": "%s", "author": "%aN", "date": "%aD", "comitter": "%cN", "commit_date": "%cD", ' \
| (cat && printf '"build_date": "%s",' "$(date -R)") \
| (cat && printf '"branch": "%s"' "${BRANCH}") \
| (cat && printf '}') > version.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment