Implement getBinaryBuildProperties method
1. getBinaryBuildProperties() should be used to define mandatory
properties for binary artifact, which are:
"gerritProject=${env.GERRIT_PROJECT}",
"gerritChangeNumber=${env.GERRIT_CHANGE_NUMBER}",
"gerritPatchsetNumber=${env.GERRIT_PATCHSET_NUMBER}",
"gerritChangeId=${env.GERRIT_CHANGE_ID}",
"gitSha=${env.GERRIT_PATCHSET_REVISION}"
2. User can add some custom properties, e.g:
def properties = tools.getBinaryBuildProperties(
["test=123",
"prop1=val1",
prop2=val2"
])
3. The resulting values will be the string in props format with
namespace com.mirantis, e.g:
gerritProject=asd;gerritChangeNumber=123;gerritChangeId=ddd
4. How to use:
def tools = new ci.mcp.Tools()
...
def buildInfo = Artifactory.newBuildInfo()
...
def properties = tools.getBinaryBuildProperties()
...
// Create the upload spec.
def uploadSpec = """{
"files": [
{
"pattern": "**",
"target": "some/target",
"props": "${properties}"
}
]
}"""
server.upload(uploadSpec, buildInfo)
server.publishBuildInfo buildInfo
Change-Id: I6dcc879c10b7fccf6dfcd8cb3ce86f52311c1a5a
2 files changed