2017-12-02 22:03:06 +02:00
|
|
|
---
|
|
|
|
title: Artifactory
|
|
|
|
---
|
|
|
|
|
|
|
|
Since [v0.38.0](https://github.com/goreleaser/goreleaser/releases/tag/v0.38.0),
|
|
|
|
GoReleaser supports building and pushing artifacts into Artifactory.
|
|
|
|
|
|
|
|
## How it works
|
|
|
|
|
2017-12-10 19:17:29 +02:00
|
|
|
You can declare multiple Artifactory instances.
|
2017-12-02 22:03:06 +02:00
|
|
|
All binaries generated by your `builds` section will be pushed to
|
|
|
|
each configured Artifactory.
|
|
|
|
|
|
|
|
If you have only one Artifactory instance,
|
|
|
|
the configuration is as easy as adding the
|
2017-12-20 12:32:21 +02:00
|
|
|
upload target and a username to your `.goreleaser.yml` file:
|
2017-12-02 22:03:06 +02:00
|
|
|
|
|
|
|
```yaml
|
|
|
|
artifactories:
|
2017-12-09 19:17:37 +02:00
|
|
|
- name: production
|
2017-12-09 21:54:04 +02:00
|
|
|
target: http://<Your-Instance>:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/
|
2017-12-02 22:03:06 +02:00
|
|
|
username: goreleaser
|
|
|
|
```
|
|
|
|
|
|
|
|
Prerequisites:
|
|
|
|
|
2017-12-10 19:17:29 +02:00
|
|
|
* A running Artifactory instances
|
|
|
|
* A user + password / API key with grants to upload an artifact
|
2017-12-02 22:03:06 +02:00
|
|
|
|
|
|
|
### Target
|
|
|
|
|
2017-12-09 21:54:04 +02:00
|
|
|
The `target` is the URL to upload the artifacts to (_without_ the name of the artifact).
|
2017-12-02 22:03:06 +02:00
|
|
|
|
2017-12-09 21:54:04 +02:00
|
|
|
An example configuration for `goreleaser` in upload mode `binary` with the target can look like
|
2017-12-02 22:03:06 +02:00
|
|
|
|
|
|
|
```
|
2017-12-02 22:14:04 +02:00
|
|
|
http://artifacts.company.com:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/{{ .Os }}/{{ .Arch }}{{ if .Arm }}{{ .Arm }}{{ end }}
|
2017-12-02 22:03:06 +02:00
|
|
|
```
|
|
|
|
|
2017-12-09 21:54:04 +02:00
|
|
|
and will result in a final deployment like
|
2017-12-02 22:03:06 +02:00
|
|
|
|
|
|
|
```
|
2017-12-02 22:14:04 +02:00
|
|
|
http://artifacts.company.com:8081/artifactory/example-repo-local/goreleaser/1.0.0/Darwin/x86_64/goreleaser
|
2017-12-02 22:03:06 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
Support variables:
|
|
|
|
|
2017-12-10 19:17:29 +02:00
|
|
|
* Version
|
|
|
|
* Tag
|
|
|
|
* ProjectName
|
|
|
|
* Os
|
|
|
|
* Arch
|
|
|
|
* Arm
|
2017-12-09 21:54:04 +02:00
|
|
|
|
2017-12-10 19:17:29 +02:00
|
|
|
_Attention_: Variables _Os_, _Arch_ and _Arm_ are only supported in upload mode `binary`.
|
2017-12-02 22:03:06 +02:00
|
|
|
|
|
|
|
### Password / API Key
|
|
|
|
|
|
|
|
Your configured username needs to be authenticated against your Artifactory.
|
|
|
|
|
|
|
|
The password or API key will be stored in a environment variable.
|
2017-12-20 12:32:21 +02:00
|
|
|
The configured name of your Artifactory instance will be used.
|
2017-12-09 19:17:37 +02:00
|
|
|
With this way we support auth for multiple instances.
|
|
|
|
This also means that the `name` per configured instance needs to be unique
|
|
|
|
per goreleaser configuration.
|
2017-12-02 22:03:06 +02:00
|
|
|
|
2017-12-09 19:17:37 +02:00
|
|
|
The name of the environment variable will be `ARTIFACTORY_NAME_SECRET`.
|
|
|
|
If your instance is named `production`, you need to store the secret in the
|
|
|
|
environment variable `ARTIFACTORY_PRODUCTION_SECRET`.
|
|
|
|
The name will be transformed to uppercase.
|
2017-12-02 22:03:06 +02:00
|
|
|
|
|
|
|
## Customization
|
|
|
|
|
|
|
|
Of course, you can customize a lot of things:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
# .goreleaser.yml
|
|
|
|
artifactories:
|
|
|
|
# You can have multiple Artifactory instances.
|
|
|
|
-
|
2017-12-09 19:17:37 +02:00
|
|
|
# Unique name of your artifactory instance. Used to identify the instance
|
|
|
|
name: production
|
2017-12-09 21:54:04 +02:00
|
|
|
# Upload mode. Valid options are `binary` and `archive`.
|
|
|
|
# If mode is `archive`, variables _Os_, _Arch_ and _Arm_ for target name are not supported.
|
|
|
|
# In that case these variables are empty.
|
|
|
|
# Default is `archive`.
|
|
|
|
mode: archive
|
2017-12-02 22:03:06 +02:00
|
|
|
# URL of your Artifactory instance + path to deploy to
|
2017-12-09 21:54:04 +02:00
|
|
|
target: http://artifacts.company.com:8081/artifactory/example-repo-local/{{ .ProjectName }}/{{ .Version }}/
|
2017-12-02 22:03:06 +02:00
|
|
|
# User that will be used for the deployment
|
2017-12-03 00:34:29 +02:00
|
|
|
username: deployuser
|
2017-12-02 22:03:06 +02:00
|
|
|
```
|
|
|
|
|
2017-12-10 18:41:57 +02:00
|
|
|
These settings should allow you to push your artifacts into multiple Artifactories.
|