Think i’ve found a working hack.
-
api/projects/search?projects
to check if project already exists -
api/projects/create
if it doesn’t exist -
api/new_code_periods/set?project=$projectkey&type=REFERENCE_BRANCH&value=master
-
api/new_code_periods/set?project=$projectkey&branch=master&type=PREVIOUS_VERSION
-
run Sonarqube analysis
Thought 3. would not be possible if project is newly created in 2. ,but it is.
Should also be almost safe for parallel builds and scans of the same project !?
After all this is no clean solution, hope it gets polished with the next versions !!
Out of curiousity
What were the reasons to break with the use of the sonar.branch.target
property ??