vishwanatharondekar/gitlab-cli

Why succed when baseBranch is not defined?

carlosen14 opened this issue · 8 comments

I am having this issue, this runs on gitlab pipeline, it couldn't create the mr but it exits 0 ..

ORIGIN_BRANCH dev
TARGET_BRANCH staging
$ npx git-lab-cli@2.0.4 merge-request --base "origin/$ORIGIN_BRANCH" --target "origin/$TARGET_BRANCH" --message "AUTOMATIC MERGE REQUEST FROM PIPELINE $ORIGIN_BRANCH > $TARGET_BRANCH" --labels "pipeline,automr,deploy,$TARGET_BRANCH" --print
npx: installed 103 in 13.781s
Couldn't create merge request
baseBranch is not defined # this is supposed to exit 1 to assume this couldn't make it
#
#
Job succeeded 

both branches do exist on repository.. dev and staging

this is the verbose

Verbose option used. Detailed logging information will be emitted.



Getting base branch information

Getting base branch name : 
Argument provided : origin/dev
Branch name obtained : dev
Base branch name obtained : dev

Getting remote of branch : origin/dev
Branch name obtained : dev
Remote obtained : origin

Getting URL of remote : origin
Executing  git config remote.origin.url
URL of remote obtained : https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@gitlab.com/group/subgroup/repo.git


gitlab host obtained : gitlab.com
Couldn't create merge request
baseBranch is not defined

This looks like some unhandled case. Will have a look.

Made a few PR to help you handle this.. but still can't create the MR, don't know what that error means..

This is happening because regex is not able to handle the project names with more than one slashes in it or something similar, causing the error to be thrown that "please check if this is a valid git project". In my recent refactoring I changed some variables causing this case to break for variable not defined. Will fix both of these over the weekend.

ok thanks, this is a valid gitlab repository, a group/subgroup/repo.git

This is fixed in #81 and 2.0.6 is published to npm.