Skip to content

stanchan/go-maven-poller

Repository files navigation

Maven (Nexus) Poller Plugin for Go

Introduction

This is a package material plugin for Go. It is currently capable of polling Nexus repositories.

The behaviour and capabilities of the plugin is determined to a significant extent by that of the package material extension point in Go. Be sure to read the package material documentation before using this plugin.

Installation

Just drop go-maven-poller.jar into plugins/external directory and restart Go. More details here

Repository definition

Repo URL must be a valid http or https URL. Basic authentication (user:password@host/path) is supported.

Add a Maven (Nexus) repository

Package definition

Group Id and Artifact Id refer to the corresponding entries in pom.xml. Click check pacakge to make sure the plugin understands what you are looking for.

Define a package as material for a pipeline

Package Metadata

The following additional POM info is accessed by the plugin:

url, if available, is used to display a TrackBack link. This is handy when the package is published outside of Go and we need a way to trace back to the piece of automation infrastructure (e.g. Jenkins job) that published it.

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 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:

            <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 subsituted and the package gets downloaded.

Or, to simply pass it as an argument to a deploy script on a remote server

            <exec command="/bin/bash">
                <arg>-c</arg>
                <arg>ssh server "cd /to/dest/dir;deploy.sh $GO_PACKAGE_REPONAME_PKGNAME_LOCATION"</arg>
            </exec>

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •