A Spring Boot application for distributing build artifacts to public repositories. This is made available as a JAR or a Docker image.
The Concourse Release Scripts application can be used anywhere by using the JAR directly; if used in a Concourse CI environment, the container image is a better fit for job tasks (see Concourse Configuration).
To configure the app, add an application.yml
file in the same folder or in ./config
.
For more on that, see the Spring Boot reference documentation.
The available configuration options are described in the Configuration Properties section.
java -jar ./concourse-release-scripts.jar $COMMAND [$ARG...]
To interact with Artifactory repositories in Concourse, usage of the Concourse Artifactory Resource is recommended.
This application interacts with Artifactory and Maven Central. The corresponding credentials must be provided using configuration properties:
artifactory:
url: # URL of the Artifactory instance
username: # Artifactory credentials, username
password: # Artifactory credentials, password
repository:
# repository name for staging versions
staging: libs-staging-local
# repository name for milestone versions
milestone: libs-milestone-local
# repository name for release candidates versions
release-candidate: libs-milestone-local
# repository name for release versions
release: libs-release-local
sonatype:
username: # Sonatype user name.
password: # Sonatype password.
url: # URL of the Nexus instance used to publish releases.
staging_profile: # Name of the staging profile used to publish releases. Usually the top-level group id, e.g. "org.springframework"
staging_profile_id: # ID of the staging profile used to publish releases. Deprecated, use staging_profile instead
sdkman:
consumer-key: # SDKMAN! Consumer Key
consumer-token: # SDKMAN! Consumer Token
candidate: # SDKMAN! candidate name
artifact: # group:artifact:version[:packaging[:classifier]] coordinates with version ignored, e.g. "org.springframework.boot:spring-boot-cli:*:zip:bin"
The Concourse Release Scripts application supports several commands:
-
publishToCentral
, to publish artifacts to Maven Central. -
promote
, to move the build artifacts to a target repository in Artifactory. -
publishToSdkMan
, to publish the Spring Boot CLI to SDKMAN!.
java -jar /concourse-release-scripts.jar $COMMAND $RELEASE_TYPE $BUILD_INFO_LOCATION
Where:
-
$COMMAND
is the command name:promote
,publishToCentral
orpublishToSdkMan
-
$RELEASE_TYPE
is the type of release:"M"
(milestones),"RC"
(release candidates) or"RELEASE"
-
$BUILD_INFO_LOCATION
should point to the absolute location of the artifactory build file info (e.g./local-repository/build-info.json
)
Command used to publish artifacts to Maven Central using the OSS Sonatype instance.
The release is published by creating a staging repository and deploying to it the artifacts at the given $ARTIFACTS_LOCATION
.
The repository is then closed and, upon successful closure, it is released.
java -jar /concourse-release-scripts.jar publishToCentral $RELEASE_TYPE $BUILD_INFO_LOCATION $ARTIFACTS_LOCATION
Where:
-
$RELEASE_TYPE
is the type of release:"M"
(milestones),"RC"
(release candidates) or"RELEASE"
-
$BUILD_INFO_LOCATION
should point to the absolute location of the artifactory build file info (e.g./local-repository/build-info.json
) -
$ARTIFACTS_LOCATION
the location of the local artifact repository (e.g.local-repository
)
There are additional configuration properties available for tuning the publishing process:
sonatype:
polling_interval: 15s # Time between requests made to determine if the closing of a staging repository has completed.
upload_threads: 8 # Number of threads used to upload artifacts to the staging repository.
auto_release: true # Whether the repository should be promoted automatically after a successful close.
exclude: # Regular expression patterns of artifacts to exclude
- 'build-info\.json' # required to avoid publishing Artifactory build info
- 'org/springframework/boot/spring-boot-docs/.*'
Command used to move the build artifacts to a target repository in Artifactory. This steps usually happens after the staging of artifacts on Artifactory. This step can be done with the Concourse Artifactory Resource.
This command sends a request to the Artifactory REST API to promote artifacts from a staging repository to a target repository.
The chosen target repository depends on the type of release given as an argument:
-
milestone ("M") staging repositories are promoted to
"libs-milestone-local"
-
release candidate ("RC") staging repositories are promoted to
"libs-milestone-local"
-
release ("RELEASE") staging repositories are promoted to
"libs-release-local"
java -jar /concourse-release-scripts.jar promote $RELEASE_TYPE $BUILD_INFO_LOCATION
Where:
-
$RELEASE_TYPE
is the type of release:"M"
(milestones),"RC"
(release candidates) or"RELEASE"
-
$BUILD_INFO_LOCATION
should point to the absolute location of the artifactory build file info (e.g./local-repository/build-info.json
)
java -jar /concourse-release-scripts.jar publishToSdkman $RELEASE_TYPE $VERSION $BRANCH
Where:
-
$RELEASE_TYPE
is the type of release:"M"
(milestones),"RC"
(release candidates) or"RELEASE"
-
$VERSION
the actual artifact version -
$BRANCH
the git branch the artifact is being tagged and released from
You can use the Concourse Release Scripts Docker image as a task in your Concourse pipeline. Here is an example of a task file for a promotion job step:
---
platform: linux
image_resource:
type: registry-image
source:
repository: springio/concourse-release-scripts
tag: '0.4.0'
inputs:
- name: git-repo
- name: artifactory-repo
outputs:
- name: version
params:
RELEASE_TYPE:
ARTIFACTORY_SERVER:
ARTIFACTORY_USERNAME:
ARTIFACTORY_PASSWORD:
run:
path: git-repo/ci/scripts/promote.sh
And its companion script file:
#!/bin/bash
pushd artifactory-repo > /dev/null
version=$( get_revision_from_buildinfo )
popd > /dev/null
export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json
java -jar /concourse-release-scripts.jar promote $RELEASE_TYPE $BUILD_INFO_LOCATION > /dev/null || { exit 1; }
echo "Promotion complete"
echo $version > version/version