Created
December 18, 2020 21:31
-
-
Save starwarsfan/f8e35ef691fd2d3968af9cac842ce4e9 to your computer and use it in GitHub Desktop.
Jenkins declarative pipeline env var definition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
environment { | |
DEVELOP_TAG = "Build${BUILD_NUMBER}" | |
RELEASE_TAG = sh( | |
script: "printf \$(grep CLIENT_VERSION_MAJOR CMakeLists.txt | head -n1 | cut -d ' ' -f2 | sed 's/)//g' | tr -d '\\n' | tr -d '\\r').\$(grep CLIENT_VERSION_MINOR CMakeLists.txt | head -n1 | cut -d ' ' -f2 | sed 's/)//g' | tr -d '\\n' | tr -d '\\r').\$(grep CLIENT_VERSION_REVISION CMakeLists.txt | head -n1 | cut -d ' ' -f2 | sed 's/)//g' | tr -d '\\n' | tr -d '\\r') | sed 's/ //g'", | |
returnStdout: true | |
) | |
GIT_TAG_TO_USE = "${DEVELOP_TAG}" | |
GIT_COMMIT_SHORT = sh( | |
script: "printf \$(git rev-parse --short ${GIT_COMMIT})", | |
returnStdout: true | |
) | |
CURRENT_DATE = sh( | |
script: "printf \"\$(date '+%F %T')\"", | |
returnStdout: true | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment