Git-commit-id-maven-plugin: Azure DevOps - Git branch name

Created on 30 Sep 2019  路  7Comments  路  Source: git-commit-id/git-commit-id-maven-plugin

Describe your idea

AzureDevops checks out Git branches in detached mode, resulting in git.branch being populated with the commit hash.

Expected Behavior

The branch name can be populated from BUILD_SOURCEBRANCHNAME environment vaiable as per Azure Devops / Azure Pipelines - Build variables

Additional context

Will provide a pull request soon with proposed changes for review.

improvement

All 7 comments

Thanks for creating an issue! That sounds reasonable.

Just as a hint (if you not already know):
This sounds like it would be similar to the TravisBuildServerData or other BuildExtractors we already have for other CI environments. I guess in the easiest case you just need to write one for the Azure environment and extend the functionality to obtain such provider.

Thanks @TheSnoozer

I had a quick look around at the Azure Pipeline environment variables and the source code, I found exactly what you pointed out, thanks for that. Running some tests now and creating the pull request soon for you guys to review (Y)

Thanks for making the changes and improving this project!
Feel free to assign the MR to me and I'll review when I got some free time ;-)

Implemented via https://github.com/git-commit-id/maven-git-commit-id-plugin/pull/439.

Thanks for your contribution!

@TheSnoozer Entirely my pleasure, thank you guys for writing the plugin in the first place! (Y)

It's always great to know that this plugin is still in use :-)
I personally have switched to gradle which has other downsides compared to maven ;-)

Anyhow, as far as i remember travis deploys snapshots of the master-branch to oss-sonatype. if you want to start to use this feature you could already do so, by specifying the Sonatype-Snapshot repo.

e.g.

<pluginRepositories>
    <pluginRepository>
        <id>sonatype-snapshots</id>
        <name>Sonatype Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </pluginRepository>
</pluginRepositories>

If you'd prefer a more official release feel free to ping me in https://github.com/git-commit-id/maven-git-commit-id-plugin/issues/432. Releases only happen randomly or when users (YOU) ask for it ;-)

Thank you, didn't know about the Sonatype snapshot builds, I had deployed mine on our Artficatory to be able to test it. Thanks for the notes, whenever you feel it's worth releasing it it's fine, no pressure :-)

Was this page helpful?
0 / 5 - 0 ratings