I am using Jenkins for a CI/CD. Git repository has a Jenkins hook so it triggers new build on each push, which includes tags.
My build, triggered by tag, produces following output.
commit notification 282aa9df9bc037df26f82d0aaf7d65e57b3c6c00
Building in workspace /var/jenkins_home/workspace/testproject
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url ssh://GIT-HOST/PRJ/REPO.git # timeout=10
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
Resetting working tree
> git reset --hard # timeout=10
> git clean -fdx # timeout=10
Fetching upstream changes from ssh://GIT-HOST/PRJ/REPO.git
> git --version # timeout=10
> git fetch --tags --progress ssh://GIT-HOST/PRJ/REPO.git +refs/heads/*:refs/remotes/origin/*
(1) > git rev-parse 282aa9df9bc037df26f82d0aaf7d65e57b3c6c00^{commit} # timeout=10
(2) > git branch -a -v --no-abbrev --contains 18dea36c9ada06c1c176b8864bb28166e2bdac3f # timeout=10
Checking out Revision 18dea36c9ada06c1c176b8864bb28166e2bdac3f (tagtag, origin/tagtag)
> git checkout -f 18dea36c9ada06c1c176b8864bb28166e2bdac3f
As you can see, build is triggered by 282aa9d (1), which is a tag, but later on, it's translated to commit 18dea36 (2) and from that point only a commit info is available for the user (ex: env variables.) This is a valid commit, but tag info is not available anymore.
How can I know a build has been triggered by a tag, get that tag info and be able to use it in a pipeline?
Edit: Just to clarify - I am looking for an option to have a job that triggers a build on all pushes, but in case of a tag does execute additional steps (or suppress other steps.)