TT#26827 Release panel triggers jenkins jobs with branch=none

Attempt to fix problem when release panel triggers jenkins jobs
setting branch=none when tag=mrX.X.X.1, when the branch parameter
should have branch=mrX.X.X

Change-Id: Ic510cec2e94400a5c5a3c8bb0935ff19cdf0ce17
changes/80/17480/2
Manuel Montecelo 8 years ago
parent 563929c2e3
commit 4f4c28d92d

@ -14,6 +14,7 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import string
import urllib
import uuid
from django.conf import settings
@ -46,6 +47,11 @@ def trigger_build(project, release_uuid, trigger_release=None,
if trigger_branch_or_tag.startswith("tag/"):
tag = trigger_branch_or_tag.split("tag/")[1]
params['tag'] = urllib.parse.quote(tag)
# branch is like tag but removing the last element,
# e.g. tag=mr5.5.2.1 -> branch=mr5.5.2
branch = string.join(tag.split(".")[0:-1], ".")
params['branch'] = urllib.parse.quote(branch)
elif trigger_branch_or_tag.startswith("branch/"):
branch = trigger_branch_or_tag.split("branch/")[1]
params['branch'] = urllib.parse.quote(branch)

Loading…
Cancel
Save