@ -14,6 +14,7 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
# with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import logging
import string
import urllib
import urllib
import uuid
import uuid
from django . conf import settings
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/ " ) :
if trigger_branch_or_tag . startswith ( " tag/ " ) :
tag = trigger_branch_or_tag . split ( " tag/ " ) [ 1 ]
tag = trigger_branch_or_tag . split ( " tag/ " ) [ 1 ]
params [ ' tag ' ] = urllib . parse . quote ( tag )
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/ " ) :
elif trigger_branch_or_tag . startswith ( " branch/ " ) :
branch = trigger_branch_or_tag . split ( " branch/ " ) [ 1 ]
branch = trigger_branch_or_tag . split ( " branch/ " ) [ 1 ]
params [ ' branch ' ] = urllib . parse . quote ( branch )
params [ ' branch ' ] = urllib . parse . quote ( branch )