Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is mapping ci-condition-opt from the command line wrong? #134

Closed
ted-vo opened this issue Mar 11, 2022 · 3 comments
Closed

Is mapping ci-condition-opt from the command line wrong? #134

ted-vo opened this issue Mar 11, 2022 · 3 comments

Comments

@ted-vo
Copy link

ted-vo commented Mar 11, 2022

Hi!
My repo setting default branch: develop
I just want to use ci-condition-opt to override defaultBranch.
My command:
./semantic-release --provider gitlab --ci-condition gitlab --ci-condition-opt defaultBranch="*" --token ***

I see code override ci-condition-opt here:

for k, v := range conf.CIConditionOpts {

image

and pass the conf to condition-gitlab and run condition here:
https://github.com/go-semantic-release/condition-gitlab/blob/268fae569178cdfc0b17da5122fa30c7d77f8a03/pkg/condition/gitlab.go#L34
image

Expected behavior:
It should be py pass defaultBranch to "*"

Actual behavior:
defaultBranch run atcondition-gitlab.RunCondition still is value from repoInfo.DefaultBranch


Try to debug:
I just build go-semantic-release by myself to log what it happended
image
Result is in a picture. Value defaultBranch="*" from commend line has been change to defaultbranch:* (key was lowercase). But actual key is defaultBranch pass to RunCondition.

Is it a bug?

p/s: Sorry because English is not my primary language.

@ted-vo ted-vo changed the title Mapping ci-condition-opt from command line is wrong Is mapping ci-condition-opt from the command line wrong? Mar 11, 2022
@christophwitzko
Copy link
Member

Hey @ted-v9n, thanks for investigating this.
You are right, passed options are converted to the lowercase representation:

opts[strings.ToLower(sOpt[0])] = sOpt[1]

So yes, this is a bug and it is currently impossible to overwrite camelCase configuration options. In your case, you could try the --no-ci flag to skip the ci condition.

@ted-vo
Copy link
Author

ted-vo commented Mar 13, 2022

Hi @christophwitzko , thank you so much. I appiled --no-ci to workaround. 👌

@christophwitzko
Copy link
Member

awesome, I also fixed it with the next release 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants