github.com/joselitofilho/goreleaser@v0.155.1-0.20210123221854-e4891856c593/www/docs/customization/artifactory.md (about)

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