Project key value is not being respected during pipeline build


(Tezcan) #1

Hi all,
I am using bitbucket cloud pipeline feature to kickoff a sonar analysis to put results onto sonar cloud. However, it is not using the project_key value I defined on the .yml file I defined. Instead it pulls the below one (looks like combines the group/artifact ids from the pom.xml) as below

[INFO] Project key: it.cnr.iit.usagecontrolframework:UsageControl

Of course this results in error indicating that
“A regular analysis is required before a branch analysis”

Since I dont have access to declare variables at account level, as described in a very similar issue:
(A regular analysis is required before a branch analysis )
I entered the prjectKey/organisation/token as hard coded values, instead of using variables, as below:

      - mvn -B verify sonar:sonar  \	
          -Dsonar.organization=myOrganisation  \
          -Dsonar.projectKey=UCON_UCS   \

Unfortunately this did not make a difference either, it is still using that project key I showed above.

I have also declared the variables as Pipeline repository variables (according to description, these override the ones at account level) but this did not help either.

I would appreciate any help/ideas

thanks in advance
P.S. Needless to say that the above mvn commend of course works fine locally and the sonarcloud gets updated.

(Tezcan) #2

I solved this :slight_smile:
By putting all of the arguments of mvn on one line !!!
Yes, if the sonar arguments are broken into seperate lines like on a local cmdline execution, then the Piepline does not recognsie any of them.
So ensure you put everything into one line