1and1 / go-maven-poller

GoCD plugin that polls Maven repositories including Artifactory and Nexus
Other
9 stars 8 forks source link
artifactory gocd gocd-plugin gocd-server gocd-setup java jcenter material maven maven-poller maven-repository nexus pipeline plugin poll proxy

Go Maven Poller

Java Build Integration Test Coverage GitHub release (latest SemVer) ReleaseDate Downloads License

This repo has been set to read-only because we are no longer using GoCD and couldn't find another maintainer in our organization to maintain the project. Feel free to fork.

This is a Maven repository package plugin for the Go CD continuous integration server and a remix of the aresok's codebase. The major differences are:

Tested on following repositories:

Requirements

The go-maven-poller requires at least the following environment:

Installation

Download go-maven-poller-plugin.jar into the plugins/external directory of your GoCD server and restart it.

You can also download a signed jar from the maven repository and verify the GPG signature with my GPG public key.

Repository definition

Repo URL must be a valid http or https URL. Basic authentication (user:password@host/path) is supported. You may specify a proxy. If your GoCD server system doesn't use the same timezone as the repository, you may set a specific time zone. If 'Latest version Tag' is specified, the value of it will be used to determine, if new version is available. It will be not compared to other versions of the package.

Add a Maven repository

Package definition

Group Id and Artifact Id refer to the corresponding entries in pom.xml. Click check package to make sure the plugin understands what you are looking for. You may set lower and upper version bounds to further narrow down the versions you want to look for.

Define a package as material for a pipeline

Published Environment Variables

The following information is made available as environment variables for tasks:

GO_PACKAGE_<REPO-NAME>_<PACKAGE-NAME>_LABEL
GO_REPO_<REPO-NAME>_<PACKAGE-NAME>_REPO_URL
GO_PACKAGE_<REPO-NAME>_<PACKAGE-NAME>_GROUP_ID
GO_PACKAGE_<REPO-NAME>_<PACKAGE-NAME>_ARTIFACT_ID
GO_PACKAGE_<REPO-NAME>_<PACKAGE-NAME>_PACKAGING
GO_PACKAGE_<REPO-NAME>_<PACKAGE-NAME>_LOCATION

The GO_PACKAGE_..._LOCATION variable points to a downloadable url.

Downloading the Package

To download the package locally on the agent, we could write a curl (or wget) task like this:

Download artifact

            <exec command="/bin/bash" >
            <arg>-c</arg>
            <arg>curl -o /tmp/mypkg.jar $GO_PACKAGE_REPONAME_PKGNAME_LOCATION</arg>
            </exec>

When the task executes on the agent, the environment variables get substituted and the package gets downloaded.

Notes

This plugin will detect at max one package revision per minute (the default interval at which Go materials poll). If multiple versions of a package get published to a repo in the time interval between two polls, Go will only register the latest version in that interval.