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
diff --git a/src/ci/mcp/Tools.txt b/src/ci/mcp/Tools.txt
new file mode 100644
index 0000000..12377b1
--- /dev/null
+++ b/src/ci/mcp/Tools.txt
@@ -0,0 +1,45 @@
+getBinaryBuildProperties
+------------------------
+
+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:
+
+ com.mirantis.gerritProject=asd;com.mirantis.gerritChangeNumber=123;com.mirantis.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