Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcsRevision and vcsUrl ignored by maven-artifactory-plugin #544

Open
skulczycki opened this issue Aug 6, 2021 · 1 comment
Open

vcsRevision and vcsUrl ignored by maven-artifactory-plugin #544

skulczycki opened this issue Aug 6, 2021 · 1 comment
Labels
maven bug Create a report to help us improve

Comments

@skulczycki
Copy link

skulczycki commented Aug 6, 2021

Describe the bug
I have noticed that the Artifactory Maven plugin is not deploying VCS information with the BuildInfo. Whatever I set in vcsRevision and vcsVersion is ignored.

According to the documentation following fields should be included in the build info:

<buildInfo>
  <agentName> .. </agentName>
  <agentVersion> .. </agentVersion>
  <buildName> .. </buildName>
  <buildNumber> .. </buildNumber>
  <buildNumbersNotToDelete> .. </buildNumbersNotToDelete>
  <buildRetentionMaxDays>N</buildRetentionMaxDays>
  <buildRetentionCount>N</buildRetentionCount>
  <buildUrl> .. </buildUrl>
  <principal> .. </principal>
  <vcsRevision> .. </vcsRevision>
</buildInfo>

I did some digging in the code and to me it looks like the problem is in BuildInfoBuilder class. The build() function in ignores

    protected String vcsRevision;
    protected String vcsUrl;

properties and only does this:
build.setVcs(vcs);

I think that there should be some extra logic to check if vcs is empty and and vcsRevision not.

The documentation says it should use this field and I'm sure that in previous versions of the plugin it did:
https://www.jfrog.com/confluence/display/JFROG/Maven+Artifactory+Plugin

To Reproduce
It can be on test level. Modify the:
https://github.com/jfrog/artifactory-maven-plugin/blob/master/src/test/resources/unit-tests-pom/pom.xml
and add:

                                <vcsRevision>1234</vcsRevision>
                                <vcsUrl>http://1.2.3.4/git/repository</vcsUrl>

In the unit test: https://github.com/jfrog/artifactory-maven-plugin/blob/master/src/test/java/org/jfrog/buildinfo/BuildInfoRecorderTest.java check if vcs field is populated.

Expected behavior
BuildInfo published to the Artifactory contains VCS information.

Versions

  • Maven Artifactory plugin version: 3.2.3 and 3.2.1
  • Operating system: Linux and Windows
  • Artifactory Version: 7.12.6
@skulczycki skulczycki added the maven bug Create a report to help us improve label Aug 6, 2021
@skulczycki
Copy link
Author

Previous version of the plugin did it here:

So this actually means that code should be changed in here:
https://github.com/jfrog/artifactory-maven-plugin/blob/ddabcf28df900092736c1b3ecdcc3b211c8ad00e/src/main/java/org/jfrog/buildinfo/deployment/BuildInfoModelPropertyResolver.java#L59

  private void resolveProperties(ArtifactoryClientConfiguration clientConf) {
        artifactoryPluginVersion(clientConf.info.getArtifactoryPluginVersion());
        artifactoryPrincipal(clientConf.publisher.getName());
        parentNumber(clientConf.info.getParentBuildNumber());
        parentName(clientConf.info.getParentBuildName());
        vcsRevision(clientConf.info.getVcsRevision()); // This is incorrect and not working
        principal(clientConf.info.getPrincipal());
        url(clientConf.info.getBuildUrl());
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maven bug Create a report to help us improve
Projects
None yet
Development

No branches or pull requests

1 participant