github.com/fitzix/goreleaser@v0.92.0/www/content/artifactory.md (about)

     1  ---
     2  title: Artifactory
     3  series: customization
     4  hideFromIndex: true
     5  weight: 120
     6  ---
     7  
     8  Since [v0.38.0](https://github.com/goreleaser/goreleaser/releases/tag/v0.38.0),
     9  GoReleaser supports building and pushing artifacts into Artifactory.
    10  
    11  ## How it works
    12  
    13  You can declare multiple Artifactory instances.
    14  All binaries generated by your `builds` section will be pushed to
    15  each configured Artifactory.
    16  
    17  If you have only one Artifactory instance,
    18  the configuration is as easy as adding the
    19  upload target and a username to your `.goreleaser.yml` file:
    20  
    21  ```yaml
    22  artifactories:
    23    - name: production
    24      target: http://<Your-Instance>:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/
    25      username: goreleaser
    26  ```
    27  
    28  Prerequisites:
    29  
    30  - A running Artifactory instances
    31  - A user + password / API key with grants to upload an artifact
    32  
    33  ### Target
    34  
    35  The `target` is the URL to upload the artifacts to (_without_ the name of the artifact).
    36  
    37  An example configuration for `goreleaser` in upload mode `binary` with the target can look like
    38  
    39  ```yaml
    40  - mode: binary
    41    target: 'http://artifacts.company.com:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/{{ .Os }}/{{ .Arch }}{{ if .Arm }}{{ .Arm }}{{ end }}'
    42  ```
    43  
    44  and will result in a final deployment like `http://artifacts.company.com:8081/artifactory/example-repo-local/goreleaser/1.0.0/Darwin/x86_64/goreleaser`.
    45  
    46  Supported variables:
    47  
    48  - Version
    49  - Tag
    50  - ProjectName
    51  - Os
    52  - Arch
    53  - Arm
    54  
    55  _Attention_: Variables _Os_, _Arch_ and _Arm_ are only supported in upload
    56  mode `binary`.
    57  
    58  ### Username
    59  
    60  Your configured username needs to be authenticated against your Artifactory.
    61  
    62  You can have the username set in the configuration file as shown above
    63  or you can have it read from an environment variable.
    64  The configured name of your Artifactory instance will be used to build
    65  the environment variable name.
    66  This way we support auth for multiple instances.
    67  This also means that the `name` per configured instance needs to be unique
    68  per goreleaser configuration.
    69  
    70  The name of the environment variable will be `ARTIFACTORY_NAME_USERNAME`.
    71  If your instance is named `production`, you can store the username in the
    72  environment variable `ARTIFACTORY_PRODUCTION_USERNAME`.
    73  The name will be transformed to uppercase.
    74  
    75  If a configured username is found in the configuration file, then the
    76  environment variable is not used at all.
    77  
    78  ### Password / API Key
    79  
    80  The password or API key will be stored in a environment variable.
    81  The configured name of your Artifactory instance will be used.
    82  With this way we support auth for multiple instances.
    83  This also means that the `name` per configured instance needs to be unique
    84  per goreleaser configuration.
    85  
    86  The name of the environment variable will be `ARTIFACTORY_NAME_SECRET`.
    87  If your instance is named `production`, you need to store the secret in the
    88  environment variable `ARTIFACTORY_PRODUCTION_SECRET`.
    89  The name will be transformed to uppercase.
    90  
    91  ### Server authentication
    92  
    93  You can authenticate your Artifactory TLS server adding a trusted X.509
    94  certificate chain in your configuration.
    95  
    96  The trusted certificate chain will be used to validate the server certificates.
    97  
    98  You can set the trusted certificate chain using the `trusted_certificates`
    99  setting the artifactory section with PEM encoded certificates on a YAML literal
   100  block like this:
   101  
   102  ```yaml
   103  puts:
   104    - name: "some artifactory server with a private TLS certificate"
   105      #...(other settings)...
   106      trusted_certificates: |
   107        -----BEGIN CERTIFICATE-----
   108        MIIDrjCCApagAwIBAgIIShr2zchZo+8wDQYJKoZIhvcNAQENBQAwNTEXMBUGA1UE
   109        ...(edited content)...
   110        TyzMJasj5BPZrmKjJb6O/tOtEIJ66xPSBTxPShkEYHnB7A==
   111        -----END CERTIFICATE-----
   112        -----BEGIN CERTIFICATE-----
   113        MIIDrjCCApagAwIBAgIIShr2zchZo+8wDQYJKoZIhvcNAQENBQAwNTEXMBUGA1UE
   114        ...(edited content)...
   115        TyzMJasj5BPZrmKjJb6O/tOtEIJ66xPSBTxPShkEYHnB7A==
   116        -----END CERTIFICATE-----
   117  ```
   118  
   119  ## Customization
   120  
   121  Of course, you can customize a lot of things:
   122  
   123  ```yaml
   124  # .goreleaser.yml
   125  artifactories:
   126    # You can have multiple Artifactory instances.
   127    -
   128      # Unique name of your artifactory instance. Used to identify the instance
   129      name: production
   130      # Upload mode. Valid options are `binary` and `archive`.
   131      # If mode is `archive`, variables _Os_, _Arch_ and _Arm_ for target name are not supported.
   132      # In that case these variables are empty.
   133      # Default is `archive`.
   134      mode: archive
   135      # URL of your Artifactory instance + path to deploy to
   136      target: http://artifacts.company.com:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/
   137      # User that will be used for the deployment
   138      username: deployuser
   139      # Upload checksums (defaults to false)
   140      checksum: true
   141      # Upload signatures (defaults to false)
   142      signature: true
   143      # Certificate chain used to validate server certificates
   144      trusted_certificates: |
   145        -----BEGIN CERTIFICATE-----
   146        MIIDrjCCApagAwIBAgIIShr2zchZo+8wDQYJKoZIhvcNAQENBQAwNTEXMBUGA1UE
   147        ...(edited content)...
   148        TyzMJasj5BPZrmKjJb6O/tOtEIJ66xPSBTxPShkEYHnB7A==
   149        -----END CERTIFICATE-----
   150  ```
   151  
   152  These settings should allow you to push your artifacts into multiple Artifactories.