lfit / github2gerrit

Github PR to Gerrit Change request
Other
2 stars 3 forks source link

Incorrect parsing of .gitreview file #18

Closed ModeSevenIndustrialSolutions closed 1 week ago

ModeSevenIndustrialSolutions commented 1 week ago

An initial test workflow invocation failed for ONAP: https://github.com/onap/portal-ng-bff/actions/runs/11346946427/job/31557176880

The exact error occurs when parsing the .gitreview file:

++ grep -E host .gitreview
++ cut -d = -f2
+ gerrit_server=gerrit.onap.org
++ grep -E port .gitreview
++ cut -d = -f2
+ gerrit_server_port='29418
portal-ng/bff'
+ echo GERRIT_SERVER=gerrit.onap.org
+ echo 'GERRIT_SERVER_PORT=29418
portal-ng/bff'
Error: Unable to process file command 'env' successfully.
Error: Invalid format 'portal-ng/bff'

I've tested the extraction of these variables from a local shell in the portal-ng/bff repository.

Here's the .gitreview contents:

[gerrit]
host=gerrit.onap.org
port=29418
project=portal-ng/bff
defaultbranch=master%

Here's my output:

bff (🌴 github2gerrit) % gerrit_server=$(grep -E "host" .gitreview | cut -d "=" -f2)
bff (🌴 github2gerrit) % gerrit_server_port=$(grep -E "port" .gitreview | cut -d "=" -f2)
bff (🌴 github2gerrit) % echo $gerrit_server
gerrit.onap.org
bff (🌴 github2gerrit) % echo $gerrit_server_port
29418 portal-ng/bff

Seems the port number has additional output appended (in this case we are accidentally capturing the next line containing the text "portal-ng/bff"). I will raise a PR to more carefully populate the required value.

ModeSevenIndustrialSolutions commented 1 week ago

https://regex101.com/r/PVEpiD/1

ModeSevenIndustrialSolutions commented 1 week ago

Pull request raised here: https://github.com/lfit/github2gerrit/pull/19