Code Monkey home page Code Monkey logo

go-maven-poller's Introduction

Go Maven Poller

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

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:

  • Building with Maven instead of Ant
  • Added proxy option to repository configuration
  • This plugin parses the maven-metadata.xml of a Maven repository instead of using the Nexus API and therefore can be used for a broader range of Artifactory and Nexus repositories.
  • Use of GoCD JSON API

Tested on following repositories:

  • Maven Central (Link)
  • JBoss Nexus (Link)
  • JFrog Artifactory (Link)

Requirements

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

  • GoCD 20.1.0 and later
  • JDK 11 - 17 and later (the JDK GoCD is running with)

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.

go-maven-poller's People

Contributors

bitionaire avatar dependabot[bot] avatar mfriedenhagen-ui avatar netdevfighter avatar piotr-kaczmarczyk avatar sfuhrm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-maven-poller's Issues

Fix building for JDK 16

JDK 16 build is breaking because of problems with PowerMock:

Tests in error: 
  com.oneandone.go.plugin.maven.client.RepositoryClientTest: PowerMock internal error: Should never throw exception at this level
  testGetArtifactLocation(com.oneandone.go.plugin.maven.util.MavenArtifactFilesTest): Unable to make protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException accessible: module java.base does not "opens java.lang" to unnamed module @60e5db1d
  testGetPomLocation(com.oneandone.go.plugin.maven.util.MavenArtifactFilesTest): Unable to make protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException accessible: module java.base does not "opens java.lang" to unnamed module @60e5db1d
  testGetModel(com.oneandone.go.plugin.maven.util.MavenArtifactFilesTest): Unable to make protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException accessible: module java.base does not "opens java.lang" to unnamed module @60e5db1d

This is probably related to powermock/powermock#1094

Redeployed snapshots ignored.

Hello,

I'm allowing redeploy on my nexus maven snapshot repository. If I deploy an new version of a snapshot (1.0.23-SNAPSHOT), the go-maven-poller notices this and my Go pipeline is triggered. This is expected behavior. However if I redeploy the same snapshot version (1.0.23-SNAPSHOT), I have redploy on, the go-maven-poller doesn't trigger the pipeline.

2016-07-15 12:14:01,755 INFO [82@MessageListener for MaterialUpdateListener] RepositoryClient:52 - lastKnownVersion is 1.0.23-SNAPSHOT
2016-07-15 12:14:01,755 INFO [82@MessageListener for MaterialUpdateListener] RepositoryClient:52 - no newer version
2016-07-15 12:14:01,756 WARN [82@MessageListener for MaterialUpdateListener] RepositoryClient:62 - getLatest returning null
2016-07-15 12:14:01,756 INFO [82@MessageListener for MaterialUpdateListener] MavenRepositoryPoller:52 - no modification since 1.0.23-SNAPSHOT

Is there any chance of allowing redeployed snapshots to act as a trigger?

JUnit 3 & 4 style mixing

  • extending TextCase is JUnit 3 style
  • using @test annotation is JUnit 4

Instead of extending TestCase do

import static org.junit.Assert.*;

and then you can

assertEquals(a,b)

These files are affected:

stephan@nucleus:~/git/go-maven-poller$ grep "extends TestCase" . -R
./src/test/java/com/oneandone/go/plugin/maven/client/RepositoryConnectorTest.java:public class RepositoryConnectorTest extends TestCase {
./src/test/java/com/oneandone/go/plugin/maven/client/RepositoryResponseHandlerTest.java:public class RepositoryResponseHandlerTest extends TestCase {
./src/test/java/com/oneandone/go/plugin/maven/ConfigurationProviderTest.java:public class ConfigurationProviderTest extends TestCase {
stephan@nucleus:~/git/go-maven-poller$ 

Only latest revision?

Does this plugin only let you choose latest revision from maven for a material, or did I configure something wrong?

Unable to Connect to Jfrog Artifactory SAAS instance

Hi Sir,

I am trying to configure Jfrog Artifactory SAAS instance using your plugin.

The package Repository configuration is done sucessfully but i get http 500 exception while try to configure the material in the pipeline.

Package Repository
Maven Repo URL - https://hcldevopscoe.jfrog.io/hcldevopscoe/
username - admin
password - *********

Material Configuration
Package Name* - MyPKG3
Group Id* - libs-release-local/com
Artifact Id* - AntSpringMVC
Packaging (jar,war,ear...)* - war

libs-release-local is the repository which contains com as the group id and antspringmvc as the package id.

Please let me know how to fix this issue

Support for hotfix versions

Today we discovered that the plugin does not seem to handle hotfix versions (four digits, i.e. 1.0.38.1). Are four digit version numbers supported?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.