Skip to content

manual setBuildNumber causes build number matrix not to be reported #141

Closed
@regevbr

Description

@regevbr

Currently, if you want to set the build number manually, you can use the clientConfig.info.setBuildNUmber() which is great but has a bad side affect - the build.number property is not attached to the artifact, thus causing the artifact to not be aware to the build that created it (and making the promote action on the build fail).
The reason for that is the code in GradleArtifactoryClientConfigUpdater.setMissingBuildAttributes. There, if no one set manually the build number it sets it for you and publishes the property to the artifact by doing

        if (StringUtils.isBlank(buildNumber)) {
            buildNumber = new Date().getTime() + "";
            config.info.setBuildNumber(buildNumber);
            config.publisher.addMatrixParam(BuildInfoFields.BUILD_NUMBER, buildNumber);
        }

But in the case you set it manually, no one adds it to the properties. The fix currently is to add the extra code yourself but I found it out the hard way by tracing your code.
The same occurs for buildName and the rest of the properties in that class.
I think the fix should be to set the matrix param only if it was not set, separately from the buildName set in the info

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions