Sergey Kulanov | 56d0d05 | 2016-10-13 15:48:56 +0300 | [diff] [blame^] | 1 | getBinaryBuildProperties |
| 2 | ------------------------ |
| 3 | |
| 4 | 1. getBinaryBuildProperties() should be used to define mandatory |
| 5 | properties for binary artifact, which are: |
| 6 | |
| 7 | "gerritProject=${env.GERRIT_PROJECT}", |
| 8 | "gerritChangeNumber=${env.GERRIT_CHANGE_NUMBER}", |
| 9 | "gerritPatchsetNumber=${env.GERRIT_PATCHSET_NUMBER}", |
| 10 | "gerritChangeId=${env.GERRIT_CHANGE_ID}", |
| 11 | "gitSha=${env.GERRIT_PATCHSET_REVISION}" |
| 12 | |
| 13 | 2. User can add some custom properties, e.g: |
| 14 | |
| 15 | def properties = tools.getBinaryBuildProperties( |
| 16 | ["test=123", |
| 17 | "prop1=val1", |
| 18 | prop2=val2" |
| 19 | ]) |
| 20 | |
| 21 | 3. The resulting values will be the string in props format with |
| 22 | namespace com.mirantis, e.g: |
| 23 | |
| 24 | com.mirantis.gerritProject=asd;com.mirantis.gerritChangeNumber=123;com.mirantis.gerritChangeId=ddd |
| 25 | |
| 26 | 4. How to use: |
| 27 | |
| 28 | def tools = new ci.mcp.Tools() |
| 29 | ... |
| 30 | def buildInfo = Artifactory.newBuildInfo() |
| 31 | ... |
| 32 | def properties = tools.getBinaryBuildProperties() |
| 33 | ... |
| 34 | // Create the upload spec. |
| 35 | def uploadSpec = """{ |
| 36 | "files": [ |
| 37 | { |
| 38 | "pattern": "**", |
| 39 | "target": "some/target", |
| 40 | "props": "${properties}" |
| 41 | } |
| 42 | ] |
| 43 | }""" |
| 44 | server.upload(uploadSpec, buildInfo) |
| 45 | server.publishBuildInfo buildInfo |