Skip to content

Commit

Permalink
[jgitflow-maven-plugin] merging 'release/1.2.0' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Apr 4, 2019
2 parents cd0ef72 + 8fa83b5 commit a90ba72
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 55 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pom.xml.versionsBackup
pom.xml.next
release.properties
maven-eclipse.xml
infinitest.filters

node_modules/
npm-debug.log
Expand All @@ -17,10 +18,12 @@ npm-debug.log
.pmd
.checkstyle
.idea
.iml
.vagrant
*.iml
.DS_Store
.rubygems
.sass-cache
.rubygems-gem-maven-plugin
*.sublime-*
*nbactions*.xml
.temp/
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ language: java

jdk:
- oraclejdk8
- openjdk11

# Make sure travis can use container-based infrastructure
sudo: false

install: "mvn -s ./.travis.maven-settings.xml clean"

script:
- "mvn -s ./.travis.maven-settings.xml -Pcontinuous-integration -U -Dmaven.javadoc.skip=true install"
- "mvn -s ./.travis.maven-settings.xml -Pcontinuous-integration -U install"
# Remove wcm.io artefacts from repository before cache
- rm -rf $HOME/.m2/repository/io/wcm

# exlude release tags like xyz-1.0.0 or xyz-1
# exlude release tags like 1.0.0
branches:
except:
- /^.*\-\d+(\.\d+\.\d+)?(\..*|\-.*)?$/
- /^\d+(\.\d+\.\d+)?(\..*|\-.*)?$/

# Cache Maven Repository
cache:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ Steps to build and start the proxy:
---

A public instance of this proxy is available at: https://maven-nodejs-proxy.pvtool.org/

A Ansible role for this proxy is available at:
https://github.com/wcm-io-devops/ansible-maven-nodejs-proxy
9 changes: 9 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="1.2.0" date="2019-04-05">
<action type="add" dev="sseifert">
Add support for downloading Windows NodeJS binaries as ZIP including NPM which is available since Node 6.3.0.
</action>
<action type="update" dev="sseifert">
Update to dropwizard 1.3.9.
</action>
</release>

<release version="1.1.0" date="2016-03-22">
<action type="update" dev="sseifert" issue="WDEVOP-1">
Binary File Structre changed in NPM Versions > 0.x and support for SHA-256 checksums.
Expand Down
2 changes: 1 addition & 1 deletion maven-nodejs-proxy/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ npmBinariesUrl: "/npm/npm-${version}.${type}"
nodeJsChecksumUrl: "/v${version}/SHASUMS256.txt"

# Sample versions for index page
nodeJsSampleVersion: 4.4.0
nodeJsSampleVersion: 10.15.0
npmSampleVersion: 1.4.9

# HTTP Client settings
Expand Down
20 changes: 10 additions & 10 deletions maven-nodejs-proxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@
<parent>
<groupId>io.wcm.devops</groupId>
<artifactId>io.wcm.devops.parent_toplevel</artifactId>
<version>1.0.2</version>
<version>1.1.2</version>
<relativePath />
</parent>

<groupId>io.wcm.devops.maven</groupId>
<artifactId>io.wcm.devops.maven.nodejs-proxy</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
<packaging>jar</packaging>

<name>Maven NodeJS Proxy</name>
<description>Maven proxy to download NodeJS binaries as Maven artifacts.</description>

<properties>
<dropwizard.version>0.9.2</dropwizard.version>
<dropwizard.version>1.3.9</dropwizard.version>
</properties>

