Skip to content

Allow /d:sonar.branch.name and /v on dotnet-sonarscanner end instead of beginΒ #978

@qrjo

Description

@qrjo

Is your feature request related to a problem? Please describe.
I'm building my C# project inside a Docker build. The C# project is part of a bigger solution, so it's possible that nothing changes in the C# code compared to the previous build. If nothing has changed on the source code, I would like to use the Docker cache to improve the build time. If successful, this means the build time goes down from 8 minutes to 1 second.

The SonarScanner is an issue in this. dotnet-sonarscanner begin has to be run before the build starts. This is not a problem by itself, but the branch name and version parameters have to be passed to the begin command. Since these change often (the version parameter changes on every build in my solution), they invalidate the Docker cache on every build. So that's 8 minutes of build time wasted on building a project that hasn't changed.

Describe the solution you'd like
A solution for this problem would be to allow the branch name and version to be passed to dotnet-sonarscanner end. That way the SonarScanner runs during the build without the branch name and version, which means the Docker cache is not invalidated. After the build is finished and cached, dotnet-sonarscanner end can be run with the branch name and version and the cache will invalidate from this point. This happens at the very end of the build, so invalidating the cache from that point doesn't cost much build time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions