This commit is contained in:
Andres Almiray
2021-05-21 18:55:47 +02:00
parent a3cbef2f0e
commit 62a3fd8d32
16 changed files with 581 additions and 12 deletions

View File

@@ -21,6 +21,7 @@
*** xref:packagers/snap.adoc[]
** xref:upload/index.adoc[]
*** xref:upload/artifactory.adoc[]
*** xref:upload/http.adoc[]
** xref:distributions.adoc[]
** xref:files.adoc[]
** xref:announce/index.adoc[]

View File

@@ -151,6 +151,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<announce>
<!--
icon:dot-circle[]

View File

@@ -163,6 +163,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<announce>
<!--
icon:dot-circle[]

View File

@@ -150,6 +150,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<announce>
<!--
icon:dot-circle[]

View File

@@ -295,6 +295,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<announce>
<!--
icon:dot-circle[]

View File

@@ -135,6 +135,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<announce>
<!--
icon:dot-circle[]

View File

@@ -157,6 +157,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<announce>
<!--
icon:dot-circle[]

View File

@@ -188,6 +188,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<announce>
<!--
icon:dot-circle[]

View File

@@ -136,6 +136,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<announce>
<!--
icon:dot-circle[]

View File

@@ -179,6 +179,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<announce>
<!--
icon:dot-circle[]

View File

@@ -196,6 +196,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<announce>
<!--
icon:dot-circle[]

View File

@@ -438,6 +438,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<assemble>
<!--
icon:dot-circle[]

View File

@@ -343,6 +343,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<assemble>
<!--
icon:dot-circle[]

View File

@@ -329,6 +329,15 @@ The following key/values may be defined as properties or as environment variable
| JRELEASER_ARTIFACTORY_${NAME}_TOKEN | a token matching the named Artifactory instance
|===
=== Http
[%header, cols="<1,<1", width="100%"]
|===
| Key | Description
| JRELEASER_HTTP_${NAME}_USERNAME | a username matching the named HTTP server
| JRELEASER_HTTP_${NAME}_PASSWORD | a password/token matching the named HTTP server
|===
=== Docker
[%header, cols="<1,<1", width="100%"]

View File

@@ -43,7 +43,7 @@ upload:
# icon:dot-circle[]
readTimeout: 60
# URL of the Artifacttory instance + path.
# URL of the Artifactory instance + path.
# The artifact file name will be appended automatically.
# icon:exclamation-triangle[] icon:file-alt[]
target: pass:[https://duke.jfrog.io/artifactory/binaries/{{projectName}}/{{projectVersion}}]
@@ -112,7 +112,7 @@ TOML::
# icon:dot-circle[]
readTimeout = 60
# URL of the Artifacttory instance + path.
# URL of the Artifactory instance + path.
# The artifact file name will be appended automatically.
# icon:exclamation-triangle[] icon:file-alt[]
target = "pass:[https://duke.jfrog.io/artifactory/binaries/{{projectName}}/{{projectVersion}}]"
@@ -185,7 +185,7 @@ JSON::
// icon:dot-circle[]
"readTimeout": 60,
// URL of the Artifacttory instance + path.
// URL of the Artifactory instance + path.
// The artifact file name will be appended automatically.
// icon:exclamation-triangle[] icon:file-alt[]
"target": "pass:[https://duke.jfrog.io/artifactory/binaries/{{projectName}}/{{projectVersion}}]",
@@ -240,6 +240,9 @@ Maven::
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<upload>
<!--
icon:dot-circle[]
@@ -273,11 +276,11 @@ Maven::
<readTimeout>60</readTimeout>
<!--
URL of the Artifacttory instance + path.
URL of the Artifactory instance + path.
The artifact file name will be appended automatically.
icon:exclamation-triangle[] icon:file-alt[]
-->
<target>pass:[https:my.zulipchat.com/api/v1]</target>
<target>pass:[https://duke.jfrog.io/artifactory/binaries/{{projectName}}/{{projectVersion}}]</target>
<!--
The username that can write to the repository.
@@ -369,7 +372,7 @@ jreleaser {
// icon:dot-circle[]
readTimeout = 60
// URL of the Artifacttory instance + path.
// URL of the Artifactory instance + path.
// The artifact file name will be appended automatically.
// icon:exclamation-triangle[] icon:file-alt[]
target = 'pass:[https://duke.jfrog.io/artifactory/binaries/{{projectName}}/{{projectVersion}}]'
@@ -425,14 +428,10 @@ TIP: Either set `username`/`password` or `token`.
The target is the URL to upload the artifacts to (without the name of the artifact).
An example configuration can look like
[source]
----
target: 'http://artifacts.company.com:8081/artifactory/example-repo-local/{{projectName}}/{{projectVersion}}'
----
`target: 'https://artifacts.company.com:8081/artifactory/example-repo-local/{{projectName}}/{{projectVersion}}'`.
And will result in a final deployment like
`pass:[http://artifacts.company.com:8081/artifactory/example-repo-local/app/1.0.0/app-1.0.0.zip]`.
`pass:[https://artifacts.company.com:8081/artifactory/example-repo-local/app/1.0.0/app-1.0.0.zip]`.
== Username

View File

@@ -0,0 +1,524 @@
= Http
Uploads artifacts, files, and signatures to an HTTP/HTTPS server
.Prerequisites:
* A HTTP/HTTPS server that accepts POST/PUT requests.
* Username + Password/Token if authorization is required.
include::partial$legend.adoc[]
[tabs]
====
YAML::
+
[source,yaml]
[subs="+macros"]
----
# icon:dot-circle[]
upload:
# icon:dot-circle[]
http:
# Uploaders require a name.
# icon:exclamation-triangle[]
app:
# Enables or disables the uploader.
# Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
# icon:dot-circle[]
active: ALWAYS
# Defines the connection timeout in seconds.
# Defaults to `20`.
# icon:dot-circle[]
connectTimeout: 20
# Defines the read timeout in seconds.
# Defaults to `60`.
# icon:dot-circle[]
readTimeout: 60
# URL of the HTTP/HTTPS server + path.
# icon:exclamation-triangle[] icon:file-alt[]
target: pass:[https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFileName}}]
# The username required for authorization.
# If left unspecified, the `JRELEASER_HTTP_${name}_USERNAME`
# environment variable must be defined.
# icon:dot-circle[] icon:eye-slash[]
username: __DO_NOT_SET_HERE__
# Password for login into the repository.
# If left unspecified, the `JRELEASER_HTTP_${name}_PASSWORD`
# environment variable must be defined.
# icon:dot-circle[] icon:eye-slash[]
password: __DO_NOT_SET_HERE__
# The authorization method to use.
# Valid values are [`NONE`, `BASIC`, `BEARER`].
# `Basic` requires both username & password.
# `BEARER` requires a token (set as password).
# Defaults to `NONE`.
# icon:dot-circle[]
authorization: BASIC
# The method to use for uploading artifacts.
# Valid values are [`POST`, `PUT`].
# Defaults to `PUT`.
# icon:dot-circle[]
method: POST
# Additional headers to be sent to the server.
# Values accept xref:configuration:name-templates.adoc[].
# icon:dot-circle[] icon:file-alt[]
headers:
'X-ARTIFACT-PLATFORM': '{{artifactPlatform}}'
# Upload files.
# Defaults to `true`.
# icon:dot-circle[]
files: true
# Upload distribution artifacts.
# Defaults to `true`.
# icon:dot-circle[]
artifacts: true
# Upload signatures.
# Defaults to `true`.
# icon:dot-circle[]
signatures: true
# Additional properties used when evaluating templates.
# icon:dot-circle[]
extraProperties:
# Key will be capitalized and prefixed with `http`, i.e, `httpFoo`.
foo: bar
----
TOML::
+
[source,toml]
[subs="+macros"]
----
# Uploaders require a name.
# icon:exclamation-triangle[]
[upload.http.app]
# Enables or disables the uploader.
# Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
# Defaults to `NEVER`.
# icon:dot-circle[]
active = "ALWAYS"
# Defines the connection timeout in seconds.
# Defaults to `20`.
# icon:dot-circle[]
connectTimeout = 20
# Defines the read timeout in seconds.
# Defaults to `60`.
# icon:dot-circle[]
readTimeout = 60
# URL of the HTTP/HTTPS server + path.
# The artifact file name will be appended automatically.
# icon:exclamation-triangle[] icon:file-alt[]
target = "pass:[https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFileName}}]"
# The username required for authorization.
# If left unspecified, the `JRELEASER_HTTP_${name}_USERNAME`
# environment variable must be defined.
# icon:dot-circle[] icon:eye-slash[]
username = "__DO_NOT_SET_HERE__"
# Password for login into the repository..
# If left unspecified, the `JRELEASER_HTTP_${name}_PASSWORD`
# environment variable must be defined.
# icon:dot-circle[] icon:eye-slash[]
password = "__DO_NOT_SET_HERE__"
# The authorization method to use.
# Valid values are [`NONE`, `BASIC`, `BEARER`].
# `Basic` requires both username & password.
# `BEARER` requires a token (set as password).
# Defaults to `NONE`.
# icon:dot-circle[]
authorization = "BASIC"
# The method to use for uploading artifacts.
# Valid values are [`POST`, `PUT`].
# Defaults to `PUT`.
# icon:dot-circle[]
method = "POST"
# Additional headers to be sent to the server.
# Values accept xref:configuration:name-templates.adoc[].
# icon:dot-circle[] icon:file-alt[]
headers."X-ARTIFACT-PLATFORM" = "{{artifactPlatform}}"
# Upload files.
# Defaults to `true`.
# icon:dot-circle[]
files = true
# Upload distribution artifacts.
# Defaults to `true`.
# icon:dot-circle[]
artifacts = true
# Upload signatures.
# Defaults to `true`.
# icon:dot-circle[]
signatures = true
# Additional properties used when evaluating templates.
# icon:dot-circle[]
extraProperties.foo = "bar"
# Key will be capitalized and prefixed with `http`, i.e, `httpFoo`.
----
JSON::
+
[source,json]
[subs="+macros"]
----
{
// icon:dot-circle[]
"upload": {
// icon:dot-circle[]
"http": {
// Uploaders require a name.
// icon:exclamation-triangle[]
"app": {
// Enables or disables the uploader.
// Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
// icon:dot-circle[]
"active": "ALWAYS",
// Defines the connection timeout in seconds.
// Defaults to `20`.
// icon:dot-circle[]
"connectTimeout": 20,
// Defines the read timeout in seconds.
// Defaults to `60`.
// icon:dot-circle[]
"readTimeout": 60,
// URL of the HTTP/HTTPS server + path.
// The artifact file name will be appended automatically.
// icon:exclamation-triangle[] icon:file-alt[]
"target": "pass:[https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFileName}}]",
// The username required for authorization.
// If left unspecified, the `JRELEASER_HTTP_${name}_USERNAME`
// environment variable must be defined.
// icon:dot-circle[] icon:eye-slash[]
"username": "__DO_NOT_SET_HERE__",
// Password for login into the repository.
// If left unspecified, the `JRELEASER_HTTP_${name}_PASSWORD`
// environment variable must be defined.
// icon:dot-circle[] icon:eye-slash[]
"password": "__DO_NOT_SET_HERE__",
// The authorization method to use.
// Valid values are [`NONE`, `BASIC`, `BEARER`].
// `Basic` requires both username & password.
// `BEARER` requires a token (set as password).
// Defaults to `NONE`.
// icon:dot-circle[]
"authorization": "BASIC",
// The method to use for uploading artifacts.
// Valid values are [`POST`, `PUT`].
// Defaults to `PUT`.
// icon:dot-circle[]
"method": "POST",
// Additional headers to be sent to the server.
// Values accept xref:configuration:name-templates.adoc[].
// icon:dot-circle[] icon:file-alt[]
"headers": {
"X-ARTIFACT-PLATFORM": "{{artifactPlatform}}"
},
// Upload files.
// Defaults to `true`.
// icon:dot-circle[]
"files": true,
// Upload distribution artifacts.
// Defaults to `true`.
// icon:dot-circle[]
"artifacts": true,
// Upload signatures.
// Defaults to `true`.
// icon:dot-circle[]
"signatures": true,
// Additional properties used when evaluating templates.
// icon:dot-circle[]
"extraProperties": {
// Key will be capitalized and prefixed with `http`, i.e, `httpFoo`.
"foo": "bar"
}
}
}
}
}
----
Maven::
+
[source,xml]
[subs="+macros,verbatim"]
----
<jreleaser>
<!--
icon:dot-circle[]
-->
<upload>
<!--
icon:dot-circle[]
-->
<http>
<!--
Uploaders require a name.
icon:exclamation-triangle[]
-->
<app>
<!--
Enables or disables the distribution.
Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
Defaults to `ALWAYS`.
icon:dot-circle[]
-->
<active>ALWAYS</active>
<!--
Defines the connection timeout in seconds.
Defaults to `20`.
icon:dot-circle[]
-->
<connectTimeout>20</connectTimeout>
<!--
Defines the read timeout in seconds.
Defaults to `60`.
icon:dot-circle[]
-->
<readTimeout>60</readTimeout>
<!--
URL of the HTTP/HTTPS server + path.
The artifact file name will be appended automatically.
icon:exclamation-triangle[] icon:file-alt[]
-->
<target>pass:[https:my.zulipchat.com/api/v1]</target>
<!--
The username required for authorization.
If left unspecified, the `JRELEASER_HTTP_${name}_USERNAME`
environment variable must be defined.
icon:dot-circle[] icon:eye-slash[]
-->
<username>__DO_NOT_SET_HERE__</username>
<!--
Password for login into the repository.
If left unspecified, the `JRELEASER_HTTP_${name}_PASSWORD`
environment variable must be defined.
icon:dot-circle[] icon:eye-slash[]
-->
<password>__DO_NOT_SET_HERE__</password>
<!--
The authorization method to use.
Valid values are [`NONE`, `BASIC`, `BEARER`].
`Basic` requires both username & password.
`BEARER` requires a token (set as password).
Defaults to `NONE`.
icon:dot-circle[]
-->
<authorization>BASIC</authorization>
<!--
The method to use for uploading artifacts.
Valid values are [`POST`, `PUT`].
Defaults to `PUT`.
icon:dot-circle[]
-->
<method>POST</method>
<!--
Additional headers to be sent to the server.
Values accept xref:configuration:name-templates.adoc[].
icon:dot-circle[] icon:file-alt[]
-->
<headers>
<X-ARTIFACT-PLATFORM>{{artifactPlatform}}</X-ARTIFACT-PLATFORM>
</headers>
<!--
Upload files.
Defaults to `true`.
icon:dot-circle[]
-->
<files>true</files>
<!--
Upload distribution artifacts.
Defaults to `true`.
icon:dot-circle[]
-->
<artifacts>true</artifacts>
<!--
Upload signatures.
Defaults to `true`.
icon:dot-circle[]
-->
<signatures>true</signatures>
<!--
Additional properties used when evaluating templates.
icon:dot-circle[]
-->
<extraProperties>
<!--
Key will be capitalized and prefixed with `http`, i.e, `httpFoo`.
-->
<foo>bar</foo>
</extraProperties>
</app>
</http>
</upload>
</jreleaser>
----
Gradle::
+
[source,groovy]
[subs="+macros"]
----
jreleaser {
// icon:dot-circle[]
upload {
// icon:dot-circle[]
http {
// Uploaders require a name.
// icon:exclamation-triangle[]
app {
// Enables or disables the uploader.
// Valid values are [`NEVER`, `ALWAYS`, `RELEASE`, `SNAPSHOT`].
// Defaults to `NEVER`.
// icon:dot-circle[]
active = 'ALWAYS'
// Defines the connection timeout in seconds.
// Defaults to `20`.
// icon:dot-circle[]
connectTimeout = 20
// Defines the read timeout in seconds.
// Defaults to `60`.
// icon:dot-circle[]
readTimeout = 60
// URL of the HTTP/HTTPS server + path.
// The artifact file name will be appended automatically.
// icon:exclamation-triangle[] icon:file-alt[]
target = 'pass:[https://my.server.com/{{projectName}}/{{tagName}}/{{artifactFileName}}]'
// The username required for authorization.
// If left unspecified, the `JRELEASER_HTTP_${name}_USERNAME`
// environment variable must be defined.
// icon:dot-circle[] icon:eye-slash[]
username = '__DO_NOT_SET_HERE__'
// Password for login into the repository.
// If left unspecified, the `JRELEASER_HTTP_${name}_PASSWORD`
// environment variable must be defined.
// icon:dot-circle[] icon:eye-slash[]
password = '__DO_NOT_SET_HERE__'
// The authorization method to use.
// Valid values are [`NONE`, `BASIC`, `BEARER`].
// `Basic` requires both username & password.
// `BEARER` requires a token (set as password).
// Defaults to `NONE`.
// icon:dot-circle[]
authorization = 'BASIC'
// The method to use for uploading artifacts.
// Valid values are [`POST`, `PUT`].
// Defaults to `PUT`.
// icon:dot-circle[]
method = 'POST'
// Additional headers to be sent to the server.
// Values accept xref:configuration:name-templates.adoc[].
// icon:dot-circle[] icon:file-alt[]
headers.put('X-ARTIFACT-PLATFORM', '{{artifactPlatform}}')
// Upload files.
// Defaults to `true`.
// icon:dot-circle[]
files = true
// Upload distribution artifacts.
// Defaults to `true`.
// icon:dot-circle[]
artifacts = true
// Upload signatures.
// Defaults to `true`.
// icon:dot-circle[]
signatures = true
// Additional properties used when evaluating templates.
// Key will be capitalized and prefixed with `http`, i.e, `httpFoo`.
// icon:dot-circle[]
extraProperties.put('foo', 'bar')
}
}
}
}
----
====
== Target
The target is the URL to upload the artifacts to.
An example configuration can look like
`target: 'https://artifacts.company.com:8081/upload/{{projectName}}/{{tagName}}/{{artifactFileName}}'`.
And will result in a final deployment like
`pass:[https://artifacts.company.com:8081/upload/app/v1.0.0/app-1.0.0.zip]`.
== Username
You can have the username set in the configuration as shown above or you can have it read from an environment variable.
The configured name of the HTTP server will be used to build the environment variable name.
This means that the name per configured instance needs to be unique.
The name of the environment variable will be `JRELEASER_HTTP_NAME_USERNAME`. If your instance is named `production`,
you can store the username in the environment variable `JRELEASER_HTTP_PRODUCTION_USERNAME`. The name will be
transformed to uppercase.
If a configured username is found in the configuration file, then the environment variable is not used at all.
== Password
The password will be stored in a environment variable. The configured name of the HTTP server will
be used. This means that the name per configured instance needs to be unique.
The name of the environment variable will be `JRELEASER_HTTP_NAME_PASSWORD`. If your instance is named `production`,
you need to store the secret in the environment variable `JRELEASER_HTTP_PRODUCTION_PASSWORD`. The name will be
transformed to uppercase.