|
| 1 | +Multi-Step Build Info Pipeline (Upload → Add Deps → Download → Publish → Cleanup) |
| 2 | + |
| 3 | +Overview |
| 4 | +- No JFrog CLI required; the plugin uses the JFrog Go Client SDK. |
| 5 | +- Upload, Download, and Add-Build-Dependencies steps save build-info partials locally using build-info-go. |
| 6 | +- Publish step aggregates and publishes the full build-info to Artifactory. |
| 7 | +- Optional auto-clean and explicit cleanup supported. |
| 8 | + |
| 9 | +Example (Harness CI Plugin steps) |
| 10 | + |
| 11 | +```yaml |
| 12 | +# 1) Upload artifacts and accumulate build-info (partials) |
| 13 | +- step: |
| 14 | + type: Plugin |
| 15 | + name: UploadArtifacts |
| 16 | + identifier: UploadArtifacts |
| 17 | + spec: |
| 18 | + connectorRef: account.harnessImage |
| 19 | + image: plugins/artifactory:linux-amd64 |
| 20 | + settings: |
| 21 | + url: https://URL.jfrog.io/artifactory |
| 22 | + username: user |
| 23 | + password: <+secrets.getValue("jfrog_password")> |
| 24 | + # Either use source/target or a file spec |
| 25 | + source: /harness/build/output/**/*.jar |
| 26 | + target: libs-release-local/path/in/repo/ |
| 27 | + build_name: sample-build |
| 28 | + build_number: 123 |
| 29 | + # Optional: properties on target |
| 30 | + target_props: key1=value1,key2=value2 |
| 31 | + # Do not publish yet (accumulate partials) |
| 32 | + publish_build_info: false |
| 33 | + |
| 34 | +# 2) Add build dependencies (from filesystem). Also accumulates partials |
| 35 | +- step: |
| 36 | + type: Plugin |
| 37 | + name: AddBuildDependencies |
| 38 | + identifier: AddBuildDependencies |
| 39 | + spec: |
| 40 | + connectorRef: account.harnessImage |
| 41 | + image: plugins/artifactory:linux-amd64 |
| 42 | + settings: |
| 43 | + command: add-build-dependencies |
| 44 | + url: https://URL.jfrog.io |
| 45 | + username: user |
| 46 | + password: <+secrets.getValue("jfrog_password")> |
| 47 | + build_name: sample-build |
| 48 | + build_number: 123 |
| 49 | + module: generic-module |
| 50 | + # Collect dependencies from local filesystem |
| 51 | + dependency: /harness/inputs/**/*.zip |
| 52 | + # Or collect from Artifactory: |
| 53 | + # from_rt: true |
| 54 | + # dependency: libs-release-local/**/*.jar |
| 55 | + |
| 56 | +# 3) Download artifacts (records dependencies into build-info partials) |
| 57 | +- step: |
| 58 | + type: Plugin |
| 59 | + name: DownloadArtifacts |
| 60 | + identifier: DownloadArtifacts |
| 61 | + spec: |
| 62 | + connectorRef: account.harnessImage |
| 63 | + image: plugins/artifactory:linux-amd64 |
| 64 | + settings: |
| 65 | + command: download |
| 66 | + url: https://URL.jfrog.io/artifactory |
| 67 | + username: user |
| 68 | + password: <+secrets.getValue("jfrog_password")> |
| 69 | + build_name: sample-build |
| 70 | + build_number: 123 |
| 71 | + module: generic-module |
| 72 | + # Use a file spec (recommended) |
| 73 | + spec: | |
| 74 | + { |
| 75 | + "files": [ |
| 76 | + { "pattern": "libs-release-local/com/example/**/artifact-*.jar", |
| 77 | + "target": "./downloads/", |
| 78 | + "recursive": "true", |
| 79 | + "flat": "false" |
| 80 | + } |
| 81 | + ] |
| 82 | + } |
| 83 | +
|
| 84 | +# 4) Publish build-info (aggregates all partials). Optionally auto-clean afterwards |
| 85 | +- step: |
| 86 | + type: Plugin |
| 87 | + name: PublishBuildInfo |
| 88 | + identifier: PublishBuildInfo |
| 89 | + spec: |
| 90 | + connectorRef: account.harnessImage |
| 91 | + image: plugins/artifactory:linux-amd64 |
| 92 | + settings: |
| 93 | + command: publish-build-info |
| 94 | + url: https://URL.jfrog.io |
| 95 | + username: user |
| 96 | + password: <+secrets.getValue("jfrog_password")> |
| 97 | + build_name: sample-build |
| 98 | + build_number: 123 |
| 99 | + cleanup_after_publish: true |
| 100 | + |
| 101 | +# 5) (Optional) Explicit cleanup step (only needed if not using cleanup_after_publish) |
| 102 | +- step: |
| 103 | + type: Plugin |
| 104 | + name: CleanBuildInfo |
| 105 | + identifier: CleanBuildInfo |
| 106 | + spec: |
| 107 | + connectorRef: account.harnessImage |
| 108 | + image: plugins/artifactory:linux-amd64 |
| 109 | + settings: |
| 110 | + command: cleanup |
| 111 | + build_name: sample-build |
| 112 | + build_number: 123 |
| 113 | +``` |
| 114 | +
|
| 115 | +Notes |
| 116 | +- TLS: Provide custom CA PEM via `pem_file_contents` or `pem_file_path`. To skip verification, set `insecure: true`. |
| 117 | +- Access token: You can use `access_token` in place of `username`/`password`. |
| 118 | +- If you prefer to publish after each operation, set `publish_build_info: true` on those steps (and optionally `cleanup_after_publish: true`). |
| 119 | + |
0 commit comments