github.com/goreleaser/goreleaser@v1.25.1/www/docs/customization/artifactory.md (about) 1 # Artifactory 2 3 Publish your artifacts to an Artifactory instance. 4 5 ## How it works 6 7 You can declare multiple Artifactory instances. 8 All binaries generated by your `builds` section will be pushed to 9 each configured Artifactory. 10 11 If you have only one Artifactory instance, 12 the configuration is as easy as adding the 13 upload target, and a username to your `.goreleaser.yaml` file: 14 15 ```yaml 16 artifactories: 17 - name: production 18 target: http://<Your-Instance>:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/ 19 username: goreleaser 20 ``` 21 22 Prerequisites: 23 24 - A running Artifactory instances 25 - A user + password / client x509 certificate / API key with grants to upload 26 an artifact 27 28 ### Target 29 30 The `target` is the URL to upload the artifacts to (_without_ the name of the 31 artifact). 32 33 An example configuration for `goreleaser` in upload mode `binary` with the 34 target can look like 35 36 ```yaml 37 - mode: binary 38 target: "http://artifacts.company.com:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/{{ .Os }}/{{ .Arch }}{{ if .Arm }}{{ .Arm }}{{ end }}" 39 ``` 40 41 And will result in a final deployment like 42 `http://artifacts.company.com:8081/artifactory/example-repo-local/goreleaser/1.0.0/Darwin/x86_64/goreleaser`. 43 44 Supported variables: 45 46 - `Version` 47 - `Tag` 48 - `ProjectName` 49 - `Os` 50 - `Arch` 51 - `Arm` 52 53 !!! info 54 55 Variables _Os_, _Arch_ and _Arm_ are only supported in upload mode `binary`. 56 57 ### Username 58 59 Your configured username needs to be authenticated against your Artifactory. 60 61 You can have the username set in the configuration file as shown above, or you 62 can have it read from an environment variable. The configured name of your 63 Artifactory instance will be used to build the environment variable name. This 64 way we support authentication for multiple instances. This also means that the 65 `name` per configured instance needs to be unique per GoReleaser configuration. 66 67 The name of the environment variable will be `ARTIFACTORY_NAME_USERNAME`. 68 If your instance is named `production`, you can store the username in the 69 environment variable `ARTIFACTORY_PRODUCTION_USERNAME`. 70 The name will be transformed to uppercase. 71 72 If a configured username is found in the configuration file, then the 73 environment variable is not used at all. 74 75 ### Password / API Key 76 77 The password or API key will be stored in an environment variable. 78 The configured name of your Artifactory instance will be used. 79 With this way we support auth for multiple instances. 80 This also means that the `name` per configured instance needs to be unique 81 per goreleaser configuration. 82 83 The name of the environment variable will be `ARTIFACTORY_NAME_SECRET`. 84 If your instance is named `production`, you need to store the secret in the 85 environment variable `ARTIFACTORY_PRODUCTION_SECRET`. 86 The name will be transformed to uppercase. 87 88 ### Client authorization with x509 certificate (mTLS / mutual TLS) 89 90 If your artifactory server supports authorization with mTLS (client 91 certificates), you can provide them by specifying the location of an x509 92 certificate/key pair of pem-encode files. 93 94 ```yaml 95 artifactories: 96 - name: production 97 target: http://<Your-Instance>:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/ 98 client_x509_cert: path/to/client.cert.pem 99 client_x509_key: path/to/client.key.pem 100 ``` 101 102 This will offer the client certificate during the TLS handshake, which your 103 artifactory server may use to authenticate and authorize you to upload. 104 105 ### Server authentication 106 107 You can authenticate your Artifactory TLS server adding a trusted X.509 108 certificate chain in your configuration. 109 110 The trusted certificate chain will be used to validate the server certificates. 111 112 You can set the trusted certificate chain using the `trusted_certificates` 113 setting the artifactory section with PEM encoded certificates on a YAML literal 114 block like this: 115 116 ```yaml 117 puts: 118 - name: "some artifactory server with a private TLS certificate" 119 #...(other settings)... 120 trusted_certificates: | 121 -----BEGIN CERTIFICATE----- 122 MIIDrjCCApagAwIBAgIIShr2zchZo+8wDQYJKoZIhvcNAQENBQAwNTEXMBUGA1UE 123 ...(edited content)... 124 TyzMJasj5BPZrmKjJb6O/tOtEIJ66xPSBTxPShkEYHnB7A== 125 -----END CERTIFICATE----- 126 -----BEGIN CERTIFICATE----- 127 MIIDrjCCApagAwIBAgIIShr2zchZo+8wDQYJKoZIhvcNAQENBQAwNTEXMBUGA1UE 128 ...(edited content)... 129 TyzMJasj5BPZrmKjJb6O/tOtEIJ66xPSBTxPShkEYHnB7A== 130 -----END CERTIFICATE----- 131 ``` 132 133 ## Customization 134 135 Of course, you can customize a lot of things: 136 137 ```yaml 138 # .goreleaser.yaml 139 artifactories: 140 # You can have multiple Artifactory instances. 141 - # Unique name of your artifactory instance. Used to identify the instance 142 name: production 143 144 # IDs of the artifacts you want to upload. 145 ids: 146 - foo 147 - bar 148 149 # File extensions to filter for. 150 # This might be useful if you have multiple packages with different 151 # extensions with the same ID, and need to upload each extension to 152 # a different place (e.g. nFPM packages). 153 # 154 # Since: v1.7 155 exts: 156 - deb 157 - rpm 158 159 # Matrix will run the upload for each possible combination of the given 160 # values. 161 # The keys will be available as template variables in the `target` and 162 # `custom_headers` fields. 163 # 164 # This feature is only available in GoReleaser Pro. 165 # Since: v1.20 (pro) 166 matrix: 167 foo: [bar zaz] 168 something: [foobar somethingelse anotherthing] 169 170 # Upload mode. Valid options are `binary` and `archive`. 171 # 172 # If mode is `archive`, variables _Os_, _Arch_ and _Arm_ for target name 173 # are not supported. In that case these variables are empty. 174 # 175 # If mode is `binary`, you'll need to have the archives section setup with 176 # format "binary" as well. 177 # 178 # Default: 'archive' 179 mode: archive 180 181 # URL of your Artifactory instance + path to deploy to 182 target: http://artifacts.company.com:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/ 183 184 # Tells goreleaer not to append the artifact name to the target URL. You must do this manually 185 custom_artifact_name: true 186 187 # User that will be used for the deployment 188 username: deployuser 189 190 # Client certificate and key (when provided, added as client cert to TLS connections) 191 # 192 # Since: v1.11 193 client_x509_cert: /path/to/client.cert.pem 194 client_x509_key: /path/to/client.key.pem 195 196 # Upload checksums. 197 checksum: true 198 199 # Upload metadata.json and artifacts.json. 200 # 201 # Since: v1.25 202 meta: true 203 204 # Upload signatures. 205 signature: true 206 207 # Certificate chain used to validate server certificates 208 trusted_certificates: | 209 -----BEGIN CERTIFICATE----- 210 MIIDrjCCApagAwIBAgIIShr2zchZo+8wDQYJKoZIhvcNAQENBQAwNTEXMBUGA1UE 211 ...(edited content)... 212 TyzMJasj5BPZrmKjJb6O/tOtEIJ66xPSBTxPShkEYHnB7A== 213 -----END CERTIFICATE----- 214 ``` 215 216 !!! success "GoReleaser Pro" 217 218 Some options are only available in [GoReleaser Pro feature](/pro/). 219 220 These settings should allow you to push your artifacts into multiple 221 **Artifactory** instances. 222 223 !!! tip 224 225 Learn more about the [name template engine](/customization/templates/).