<dependencies>
Expand All @@ -61,18 +61,18 @@
<version>${dropwizard.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<version>2.6</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
<version>1.12</version>
<scope>compile</scope>
</dependency>

Expand All @@ -84,10 +84,10 @@
</dependency>

</dependencies>

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down Expand Up @@ -120,8 +120,8 @@
</configuration>
</execution>
</executions>
</plugin>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ public final class IndexPageBuilder {

private static final String[] EXAMPLE_URLS = new String[] {
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}.pom",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-windows-x86.exe",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-windows-x64.exe",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-linux-x86.tar.gz",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-win-x86.zip",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-win-x64.zip",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-linux-x64.tar.gz",
"${groupIdPath}/${nodeJsArtifactId}/${nodeJsSampleVersion}/${nodeJsArtifactId}-${nodeJsSampleVersion}-darwin-x64.tar.gz",
"${groupIdPath}/${npmArtifactId}/${npmSampleVersion}/${npmArtifactId}-${npmSampleVersion}.pom",
Expand All @@ -56,34 +55,33 @@ public static String build(MavenProxyConfiguration config) {
url = StringUtils.replace(url, "${nodeJsSampleVersion}", config.getNodeJsSampleVersion());
url = StringUtils.replace(url, "${npmSampleVersion}", config.getNpmSampleVersion());
exampleUrlsMarkup.append("<li><a href=\"").append(url).append("\">").append(url).append("</a></li>");

}

String serviceVersion = IndexPageBuilder.class.getPackage().getImplementationVersion();

return "<!DOCTYPE html>\n<html>"
+ "<head>"
+ "<title>Maven NodeJS Proxy</title>"
+ "<style>body { font-family: sans-serif; }</style>"
+ "</head>"
+ "<body>"
+ "<h1>Maven NodeJS Proxy</h1>"
+ "<p>This is a Maven Artifact Proxy for NodeJS binaries located at: "
+ "<a href=\"" + config.getNodeJsBinariesRootUrl() + "\">" + config.getNodeJsBinariesRootUrl() + "</a></p>"
+ "<p>Every call to this repository is routed directly to this URL.</p>"
+ "<p><strong>Please never use this Maven repository directly in your maven builds, but only via an Repository Manager "
+ "which caches the resolved artifacts.</strong></p>"
+ "<p>If you want to setup your own proxy get the source code: "
+ "<a href=\"https://github.com/wcm-io-devops/maven-nodejs-proxy\">https://github.com/wcm-io-devops/maven-nodejs-proxy</a></p>"
+ "<hr/>"
+ "<p>Examples:</p>"
+ "<ul>"
+ exampleUrlsMarkup
+ "</ul>"
+ "<p>For all files SHA1 checksums are supported (.sha1 suffix). MD5 checksums are not supported.</p>"
+ (serviceVersion != null ? "<hr/><p>Version " + IndexPageBuilder.class.getPackage().getImplementationVersion() + ".</p>" : "")
+ "</body>"
+ "</html>";
+ "<head>"
+ "<title>Maven NodeJS Proxy</title>"
+ "<style>body { font-family: sans-serif; }</style>"
+ "</head>"
+ "<body>"
+ "<h1>Maven NodeJS Proxy</h1>"
+ "<p>This is a Maven Artifact Proxy for NodeJS binaries located at: "
+ "<a href=\"" + config.getNodeJsBinariesRootUrl() + "\">" + config.getNodeJsBinariesRootUrl() + "</a></p>"
+ "<p>Every call to this Maven repository is routed directly to the NodeJS distribution server.</p>"
+ "<p><strong>Please never use this Maven repository directly in your maven builds, use it only via a Repository Manager "
+ "which caches the resolved artifacts.</strong></p>"
+ "<p>If you want to setup your own proxy get the source code: "
+ "<a href=\"https://github.com/wcm-io-devops/maven-nodejs-proxy\">https://github.com/wcm-io-devops/maven-nodejs-proxy</a></p>"
+ "<hr/>"
+ "<p>Example artifacts:</p>"
+ "<ul>"
+ exampleUrlsMarkup
+ "</ul>"
+ "<p>For all files SHA1 checksums are supported (.sha1 suffix). MD5 checksums are not supported.</p>"
+ (serviceVersion != null ? "<hr/><p>Version " + IndexPageBuilder.class.getPackage().getImplementationVersion() + "</p>" : "")
+ "</body>"
+ "</html>";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public Response getBinary(
}

String url = buildBinaryUrl(artifactType, version, null, null, StringUtils.removeEnd(type, ".sha1"));
return getBinary(url, version, getChecksum, null);
return getBinary(url, getChecksum, null);
}

private Response getBinaryWithChecksumValidation(String url, String version, boolean getChecksum) throws IOException {
Expand All @@ -222,10 +222,10 @@ private Response getBinaryWithChecksumValidation(String url, String version, boo
return Response.status(Response.Status.NOT_FOUND).build();
}

return getBinary(url, version, getChecksum, checksum);
return getBinary(url, getChecksum, checksum);
}

private Response getBinary(String url, String version, boolean getChecksum, String expectedChecksum) throws IOException {
private Response getBinary(String url, boolean getChecksum, String expectedChecksum) throws IOException {
log.info("Proxy file: {}", url);
HttpGet get = new HttpGet(url);
HttpResponse response = httpClient.execute(get);
Expand Down Expand Up @@ -335,7 +335,7 @@ private String buildBinaryUrl(ArtifactType artifactType, String version, String
String url;
switch (artifactType) {
case NODEJS:
if (StringUtils.equals(os, "windows")) {
if (StringUtils.equals(os, "windows") && StringUtils.equals(type, "exe")) {
if (isVersion4Up(version)) {
url = config.getNodeJsBinariesUrlWindows();
}
Expand All @@ -358,7 +358,7 @@ else if (StringUtils.equals(arch, "x86")) {
}
url = config.getNodeJsBinariesRootUrl() + url;
url = StringUtils.replace(url, "${version}", StringUtils.defaultString(version));
url = StringUtils.replace(url, "${os}", StringUtils.defaultString(os));
url = StringUtils.replace(url, "${os}", StringUtils.defaultString(StringUtils.replace(os, "windows", "win")));
url = StringUtils.replace(url, "${arch}", StringUtils.defaultString(arch));
url = StringUtils.replace(url, "${type}", StringUtils.defaultString(type));
return url;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,20 @@

import io.dropwizard.testing.junit.ResourceTestRule;


public class MavenProxyResourceTest {

// test with the following NodeJS and NPM versions
private static final String[] NODEJS_VERSIONS = {
"0.12.0",
"4.4.0"
"6.3.0",
"10.15.0"
};
private static final String[] NODEJS_TARGETS = {
"-windows-x86.zip",
"-windows-x64.zip",
"-win-x86.zip",
"-win-x64.zip",
"-windows-x86.exe",
"-windows-x64.exe",
"-linux-x86.tar.gz",
"-linux-x64.tar.gz",
"-darwin-x64.tar.gz"
};
Expand All @@ -60,8 +62,8 @@ public class MavenProxyResourceTest {

@Rule
public ResourceTestRule context = new ResourceTestRule.Builder()
.addResource(new MavenProxyResource(TestContext.getConfiguration(), TestContext.getHttpClient()))
.build();
.addResource(new MavenProxyResource(TestContext.getConfiguration(), TestContext.getHttpClient()))
.build();

@Test
public void testGetIndex() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import io.dropwizard.configuration.ConfigurationException;
import io.dropwizard.configuration.ConfigurationFactory;
import io.dropwizard.configuration.YamlConfigurationFactory;
import io.dropwizard.jackson.Jackson;
import io.wcm.devops.maven.nodejsproxy.MavenProxyConfiguration;

Expand All @@ -41,7 +42,7 @@ private TestContext() {
}

static MavenProxyConfiguration getConfiguration() {
ConfigurationFactory factory = new ConfigurationFactory<MavenProxyConfiguration>(
ConfigurationFactory factory = new YamlConfigurationFactory<MavenProxyConfiguration>(
MavenProxyConfiguration.class, null, OBJECT_MAPPER, "override");
try {
File configFile = new File("config.yml");
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<parent>
<groupId>io.wcm.devops</groupId>
<artifactId>io.wcm.devops.parent_toplevel</artifactId>
<version>1.0.2</version>
<version>1.1.2</version>
<relativePath />
</parent>

<groupId>io.wcm.devops.maven</groupId>
<artifactId>io.wcm.devops.maven.nodejs-proxy.root</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
<packaging>pom</packaging>

<name>Maven NodeJS Proxy Root</name>
Expand Down

0 comments on commit a90ba72

Please sign in to comment.