Answer the question
In order to leave comments, you need to log in
Why is Jenkins running a job endlessly?
Created a job with free configurations and set up source control.
As Branches to build (Branch Specifier (blank for 'any'))
:^origin\/hotfix\-order\-html\-(.*)$
I thought it worked fine, but then I noticed that the job started spontaneously.
The build trigger of course is "Poll SCM for changes", on schedule
H/10 * * * *
Maybe someone can tell me if I need the job to react to new branches or changes to the current ones according to the template above. In general it works, but why it runs the build without a change in the repository - I don't know.
Answer the question
In order to leave comments, you need to log in
In the end, I had to use a webhook.
For some reason, if I use a regular expression, the $GIT_BRANCH environment variable seems to contain an irrelevant match (for some reason, a branch of a previous job build). And apparently, the change trigger in the SCM works endlessly.
When using webhooks, the $gitlabBranch environment variable is available to me, and the regular expression itself is already registered in the job's webhook settings.
also, just in case, in the shell script that I run as part of a specific job, I check for the presence of $gitlabBranch
if [ -n "${gitlabBranch}" ]; then
echo "gitlabBranch is set ${gitlabBranch}"
else
echo "gitlabBranch isn't set"
exit 1
fi
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question