From c2076df7285c3e42b0eb40d3d6754d883e4ba4aa Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Mon, 8 Jun 2020 11:42:56 -0400 Subject: [PATCH 01/14] Update project namespace Per our OSSRH namespace for publishing releases, references to `net.conjur.api` have been replaced with our namespace, `com.cyberark`. Specifically, we only need to replace the `net` prefix. --- README.md | 32 +++++++++---------- pom.xml | 2 +- .../java/net/conjur/api/AuthnProvider.java | 2 +- src/main/java/net/conjur/api/Conjur.java | 2 +- src/main/java/net/conjur/api/Constants.java | 2 +- src/main/java/net/conjur/api/Credentials.java | 8 ++--- src/main/java/net/conjur/api/Endpoints.java | 6 ++-- .../java/net/conjur/api/ResourceProvider.java | 2 +- src/main/java/net/conjur/api/Token.java | 4 +-- src/main/java/net/conjur/api/Variables.java | 4 +-- .../net/conjur/api/clients/AuthnClient.java | 12 +++---- .../conjur/api/clients/AuthnTokenClient.java | 6 ++-- .../conjur/api/clients/ResourceClient.java | 14 ++++---- src/main/java/net/conjur/util/Args.java | 2 +- src/main/java/net/conjur/util/Callable.java | 2 +- .../net/conjur/util/EncodeUriComponent.java | 2 +- .../java/net/conjur/util/JsonSupport.java | 2 +- src/main/java/net/conjur/util/Lang.java | 2 +- src/main/java/net/conjur/util/Properties.java | 2 +- src/main/java/net/conjur/util/TextUtils.java | 2 +- .../conjur/util/rs/HttpBasicAuthFilter.java | 2 +- .../net/conjur/util/rs/JsonBodyReader.java | 2 +- .../java/net/conjur/util/rs/JsonReadable.java | 2 +- .../net/conjur/util/rs/TokenAuthFilter.java | 8 ++--- src/test/java/net/conjur/api/ConjurTest.java | 2 +- 25 files changed, 63 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index de06a59..8493bd1 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ To do so from the source using Maven, following the setup steps below: ```xml - net.conjur.api + com.cyberark.conjur.api conjur-api 2.2.0 @@ -95,7 +95,7 @@ our [Contributing](https://github.com/cyberark/conjur-api-java/blob/master/CONTR or ```sh-session $ mvn install:install-file -Dfile=/path/to/api/repo/target/conjur-api-$VERSION-with-dependencies.jar \ - -DgroupId=net.conjur.api \ + -DgroupId=com.cyberark.conjur.api \ -DartifactId=conjur-api \ -Dversion=$VERSION \ -Dpackaging=jar @@ -317,7 +317,7 @@ export CONJUR_AUTHN_LOGIN= export CONJUR_AUTHN_API_KEY= ``` ```java -import net.conjur.api.Conjur; +import com.cyberark.conjur.api.Conjur; // Configured using environment variables Conjur conjur = new Conjur(); @@ -335,7 +335,7 @@ $ java -jar myConjurClient.jar \ -DCONJUR_AUTHN_API_KEY= ``` ```java -import net.conjur.api.Conjur; +import com.cyberark.conjur.api.Conjur; // Configured using system properties Conjur conjur = new Conjur(); @@ -354,7 +354,7 @@ $ mvn exec:java \ -Dexec.mainClass="com.myorg.client.App" ``` ```java -import net.conjur.api.Conjur; +import com.cyberark.conjur.api.Conjur; // Configured using system properties Conjur conjur = new Conjur(); @@ -370,7 +370,7 @@ export CONJUR_APPLIANCE_URL= ``` ```java -import net.conjur.api.Conjur; +import com.cyberark.conjur.api.Conjur; // Authenticate using provided username/hostname and password/API key. See notes about // `CONJUR_AUTHN_URL` regarding how 'password-or-api-key' is processed. @@ -389,8 +389,8 @@ export CONJUR_APPLIANCE_URL= ``` ```java -import net.conjur.api.Conjur; -import net.conjur.api.Credentials; +import com.cyberark.conjur.api.Conjur; +import com.cyberark.conjur.api.Credentials; // Authenticate using a Credentials object. See notes about `CONJUR_AUTHN_URL` // regarding how 'password-or-api-key' is processed. @@ -410,8 +410,8 @@ export CONJUR_APPLIANCE_URL= ``` ```java -import net.conjur.api.Conjur; -import net.conjur.api.Token; +import com.cyberark.conjur.api.Conjur; +import com.cyberark.conjur.api.Token; Token token = Token.fromFile(Paths.get('path/to/conjur/authentication/token.json')); Conjur conjur = new Conjur(token); @@ -428,8 +428,8 @@ export CONJUR_APPLIANCE_URL= export CONJUR_AUTHN_TOKEN_FILE="path/to/conjur/authentication/token.json" ``` ```java -import net.conjur.api.Conjur; -import net.conjur.api.Token; +import com.cyberark.conjur.api.Conjur; +import com.cyberark.conjur.api.Token; Token token = Token.fromEnv(); Conjur conjur = new Conjur(token); @@ -443,7 +443,7 @@ To use the client, you will first create an instance of the client and then call to send requests to the Conjur API. The most common use case is adding and retrieving a secret from Conjur, so we provide some sample code for this use case below. -### Conjur Client Instance (`net.conjur.api.Conjur`) +### Conjur Client Instance (`com.cyberark.conjur.api.Conjur`) The client can be instantiated with any of these methods: ```java @@ -471,7 +471,7 @@ Sets a variable to a specific value based on its ID. Example: ```java -import net.conjur.api.Conjur; +import com.cyberark.conjur.api.Conjur; Conjur conjur = new Conjur(); conjur.variables().addSecret(VARIABLE_ID, VARIABLE_VALUE); @@ -487,7 +487,7 @@ Retireves a variable based on its ID. Example: ```java -import net.conjur.api.Conjur; +import com.cyberark.conjur.api.Conjur; Conjur conjur = new Conjur(); conjur.variables().retrieveSecret(""); @@ -504,7 +504,7 @@ alternative implementation. ## Troubleshooting -### `error: package net.conjur does not exist` +### `error: package com.cyberark.conjur does not exist` This is caused by Maven's (or your dependency resolution tooling) inability to find Conjur APIs. Please ensure that you have followed the [setup](#setup) section to properly install diff --git a/pom.xml b/pom.xml index 43dd16c..69fe829 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 - net.conjur.api + com.cyberark.conjur.api conjur-api 2.2.1 diff --git a/src/main/java/net/conjur/api/AuthnProvider.java b/src/main/java/net/conjur/api/AuthnProvider.java index 2a67344..70cd2e5 100644 --- a/src/main/java/net/conjur/api/AuthnProvider.java +++ b/src/main/java/net/conjur/api/AuthnProvider.java @@ -1,4 +1,4 @@ -package net.conjur.api; +package com.cyberark.conjur.api; /** diff --git a/src/main/java/net/conjur/api/Conjur.java b/src/main/java/net/conjur/api/Conjur.java index a06238c..493a2b1 100644 --- a/src/main/java/net/conjur/api/Conjur.java +++ b/src/main/java/net/conjur/api/Conjur.java @@ -1,4 +1,4 @@ -package net.conjur.api; +package com.cyberark.conjur.api; import javax.net.ssl.SSLContext; diff --git a/src/main/java/net/conjur/api/Constants.java b/src/main/java/net/conjur/api/Constants.java index 9f50f2e..3aaeca0 100644 --- a/src/main/java/net/conjur/api/Constants.java +++ b/src/main/java/net/conjur/api/Constants.java @@ -1,4 +1,4 @@ -package net.conjur.api; +package com.cyberark.conjur.api; public class Constants { diff --git a/src/main/java/net/conjur/api/Credentials.java b/src/main/java/net/conjur/api/Credentials.java index 8040363..023f362 100644 --- a/src/main/java/net/conjur/api/Credentials.java +++ b/src/main/java/net/conjur/api/Credentials.java @@ -1,6 +1,6 @@ -package net.conjur.api; +package com.cyberark.conjur.api; -import net.conjur.util.Properties; +import com.cyberark.conjur.util.Properties; /** * Stores credentials for a Conjur identity. @@ -80,9 +80,9 @@ public String toString(){ @Override public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof net.conjur.api.Credentials)) return false; + if (!(o instanceof com.cyberark.conjur.api.Credentials)) return false; - net.conjur.api.Credentials that = (net.conjur.api.Credentials) o; + com.cyberark.conjur.api.Credentials that = (com.cyberark.conjur.api.Credentials) o; if (!password.equals(that.getPassword())) return false; if (!username.equals(that.getUsername())) return false; diff --git a/src/main/java/net/conjur/api/Endpoints.java b/src/main/java/net/conjur/api/Endpoints.java index 00be3e4..9998775 100644 --- a/src/main/java/net/conjur/api/Endpoints.java +++ b/src/main/java/net/conjur/api/Endpoints.java @@ -1,7 +1,7 @@ -package net.conjur.api; +package com.cyberark.conjur.api; -import net.conjur.util.Args; -import net.conjur.util.Properties; +import com.cyberark.conjur.util.Args; +import com.cyberark.conjur.util.Properties; import java.io.Serializable; import java.net.URI; diff --git a/src/main/java/net/conjur/api/ResourceProvider.java b/src/main/java/net/conjur/api/ResourceProvider.java index 4cc7908..fce682d 100644 --- a/src/main/java/net/conjur/api/ResourceProvider.java +++ b/src/main/java/net/conjur/api/ResourceProvider.java @@ -1,4 +1,4 @@ -package net.conjur.api; +package com.cyberark.conjur.api; /** * Provides methods for retrieving and setting Conjur resources diff --git a/src/main/java/net/conjur/api/Token.java b/src/main/java/net/conjur/api/Token.java index f8cc7ae..f5c7cf0 100644 --- a/src/main/java/net/conjur/api/Token.java +++ b/src/main/java/net/conjur/api/Token.java @@ -1,7 +1,7 @@ -package net.conjur.api; +package com.cyberark.conjur.api; import com.google.gson.annotations.SerializedName; -import net.conjur.util.JsonSupport; +import com.cyberark.conjur.util.JsonSupport; import org.apache.commons.codec.binary.Base64; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; diff --git a/src/main/java/net/conjur/api/Variables.java b/src/main/java/net/conjur/api/Variables.java index 1eab1b4..2fc1e36 100644 --- a/src/main/java/net/conjur/api/Variables.java +++ b/src/main/java/net/conjur/api/Variables.java @@ -1,8 +1,8 @@ -package net.conjur.api; +package com.cyberark.conjur.api; import javax.net.ssl.SSLContext; -import net.conjur.api.clients.ResourceClient; +import com.cyberark.conjur.api.clients.ResourceClient; public class Variables { diff --git a/src/main/java/net/conjur/api/clients/AuthnClient.java b/src/main/java/net/conjur/api/clients/AuthnClient.java index 2c4bd6d..e6bf4d9 100644 --- a/src/main/java/net/conjur/api/clients/AuthnClient.java +++ b/src/main/java/net/conjur/api/clients/AuthnClient.java @@ -1,4 +1,4 @@ -package net.conjur.api.clients; +package com.cyberark.conjur.api.clients; import static net.conjur.util.EncodeUriComponent.encodeUriComponent; @@ -10,11 +10,11 @@ import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Response; -import net.conjur.api.AuthnProvider; -import net.conjur.api.Credentials; -import net.conjur.api.Endpoints; -import net.conjur.api.Token; -import net.conjur.util.rs.HttpBasicAuthFilter; +import com.cyberark.conjur.api.AuthnProvider; +import com.cyberark.conjur.api.Credentials; +import com.cyberark.conjur.api.Endpoints; +import com.cyberark.conjur.api.Token; +import com.cyberark.conjur.util.rs.HttpBasicAuthFilter; /** * Conjur authentication service client. diff --git a/src/main/java/net/conjur/api/clients/AuthnTokenClient.java b/src/main/java/net/conjur/api/clients/AuthnTokenClient.java index 2bf845e..ab838dd 100644 --- a/src/main/java/net/conjur/api/clients/AuthnTokenClient.java +++ b/src/main/java/net/conjur/api/clients/AuthnTokenClient.java @@ -1,6 +1,6 @@ -package net.conjur.api.clients; -import net.conjur.api.AuthnProvider; -import net.conjur.api.Token; +package com.cyberark.conjur.api.clients; +import com.cyberark.conjur.api.AuthnProvider; +import com.cyberark.conjur.api.Token; public class AuthnTokenClient implements AuthnProvider { private Token token; diff --git a/src/main/java/net/conjur/api/clients/ResourceClient.java b/src/main/java/net/conjur/api/clients/ResourceClient.java index a9ad3f6..81b77ed 100644 --- a/src/main/java/net/conjur/api/clients/ResourceClient.java +++ b/src/main/java/net/conjur/api/clients/ResourceClient.java @@ -1,4 +1,4 @@ -package net.conjur.api.clients; +package com.cyberark.conjur.api.clients; import javax.net.ssl.SSLContext; import javax.ws.rs.WebApplicationException; @@ -8,12 +8,12 @@ import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Response; -import net.conjur.api.Credentials; -import net.conjur.api.Endpoints; -import net.conjur.api.ResourceProvider; -import net.conjur.api.Token; -import net.conjur.util.EncodeUriComponent; -import net.conjur.util.rs.TokenAuthFilter; +import com.cyberark.conjur.api.Credentials; +import com.cyberark.conjur.api.Endpoints; +import com.cyberark.conjur.api.ResourceProvider; +import com.cyberark.conjur.api.Token; +import com.cyberark.conjur.util.EncodeUriComponent; +import com.cyberark.conjur.util.rs.TokenAuthFilter; /** * Conjur service client. diff --git a/src/main/java/net/conjur/util/Args.java b/src/main/java/net/conjur/util/Args.java index 0996f6a..7c7d76f 100644 --- a/src/main/java/net/conjur/util/Args.java +++ b/src/main/java/net/conjur/util/Args.java @@ -1,4 +1,4 @@ -package net.conjur.util; +package com.cyberark.conjur.util; /* * Copied from org.apache.http.utils.Args to avoid dependencies. */ diff --git a/src/main/java/net/conjur/util/Callable.java b/src/main/java/net/conjur/util/Callable.java index 6f3b901..eca3814 100644 --- a/src/main/java/net/conjur/util/Callable.java +++ b/src/main/java/net/conjur/util/Callable.java @@ -1,4 +1,4 @@ -package net.conjur.util; +package com.cyberark.conjur.util; public interface Callable { public T call() throws Exception; diff --git a/src/main/java/net/conjur/util/EncodeUriComponent.java b/src/main/java/net/conjur/util/EncodeUriComponent.java index f99d14a..522d0c9 100644 --- a/src/main/java/net/conjur/util/EncodeUriComponent.java +++ b/src/main/java/net/conjur/util/EncodeUriComponent.java @@ -1,4 +1,4 @@ -package net.conjur.util; +package com.cyberark.conjur.util; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; diff --git a/src/main/java/net/conjur/util/JsonSupport.java b/src/main/java/net/conjur/util/JsonSupport.java index 34f4b6b..5d709cc 100644 --- a/src/main/java/net/conjur/util/JsonSupport.java +++ b/src/main/java/net/conjur/util/JsonSupport.java @@ -1,4 +1,4 @@ -package net.conjur.util; +package com.cyberark.conjur.util; import com.google.gson.Gson; diff --git a/src/main/java/net/conjur/util/Lang.java b/src/main/java/net/conjur/util/Lang.java index 1ce1e02..0d983bb 100644 --- a/src/main/java/net/conjur/util/Lang.java +++ b/src/main/java/net/conjur/util/Lang.java @@ -1,4 +1,4 @@ -package net.conjur.util; +package com.cyberark.conjur.util; /** * diff --git a/src/main/java/net/conjur/util/Properties.java b/src/main/java/net/conjur/util/Properties.java index 1de0118..d38af01 100644 --- a/src/main/java/net/conjur/util/Properties.java +++ b/src/main/java/net/conjur/util/Properties.java @@ -1,4 +1,4 @@ -package net.conjur.util; +package com.cyberark.conjur.util; /** * Properties helpers diff --git a/src/main/java/net/conjur/util/TextUtils.java b/src/main/java/net/conjur/util/TextUtils.java index 4549cc5..c9f7ac3 100644 --- a/src/main/java/net/conjur/util/TextUtils.java +++ b/src/main/java/net/conjur/util/TextUtils.java @@ -1,4 +1,4 @@ -package net.conjur.util; +package com.cyberark.conjur.util; import java.io.UnsupportedEncodingException; diff --git a/src/main/java/net/conjur/util/rs/HttpBasicAuthFilter.java b/src/main/java/net/conjur/util/rs/HttpBasicAuthFilter.java index ef1bb62..a030716 100644 --- a/src/main/java/net/conjur/util/rs/HttpBasicAuthFilter.java +++ b/src/main/java/net/conjur/util/rs/HttpBasicAuthFilter.java @@ -1,4 +1,4 @@ -package net.conjur.util.rs; +package com.cyberark.conjur.util.rs; import org.apache.commons.codec.binary.Base64; diff --git a/src/main/java/net/conjur/util/rs/JsonBodyReader.java b/src/main/java/net/conjur/util/rs/JsonBodyReader.java index 3bfb384..6a1ad16 100644 --- a/src/main/java/net/conjur/util/rs/JsonBodyReader.java +++ b/src/main/java/net/conjur/util/rs/JsonBodyReader.java @@ -1,5 +1,5 @@ -package net.conjur.util.rs; +package com.cyberark.conjur.util.rs; import com.google.gson.Gson; import edu.emory.mathcs.backport.java.util.Collections; diff --git a/src/main/java/net/conjur/util/rs/JsonReadable.java b/src/main/java/net/conjur/util/rs/JsonReadable.java index f4dd7bd..2dd1f69 100644 --- a/src/main/java/net/conjur/util/rs/JsonReadable.java +++ b/src/main/java/net/conjur/util/rs/JsonReadable.java @@ -1,4 +1,4 @@ -package net.conjur.util.rs; +package com.cyberark.conjur.util.rs; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/net/conjur/util/rs/TokenAuthFilter.java b/src/main/java/net/conjur/util/rs/TokenAuthFilter.java index b402abe..f0786ab 100644 --- a/src/main/java/net/conjur/util/rs/TokenAuthFilter.java +++ b/src/main/java/net/conjur/util/rs/TokenAuthFilter.java @@ -1,8 +1,8 @@ -package net.conjur.util.rs; +package com.cyberark.conjur.util.rs; -import net.conjur.api.AuthnProvider; -import net.conjur.api.Token; -import net.conjur.util.Args; +import com.cyberark.conjur.api.AuthnProvider; +import com.cyberark.conjur.api.Token; +import com.cyberark.conjur.util.Args; import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientRequestFilter; diff --git a/src/test/java/net/conjur/api/ConjurTest.java b/src/test/java/net/conjur/api/ConjurTest.java index 4fcb1e5..d8ab80d 100644 --- a/src/test/java/net/conjur/api/ConjurTest.java +++ b/src/test/java/net/conjur/api/ConjurTest.java @@ -1,4 +1,4 @@ -package net.conjur.api; +package com.cyberark.conjur.api; import org.junit.Assert; import org.junit.Rule; From 94a7d9470f975de172dd79003399e14f4bb63602 Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Mon, 8 Jun 2020 16:07:47 -0400 Subject: [PATCH 02/14] Update pom.xml with Maven Central requirements The following pieces of information were added to the project pom.xml to meet the requirements of Maven Central - Added license information - Added developer / maintainer information - Added scm information - Relocated pacakging information --- pom.xml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 69fe829..01978d2 100644 --- a/pom.xml +++ b/pom.xml @@ -4,11 +4,30 @@ com.cyberark.conjur.api conjur-api 2.2.1 + jar Conjur Client for the Conjur API + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + Cyberark Conjur + conj_maintainers@cyberark.com + Cyberark Software Ltd. + https://conjur.org + + + + scm:git:git://github.com/cyberark/conjur-api-java.git + scm:git:ssh://github.com:cyberark/conjur-api-java.git https://github.com/cyberark/conjur-api-java @@ -83,8 +102,6 @@ - jar - conjurinc-releases From 06bbf933ac88f1b2064211845b14ec942f1c8cb8 Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Mon, 8 Jun 2020 17:45:37 -0400 Subject: [PATCH 03/14] Introduce "release" profile to pom This profile is used to restrict functionality required by release to build commands that specifically request the profile. Otherwise, this configuration will not be used. - Adds OSSRH release and snapshot support to the distribution management release profile - Adds nexus staging plugin for releasing to Maven Central - Adds several additional maven plugins needed for authentication and generating javadoc and source files - Adds Maven GPG plugin to sign components --- pom.xml | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/pom.xml b/pom.xml index 01978d2..47e6aac 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,77 @@ https://github.com/cyberark/conjur-api-java + + + release + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + UTF-8 2.0 From 95105e2764cc6baa7fc836f34f20b4d6bf46a119 Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Tue, 9 Jun 2020 11:00:45 -0400 Subject: [PATCH 04/14] Add snapshot suffix to version Until we are intentionally performing a release, the `SNAPSHOT` suffix should be used on the version tag. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 47e6aac..6f04aa7 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.cyberark.conjur.api conjur-api - 2.2.1 + 2.2.1-SNAPSHOT jar Conjur From e757fe4ba868356f54199fbf7a3c2a65c57c127e Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Tue, 9 Jun 2020 11:46:56 -0400 Subject: [PATCH 05/14] Restructure project to match project namespace The folder structure needed to be adjusted to match the new `com.cyberark` namespace used in Maven Central --- src/main/java/{net => com/cyberark}/conjur/api/AuthnProvider.java | 0 src/main/java/{net => com/cyberark}/conjur/api/Conjur.java | 0 src/main/java/{net => com/cyberark}/conjur/api/Constants.java | 0 src/main/java/{net => com/cyberark}/conjur/api/Credentials.java | 0 src/main/java/{net => com/cyberark}/conjur/api/Endpoints.java | 0 .../java/{net => com/cyberark}/conjur/api/ResourceProvider.java | 0 src/main/java/{net => com/cyberark}/conjur/api/Token.java | 0 src/main/java/{net => com/cyberark}/conjur/api/Variables.java | 0 .../{net => com/cyberark}/conjur/api/clients/AuthnClient.java | 0 .../cyberark}/conjur/api/clients/AuthnTokenClient.java | 0 .../{net => com/cyberark}/conjur/api/clients/ResourceClient.java | 0 src/main/java/{net => com/cyberark}/conjur/util/Args.java | 0 src/main/java/{net => com/cyberark}/conjur/util/Callable.java | 0 .../{net => com/cyberark}/conjur/util/EncodeUriComponent.java | 0 src/main/java/{net => com/cyberark}/conjur/util/JsonSupport.java | 0 src/main/java/{net => com/cyberark}/conjur/util/Lang.java | 0 src/main/java/{net => com/cyberark}/conjur/util/Properties.java | 0 src/main/java/{net => com/cyberark}/conjur/util/TextUtils.java | 0 .../{net => com/cyberark}/conjur/util/rs/HttpBasicAuthFilter.java | 0 .../java/{net => com/cyberark}/conjur/util/rs/JsonBodyReader.java | 0 .../java/{net => com/cyberark}/conjur/util/rs/JsonReadable.java | 0 .../{net => com/cyberark}/conjur/util/rs/TokenAuthFilter.java | 0 22 files changed, 0 insertions(+), 0 deletions(-) rename src/main/java/{net => com/cyberark}/conjur/api/AuthnProvider.java (100%) rename src/main/java/{net => com/cyberark}/conjur/api/Conjur.java (100%) rename src/main/java/{net => com/cyberark}/conjur/api/Constants.java (100%) rename src/main/java/{net => com/cyberark}/conjur/api/Credentials.java (100%) rename src/main/java/{net => com/cyberark}/conjur/api/Endpoints.java (100%) rename src/main/java/{net => com/cyberark}/conjur/api/ResourceProvider.java (100%) rename src/main/java/{net => com/cyberark}/conjur/api/Token.java (100%) rename src/main/java/{net => com/cyberark}/conjur/api/Variables.java (100%) rename src/main/java/{net => com/cyberark}/conjur/api/clients/AuthnClient.java (100%) rename src/main/java/{net => com/cyberark}/conjur/api/clients/AuthnTokenClient.java (100%) rename src/main/java/{net => com/cyberark}/conjur/api/clients/ResourceClient.java (100%) rename src/main/java/{net => com/cyberark}/conjur/util/Args.java (100%) rename src/main/java/{net => com/cyberark}/conjur/util/Callable.java (100%) rename src/main/java/{net => com/cyberark}/conjur/util/EncodeUriComponent.java (100%) rename src/main/java/{net => com/cyberark}/conjur/util/JsonSupport.java (100%) rename src/main/java/{net => com/cyberark}/conjur/util/Lang.java (100%) rename src/main/java/{net => com/cyberark}/conjur/util/Properties.java (100%) rename src/main/java/{net => com/cyberark}/conjur/util/TextUtils.java (100%) rename src/main/java/{net => com/cyberark}/conjur/util/rs/HttpBasicAuthFilter.java (100%) rename src/main/java/{net => com/cyberark}/conjur/util/rs/JsonBodyReader.java (100%) rename src/main/java/{net => com/cyberark}/conjur/util/rs/JsonReadable.java (100%) rename src/main/java/{net => com/cyberark}/conjur/util/rs/TokenAuthFilter.java (100%) diff --git a/src/main/java/net/conjur/api/AuthnProvider.java b/src/main/java/com/cyberark/conjur/api/AuthnProvider.java similarity index 100% rename from src/main/java/net/conjur/api/AuthnProvider.java rename to src/main/java/com/cyberark/conjur/api/AuthnProvider.java diff --git a/src/main/java/net/conjur/api/Conjur.java b/src/main/java/com/cyberark/conjur/api/Conjur.java similarity index 100% rename from src/main/java/net/conjur/api/Conjur.java rename to src/main/java/com/cyberark/conjur/api/Conjur.java diff --git a/src/main/java/net/conjur/api/Constants.java b/src/main/java/com/cyberark/conjur/api/Constants.java similarity index 100% rename from src/main/java/net/conjur/api/Constants.java rename to src/main/java/com/cyberark/conjur/api/Constants.java diff --git a/src/main/java/net/conjur/api/Credentials.java b/src/main/java/com/cyberark/conjur/api/Credentials.java similarity index 100% rename from src/main/java/net/conjur/api/Credentials.java rename to src/main/java/com/cyberark/conjur/api/Credentials.java diff --git a/src/main/java/net/conjur/api/Endpoints.java b/src/main/java/com/cyberark/conjur/api/Endpoints.java similarity index 100% rename from src/main/java/net/conjur/api/Endpoints.java rename to src/main/java/com/cyberark/conjur/api/Endpoints.java diff --git a/src/main/java/net/conjur/api/ResourceProvider.java b/src/main/java/com/cyberark/conjur/api/ResourceProvider.java similarity index 100% rename from src/main/java/net/conjur/api/ResourceProvider.java rename to src/main/java/com/cyberark/conjur/api/ResourceProvider.java diff --git a/src/main/java/net/conjur/api/Token.java b/src/main/java/com/cyberark/conjur/api/Token.java similarity index 100% rename from src/main/java/net/conjur/api/Token.java rename to src/main/java/com/cyberark/conjur/api/Token.java diff --git a/src/main/java/net/conjur/api/Variables.java b/src/main/java/com/cyberark/conjur/api/Variables.java similarity index 100% rename from src/main/java/net/conjur/api/Variables.java rename to src/main/java/com/cyberark/conjur/api/Variables.java diff --git a/src/main/java/net/conjur/api/clients/AuthnClient.java b/src/main/java/com/cyberark/conjur/api/clients/AuthnClient.java similarity index 100% rename from src/main/java/net/conjur/api/clients/AuthnClient.java rename to src/main/java/com/cyberark/conjur/api/clients/AuthnClient.java diff --git a/src/main/java/net/conjur/api/clients/AuthnTokenClient.java b/src/main/java/com/cyberark/conjur/api/clients/AuthnTokenClient.java similarity index 100% rename from src/main/java/net/conjur/api/clients/AuthnTokenClient.java rename to src/main/java/com/cyberark/conjur/api/clients/AuthnTokenClient.java diff --git a/src/main/java/net/conjur/api/clients/ResourceClient.java b/src/main/java/com/cyberark/conjur/api/clients/ResourceClient.java similarity index 100% rename from src/main/java/net/conjur/api/clients/ResourceClient.java rename to src/main/java/com/cyberark/conjur/api/clients/ResourceClient.java diff --git a/src/main/java/net/conjur/util/Args.java b/src/main/java/com/cyberark/conjur/util/Args.java similarity index 100% rename from src/main/java/net/conjur/util/Args.java rename to src/main/java/com/cyberark/conjur/util/Args.java diff --git a/src/main/java/net/conjur/util/Callable.java b/src/main/java/com/cyberark/conjur/util/Callable.java similarity index 100% rename from src/main/java/net/conjur/util/Callable.java rename to src/main/java/com/cyberark/conjur/util/Callable.java diff --git a/src/main/java/net/conjur/util/EncodeUriComponent.java b/src/main/java/com/cyberark/conjur/util/EncodeUriComponent.java similarity index 100% rename from src/main/java/net/conjur/util/EncodeUriComponent.java rename to src/main/java/com/cyberark/conjur/util/EncodeUriComponent.java diff --git a/src/main/java/net/conjur/util/JsonSupport.java b/src/main/java/com/cyberark/conjur/util/JsonSupport.java similarity index 100% rename from src/main/java/net/conjur/util/JsonSupport.java rename to src/main/java/com/cyberark/conjur/util/JsonSupport.java diff --git a/src/main/java/net/conjur/util/Lang.java b/src/main/java/com/cyberark/conjur/util/Lang.java similarity index 100% rename from src/main/java/net/conjur/util/Lang.java rename to src/main/java/com/cyberark/conjur/util/Lang.java diff --git a/src/main/java/net/conjur/util/Properties.java b/src/main/java/com/cyberark/conjur/util/Properties.java similarity index 100% rename from src/main/java/net/conjur/util/Properties.java rename to src/main/java/com/cyberark/conjur/util/Properties.java diff --git a/src/main/java/net/conjur/util/TextUtils.java b/src/main/java/com/cyberark/conjur/util/TextUtils.java similarity index 100% rename from src/main/java/net/conjur/util/TextUtils.java rename to src/main/java/com/cyberark/conjur/util/TextUtils.java diff --git a/src/main/java/net/conjur/util/rs/HttpBasicAuthFilter.java b/src/main/java/com/cyberark/conjur/util/rs/HttpBasicAuthFilter.java similarity index 100% rename from src/main/java/net/conjur/util/rs/HttpBasicAuthFilter.java rename to src/main/java/com/cyberark/conjur/util/rs/HttpBasicAuthFilter.java diff --git a/src/main/java/net/conjur/util/rs/JsonBodyReader.java b/src/main/java/com/cyberark/conjur/util/rs/JsonBodyReader.java similarity index 100% rename from src/main/java/net/conjur/util/rs/JsonBodyReader.java rename to src/main/java/com/cyberark/conjur/util/rs/JsonBodyReader.java diff --git a/src/main/java/net/conjur/util/rs/JsonReadable.java b/src/main/java/com/cyberark/conjur/util/rs/JsonReadable.java similarity index 100% rename from src/main/java/net/conjur/util/rs/JsonReadable.java rename to src/main/java/com/cyberark/conjur/util/rs/JsonReadable.java diff --git a/src/main/java/net/conjur/util/rs/TokenAuthFilter.java b/src/main/java/com/cyberark/conjur/util/rs/TokenAuthFilter.java similarity index 100% rename from src/main/java/net/conjur/util/rs/TokenAuthFilter.java rename to src/main/java/com/cyberark/conjur/util/rs/TokenAuthFilter.java From 1a60cd868510c9740cb4e5be32cf740fcbdb7611 Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Tue, 9 Jun 2020 17:01:08 -0400 Subject: [PATCH 06/14] Add release profiles to pom.xml - Added artifactory profile for using artifactory as the release target - Moved gpg to a profile only used when signing is requested - Added maven-release plugin, which can be used for manual releases --- pom.xml | 65 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 6f04aa7..81fa5ab 100644 --- a/pom.xml +++ b/pom.xml @@ -3,6 +3,8 @@ 4.0.0 com.cyberark.conjur.api conjur-api + 2.2.1-SNAPSHOT jar @@ -32,8 +34,26 @@ + - release + artifactory + + + conjurinc-releases + conjurinc-releases + https://conjurinc.artifactoryonline.com/conjurinc/libs-release-local + + + conjurinc-snapshots + conjurinc-snapshots + https://conjurinc.artifactoryonline.com/conjurinc/libs-snapshot-local + + + + + + + ossrh ossrh @@ -44,6 +64,7 @@ https://oss.sonatype.org/service/local/staging/deploy/maven2/ + @@ -83,6 +104,15 @@ + + + + + + + sign + + org.apache.maven.plugins maven-gpg-plugin @@ -94,6 +124,10 @@ sign + + ${gpg.keyname} + ${gpg.keyname} + @@ -173,19 +207,6 @@ - - - conjurinc-releases - conjurinc-releases - https://conjurinc.artifactoryonline.com/conjurinc/libs-release-local - - - conjurinc-snapshots - conjurinc-snapshots - https://conjurinc.artifactoryonline.com/conjurinc/libs-snapshot-local - - - src/main/java @@ -254,6 +275,22 @@ + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + true + false + ossrh,sign + deploy + v@{project.version} + + + From 2bc80d5b062221dbf90b3791194d798ac066c12e Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Tue, 9 Jun 2020 17:02:46 -0400 Subject: [PATCH 07/14] Add deployment scripts for releases and snapshots - On a master branch, we sign and deploy a new snapshot - On a tagged build, we sign and deploy a new release --- Jenkinsfile | 17 +++++++++++++---- bin/build.sh | 9 ++++----- bin/deploy-release.sh | 15 +++++++++++++++ bin/deploy-snapshot.sh | 8 ++++++++ 4 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 bin/deploy-release.sh create mode 100644 bin/deploy-snapshot.sh diff --git a/Jenkinsfile b/Jenkinsfile index b299811..f74bc5a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ pipeline { } } } - + stage('Create and archive the Maven package') { steps { sh './bin/build.sh' @@ -37,12 +37,21 @@ pipeline { } } - stage('Publish the Maven package') { + stage('Perform Snapshot Deployment') { when { branch 'master' } steps { - echo 'TODO' + echo './bin/deploy-snapshot' + } + } + + stage('Perform Release Deployment') { + when { + buildingTag() + } + steps { + echo './bin/deploy-release' } } } @@ -52,4 +61,4 @@ pipeline { cleanupAndNotify(currentBuild.currentResult) } } -} +} \ No newline at end of file diff --git a/bin/build.sh b/bin/build.sh index 410a7d2..ed6de69 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -1,8 +1,7 @@ #!/usr/bin/env bash set -eo pipefail - -#TODO - add rest of steps needed to build the package - -docker run --rm -v "$PWD:/conjurinc/api-java" -w /conjurinc/api-java maven:3-jdk-8 /bin/bash -c \ -"mvn -X -e clean package -Dmaven.test.skip=true" \ No newline at end of file +docker run --rm \ + -v "$PWD:/conjurinc/api-java" \ + -w /conjurinc/api-java maven:3-jdk-8 \ + /bin/bash -c "mvn -X -e clean package -Dmaven.test.skip=true" diff --git a/bin/deploy-release.sh b/bin/deploy-release.sh new file mode 100644 index 0000000..cdb8362 --- /dev/null +++ b/bin/deploy-release.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -eo pipefail + +# Deploy release to OSSRH +# 1. Set the version in the POM to the Tagged Version +# 2. Sign our build and deploy to OSSRH +# 3. Release our staged deployment +# Note: The autoReleaseAfterClose for the nexus-staging-maven-plugin should be +# set to "false" if we do not want releases performed automatically +docker run --rm \ + -v "$PWD:/conjurinc/api-java" \ + -w /conjurinc/api-java maven:3-jdk-8 \ + /bin/bash -c "mvn versions:set -DnewVersion=${TAG_NAME} \\ + mvn clean deploy -Dmaven.test.skip=true -P ossrh,sign \\ + mvn nexus-staging:release" diff --git a/bin/deploy-snapshot.sh b/bin/deploy-snapshot.sh new file mode 100644 index 0000000..f182b9b --- /dev/null +++ b/bin/deploy-snapshot.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -eo pipefail + +# Deploy snapshot to OSSRH +docker run --rm \ + -v "$PWD:/conjurinc/api-java" \ + -w /conjurinc/api-java maven:3-jdk-8 \ + /bin/bash -c "mvn -X -e clean deploy -Dmaven.test.skip=true -P ossrh,sign" From c11be2c25cc54bb34827bad43fe77a6ede2000bc Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Tue, 9 Jun 2020 17:24:39 -0400 Subject: [PATCH 08/14] OSSRH and GPG secrets support - Modified secrets.yml to pull ossrh and gpg credentials - Modified settings.xml to support authenticating for ossrh and using a keyphrase to retrieve the gpg passphrase --- bin/deploy-release.sh | 5 ++++- secrets.yml | 5 ++++- settings.xml | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/bin/deploy-release.sh b/bin/deploy-release.sh index cdb8362..31b3282 100644 --- a/bin/deploy-release.sh +++ b/bin/deploy-release.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash set -eo pipefail +# Strip the 'v' from the Tag Name +export TAG=${TAG_NAME:1} + # Deploy release to OSSRH # 1. Set the version in the POM to the Tagged Version # 2. Sign our build and deploy to OSSRH @@ -10,6 +13,6 @@ set -eo pipefail docker run --rm \ -v "$PWD:/conjurinc/api-java" \ -w /conjurinc/api-java maven:3-jdk-8 \ - /bin/bash -c "mvn versions:set -DnewVersion=${TAG_NAME} \\ + /bin/bash -c "mvn versions:set -DnewVersion=${TAG} \\ mvn clean deploy -Dmaven.test.skip=true -P ossrh,sign \\ mvn nexus-staging:release" diff --git a/secrets.yml b/secrets.yml index cf47a56..986118f 100644 --- a/secrets.yml +++ b/secrets.yml @@ -1,2 +1,5 @@ ARTIFACTORY_USERNAME: !var artifactory/users/jenkins/username -ARTIFACTORY_PASSWORD: !var artifactory/users/jenkins/password \ No newline at end of file +ARTIFACTORY_PASSWORD: !var artifactory/users/jenkins/password +OSSRH_USERNAME: !var ossrh/username +OSSRH_PASSWORD: !var ossrh/password +GPG_PASSPHRASE: !var gpg/private-key diff --git a/settings.xml b/settings.xml index 1f9fe94..e487d35 100644 --- a/settings.xml +++ b/settings.xml @@ -13,5 +13,26 @@ ${env.ARTIFACTORY_PASSWORD} conjurinc-snapshots + + ${env.OSSRH_USERNAME} + ${env.OSSRH_PASSWORD} + ossrh + + + + gpg.key + ${env.GPG_PASSPHRASE} + + + + ossrh + + true + + + gpg.key + + + From 242a9bc6cbcb64b4bc424c841a536ecfe5239a18 Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Tue, 16 Jun 2020 12:24:06 -0400 Subject: [PATCH 09/14] Add debugging and custom settings to deployment - Deployment scripts now inject the correct credentials as environment variables - Deployment scripts inject settings.xml at runtime - Summon is used in the pipeline to retrieve secrets - Removed out of date settings from settings.xml - Added configuration for GPG to use files rather than strings inside environment variables --- Jenkinsfile | 4 ++-- bin/deploy-release.sh | 13 ++++++++---- bin/deploy-snapshot.sh | 9 +++++++-- pom.xml | 9 +++++++-- secrets.yml | 9 ++++----- settings.xml | 46 +++++++++--------------------------------- 6 files changed, 39 insertions(+), 51 deletions(-) mode change 100644 => 100755 bin/deploy-release.sh mode change 100644 => 100755 bin/deploy-snapshot.sh diff --git a/Jenkinsfile b/Jenkinsfile index f74bc5a..ba66bb5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,7 +42,7 @@ pipeline { branch 'master' } steps { - echo './bin/deploy-snapshot' + sh 'summon ./bin/deploy-snapshot.sh' } } @@ -51,7 +51,7 @@ pipeline { buildingTag() } steps { - echo './bin/deploy-release' + sh 'summon ./bin/deploy-release.sh' } } } diff --git a/bin/deploy-release.sh b/bin/deploy-release.sh old mode 100644 new mode 100755 index 31b3282..b9e4dfe --- a/bin/deploy-release.sh +++ b/bin/deploy-release.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash -ex set -eo pipefail # Strip the 'v' from the Tag Name @@ -9,10 +9,15 @@ export TAG=${TAG_NAME:1} # 2. Sign our build and deploy to OSSRH # 3. Release our staged deployment # Note: The autoReleaseAfterClose for the nexus-staging-maven-plugin should be -# set to "false" if we do not want releases performed automatically +# set to "false" if we do not want releases published automatically docker run --rm \ + -e OSSRH_USERNAME \ + -e OSSRH_PASSWORD \ -v "$PWD:/conjurinc/api-java" \ + -v "$GPG_PASSWORD:/gpg_password" \ + -v "$GPG_PRIVATE_KEY:/gpg_key" \ -w /conjurinc/api-java maven:3-jdk-8 \ - /bin/bash -c "mvn versions:set -DnewVersion=${TAG} \\ - mvn clean deploy -Dmaven.test.skip=true -P ossrh,sign \\ + /bin/bash -c "gpg --batch --passphrase-file /gpg_password --trust-model always --import /gpg_key && + mvn versions:set -DnewVersion=${TAG} && + mvn --settings settings.xml clean deploy -Dmaven.test.skip=true -P ossrh,sign && mvn nexus-staging:release" diff --git a/bin/deploy-snapshot.sh b/bin/deploy-snapshot.sh old mode 100644 new mode 100755 index f182b9b..6c2a58d --- a/bin/deploy-snapshot.sh +++ b/bin/deploy-snapshot.sh @@ -1,8 +1,13 @@ -#!/usr/bin/env bash +#!/bin/bash -ex set -eo pipefail # Deploy snapshot to OSSRH docker run --rm \ + -e OSSRH_USERNAME \ + -e OSSRH_PASSWORD \ -v "$PWD:/conjurinc/api-java" \ + -v "$GPG_PASSWORD:/gpg_password" \ + -v "$GPG_PRIVATE_KEY:/gpg_key" \ -w /conjurinc/api-java maven:3-jdk-8 \ - /bin/bash -c "mvn -X -e clean deploy -Dmaven.test.skip=true -P ossrh,sign" + /bin/bash -c "gpg --batch --passphrase-file /gpg_password --trust-model always --import /gpg_key && + mvn --settings settings.xml clean deploy -Dmaven.test.skip=true -P ossrh,sign" diff --git a/pom.xml b/pom.xml index 81fa5ab..bb4d5b6 100644 --- a/pom.xml +++ b/pom.xml @@ -125,8 +125,13 @@ sign - ${gpg.keyname} - ${gpg.keyname} + + + --pinentry-mode + loopback + --passphrase-file + /gpg_password + diff --git a/secrets.yml b/secrets.yml index 986118f..9cfe269 100644 --- a/secrets.yml +++ b/secrets.yml @@ -1,5 +1,4 @@ -ARTIFACTORY_USERNAME: !var artifactory/users/jenkins/username -ARTIFACTORY_PASSWORD: !var artifactory/users/jenkins/password -OSSRH_USERNAME: !var ossrh/username -OSSRH_PASSWORD: !var ossrh/password -GPG_PASSPHRASE: !var gpg/private-key +OSSRH_USERNAME: !var ecosystems/java/ossrh/username +OSSRH_PASSWORD: !var ecosystems/java/ossrh/password +GPG_PRIVATE_KEY: !var:file ecosystems/java/gpg/private-key +GPG_PASSWORD: !var:file ecosystems/java/gpg/password diff --git a/settings.xml b/settings.xml index e487d35..d9276bb 100644 --- a/settings.xml +++ b/settings.xml @@ -1,38 +1,12 @@ - - - - ${env.ARTIFACTORY_USERNAME} - ${env.ARTIFACTORY_PASSWORD} - conjurinc-releases - - - ${env.ARTIFACTORY_USERNAME} - ${env.ARTIFACTORY_PASSWORD} - conjurinc-snapshots - - - ${env.OSSRH_USERNAME} - ${env.OSSRH_PASSWORD} - ossrh - - - - gpg.key - ${env.GPG_PASSPHRASE} - - - - ossrh - - true - - - gpg.key - - - - + + + + ossrh + ${env.OSSRH_USERNAME} + ${env.OSSRH_PASSWORD} + + From 6acdd51d04584a056c1e1faf05e3a6994a731498 Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Thu, 18 Jun 2020 12:18:22 -0400 Subject: [PATCH 10/14] Fix incorrect namespace reference --- Jenkinsfile | 2 +- bin/deploy-release.sh | 6 +++--- bin/deploy-snapshot.sh | 4 ++-- .../java/com/cyberark/conjur/api/clients/AuthnClient.java | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ba66bb5..182e5a4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,4 +61,4 @@ pipeline { cleanupAndNotify(currentBuild.currentResult) } } -} \ No newline at end of file +} diff --git a/bin/deploy-release.sh b/bin/deploy-release.sh index b9e4dfe..374fc18 100755 --- a/bin/deploy-release.sh +++ b/bin/deploy-release.sh @@ -1,8 +1,8 @@ -#!/bin/bash -ex -set -eo pipefail +#!/bin/bash +set -exo pipefail # Strip the 'v' from the Tag Name -export TAG=${TAG_NAME:1} +export TAG=${TAG_NAME//"v"} # Deploy release to OSSRH # 1. Set the version in the POM to the Tagged Version diff --git a/bin/deploy-snapshot.sh b/bin/deploy-snapshot.sh index 6c2a58d..053481c 100755 --- a/bin/deploy-snapshot.sh +++ b/bin/deploy-snapshot.sh @@ -1,5 +1,5 @@ -#!/bin/bash -ex -set -eo pipefail +#!/bin/bash +set -exo pipefail # Deploy snapshot to OSSRH docker run --rm \ diff --git a/src/main/java/com/cyberark/conjur/api/clients/AuthnClient.java b/src/main/java/com/cyberark/conjur/api/clients/AuthnClient.java index e6bf4d9..f98b990 100644 --- a/src/main/java/com/cyberark/conjur/api/clients/AuthnClient.java +++ b/src/main/java/com/cyberark/conjur/api/clients/AuthnClient.java @@ -1,6 +1,6 @@ package com.cyberark.conjur.api.clients; -import static net.conjur.util.EncodeUriComponent.encodeUriComponent; +import static com.cyberark.conjur.util.EncodeUriComponent.encodeUriComponent; import javax.net.ssl.SSLContext; import javax.ws.rs.WebApplicationException; From 1d71f3c94496eefc497150883bc089cd5f182e56 Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Mon, 22 Jun 2020 11:07:21 -0400 Subject: [PATCH 11/14] Update README - Added instructions for using snapshots and releases in maven - Improved ossrh deployment scripts by simplifying commands and including more detailed comments --- README.md | 64 ++++++++++++++++++++++++++++++++++++++++++ bin/build.sh | 6 ++-- bin/deploy-release.sh | 14 +++++---- bin/deploy-snapshot.sh | 15 ++++++---- 4 files changed, 85 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8493bd1..893deb0 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,70 @@ our [Contributing](https://github.com/cyberark/conjur-api-java/blob/master/CONTR -Dpackaging=jar ``` +### Using Maven Releases + +To make use of tagged releases published to Maven, verify that you have the dependency +added to your `pom.xml` + +1. Add the following snippet to `pom.xml` +```xml + + com.cyberark.conjur.api + conjur-java-api + x.x.x + +``` + +### Using Maven Snapshots +To make use of SNAPSHOTS, which are deployed following a nightly build, there are +several steps required for configuring your project. + +> Note: Snapshots contain the latest changes to `conjur-java-api`, but it is recommended +> to use the current stable release unless there is a significant update required by your +> project + +1. Add the following to your `settings.xml` +```xml + + + allow-snapshots + true + + + snapshots-repo + https://oss.sonatype.org/content/repositories/snapshots + false + true + + + + +``` + +Alternatively, add the following to your list of repositories in `pom.xml` +```xml + + oss.sonatype.org-snapshot + http://oss.sonatype.org/content/repositories/snapshots + + false + + + true + + +``` + +2. In your `pom.xml`, verify that your `conjur-java-api` dependency includes `SNAPSHOT` +in the version tag. +```xml + + com.cyberark.conjur.api + conjur-java-api + x.x.x-SNAPSHOT + +``` + ## Configuration Once the setup steps have been successfully run, we will now define the variables needed diff --git a/bin/build.sh b/bin/build.sh index ed6de69..ac9093d 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -2,6 +2,6 @@ set -eo pipefail docker run --rm \ - -v "$PWD:/conjurinc/api-java" \ - -w /conjurinc/api-java maven:3-jdk-8 \ - /bin/bash -c "mvn -X -e clean package -Dmaven.test.skip=true" + -v "$PWD:/cyberark/conjur-java-api" \ + -w /cyberark/conjur-java-api maven:3-jdk-8 \ + /bin/bash -ec "mvn -X -e clean package -Dmaven.test.skip=true" diff --git a/bin/deploy-release.sh b/bin/deploy-release.sh index 374fc18..02b0748 100755 --- a/bin/deploy-release.sh +++ b/bin/deploy-release.sh @@ -4,20 +4,22 @@ set -exo pipefail # Strip the 'v' from the Tag Name export TAG=${TAG_NAME//"v"} -# Deploy release to OSSRH +# Deploy release to Sonatype OSSRH (OSS Repository Hosting) +# Setup: Import our GPG key and passphrase # 1. Set the version in the POM to the Tagged Version # 2. Sign our build and deploy to OSSRH # 3. Release our staged deployment +# # Note: The autoReleaseAfterClose for the nexus-staging-maven-plugin should be # set to "false" if we do not want releases published automatically docker run --rm \ -e OSSRH_USERNAME \ -e OSSRH_PASSWORD \ - -v "$PWD:/conjurinc/api-java" \ + -v "$PWD:/cyberark/conjur-java-api" \ -v "$GPG_PASSWORD:/gpg_password" \ -v "$GPG_PRIVATE_KEY:/gpg_key" \ - -w /conjurinc/api-java maven:3-jdk-8 \ - /bin/bash -c "gpg --batch --passphrase-file /gpg_password --trust-model always --import /gpg_key && - mvn versions:set -DnewVersion=${TAG} && - mvn --settings settings.xml clean deploy -Dmaven.test.skip=true -P ossrh,sign && + -w /cyberark/conjur-java-api maven:3-jdk-8 \ + /bin/bash -ec "gpg --batch --passphrase-file /gpg_password --trust-model always --import /gpg_key + mvn versions:set -DnewVersion=${TAG} + mvn --settings settings.xml clean deploy -Dmaven.test.skip=true -P ossrh,sign mvn nexus-staging:release" diff --git a/bin/deploy-snapshot.sh b/bin/deploy-snapshot.sh index 053481c..083cfb5 100755 --- a/bin/deploy-snapshot.sh +++ b/bin/deploy-snapshot.sh @@ -1,13 +1,18 @@ #!/bin/bash set -exo pipefail -# Deploy snapshot to OSSRH +# Deploy snapshot to Sonatype OSSRH (OSS Repository Hosting) +# Setup: Import our GPG key and passphrase +# 1. Deploy to snapshot repository of OSSRH +# +# Note: Snapshot releases do not need to meet Maven central requirements, +# but it is best to do so whenever possible docker run --rm \ -e OSSRH_USERNAME \ -e OSSRH_PASSWORD \ - -v "$PWD:/conjurinc/api-java" \ + -v "$PWD:/cyberark/conjur-java-api" \ -v "$GPG_PASSWORD:/gpg_password" \ -v "$GPG_PRIVATE_KEY:/gpg_key" \ - -w /conjurinc/api-java maven:3-jdk-8 \ - /bin/bash -c "gpg --batch --passphrase-file /gpg_password --trust-model always --import /gpg_key && - mvn --settings settings.xml clean deploy -Dmaven.test.skip=true -P ossrh,sign" + -w /cyberark/conjur-java-api maven:3-jdk-8 \ + /bin/bash -ec "gpg --batch --passphrase-file /gpg_password --trust-model always --import /gpg_key + mvn --settings settings.xml clean deploy -Dmaven.test.skip=true -P ossrh,sign" From 70f5a71ab15ea886933ce344848bbcb9d11a6f7d Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Mon, 22 Jun 2020 13:40:37 -0400 Subject: [PATCH 12/14] Add UPGRADING.md Introduces UPGRADING.md, including instructions for updating to 3.0.0 --- UPGRADING.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 UPGRADING.md diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 0000000..2fde6a5 --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,60 @@ +# Upgrading Conjur Java API + +This guide describes how to upgrade your project to use Conjur Java API. + +The main scenario covered in this document is migrating a project with a Conjur-Java-API +to v3.0.0. + +For more details about using the Conjur API, or contributing to development, please +refer to the [Conjur Java API](https://github.com/cyberark/conjur-api-java). + +For further assistance installing and configuring the Conjur Java API, +please refer to the [Setup](README.md#Setup) section of +the Conjur Java API [README.md](README.md) file. + +## Migrating to 3.0.0 + +With the update to v.3.0.0, the Conjur Java API now makes use of the `com.cyberark` +project namespace. This allows us to publish artifacts to this namespace, which are +immediately available to use in project. As such, your project can make use of the +Conjur Java API without needing to build the Jarfile locally. + +### Changes to your code base +Due to the change to the project namespace, we have modified the package name from +`net.conjur.api` to `com.cyberark.conjur.api`. As such, all import statements must be +updated to reflect this. + +### Example +Before: +```java +import net.conjur.api.AuthnProvider +``` + +After: +```java +import com.cyberark.conjur.api.AuthnProvider +``` + +### Changes to your `pom.xml` +Due to the change to the project namespace, we have modified the package name from +`net.conjur.api` to `com.cyberark.conjur.api`. As such, your dependency configuration +must be updated to reflect this. + +### Example +Before: +```xml + + net.conjur.api + conjur-api + 2.2.0 + +``` + +After: +```xml + + com.cyberark.conjur.api + conjur-api + 3.0.0 + +``` From ea18ae7e07278f9d6420681d8254ac434fc3f6f8 Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Mon, 22 Jun 2020 14:30:17 -0400 Subject: [PATCH 13/14] Update CHANGELOG and pom.xml to 3.0.0 - Added changelog information for feature changes and upgrade information - Bumped version in `pom.xml` to 3.0.0 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb3970..34f4de7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. code - README has been updated with example SSLContext setup and it's use in Conjur class constructors +- Introduced [upgrade instructions](https://github.com/cyberark/conjur-api-java/UPGRADING.md) to provide instructions for + upgrading to 3.0.0, or make use of published artifacts. These can be found in + `UPGRADING.md`. ([cyberark/conjur-api-java#77](https://github.com/cyberark/conjur-api-java/issues/77)) + +### Changed +- Revised package references from `net.conjur.api` to `com.cyberark.conjur.api` + ([cyberark/conjur-api-java#6](https://github.com/cyberark/conjur-api-java/issues/6)) ## [2.2.1] - 2020-05-08 ### Fixed From 38a9a44f78eb5b51da5b975bc3aff4402a567bda Mon Sep 17 00:00:00 2001 From: Bradley Boutcher Date: Mon, 22 Jun 2020 15:29:25 -0400 Subject: [PATCH 14/14] Bump version to 3.0.0 --- CHANGELOG.md | 5 ++++- pom.xml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34f4de7..e2d6ec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [3.0.0] - 2020-06-22 ### Fixed - Encode spaces to "%20" instead of "+". This encoding fixes an issue where Conjur variables that have spaces were not encoded correctly @@ -62,7 +64,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Authn tokens now use the new Conjur 5 format - [PR #21](https://github.com/cyberark/conjur-api-java/pull/21) - Configuration change. When using environment variables, use `CONJUR_AUTHN_LOGIN` and `CONJUR_AUTHN_API_KEY` now instead of `CONJUR_CREDENTIALS` - https://github.com/cyberark/conjur-api-java/commit/60344308fc48cb5380c626e612b91e1e720c03fb -[Unreleased]: https://github.com/cyberark/conjur-api-java/compare/v2.2.1...HEAD +[Unreleased]: https://github.com/cyberark/conjur-api-java/compare/v3.0.0...HEAD +[3.0.0]: https://github.com/cyberark/conjur-api-java/compare/v2.2.1...v3.0.0 [2.0.0]: https://github.com/cyberark/conjur-api-java/compare/v1.1.0...v2.0.0 [2.1.0]: https://github.com/cyberark/conjur-api-java/compare/v2.0.0...v2.1.0 [2.2.0]: https://github.com/cyberark/conjur-api-java/compare/v2.1.0...v2.2.0 diff --git a/pom.xml b/pom.xml index bb4d5b6..775e9f1 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ conjur-api - 2.2.1-SNAPSHOT + 3.0.0-SNAPSHOT jar Conjur