Skip to content

Commit

Permalink
Merge 5c1f271 into 1325f0b
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcin committed Jul 7, 2019
2 parents 1325f0b + 5c1f271 commit ecc44e6
Show file tree
Hide file tree
Showing 126 changed files with 5,846 additions and 1,709 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
language: java
jdk: oraclejdk8
jdk:
- openjdk8
- openjdk11
- oraclejdk8
- oraclejdk11
dist: trusty
script:
- mvn -B verify
Expand Down
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM maven:3.6.1-jdk-8 AS build
ADD . /app
WORKDIR /app
RUN mvn clean install -pl testing,core,cli

FROM adoptopenjdk/openjdk8:alpine
COPY --from=registry.hub.docker.com/adamcin/jvshim /go/bin/jvshim /usr/bin/java
RUN mkdir -p /app/oakpal-cli
COPY --from=build /app/cli/target/oakpal-cli-*-dist.tar.gz /app
RUN tar --strip-components 1 -C /app/oakpal-cli -zxf /app/oakpal-cli-*-dist.tar.gz \
&& rm -f /app/oakpal-cli-*-dist.tar.gz

ENV JAVA_OPTS ""
ENV OAKPAL_OPEAR "."
RUN mkdir -p /work
WORKDIR /work
ENTRYPOINT ["/app/oakpal-cli/bin/oakpal.sh"]

7 changes: 6 additions & 1 deletion aem/interactive-apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>net.adamcin.oakpal</groupId>
<artifactId>oakpal-aem-parent</artifactId>
<version>1.3.1-SNAPSHOT</version>
<version>1.4.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

Expand Down Expand Up @@ -163,5 +163,10 @@
<groupId>net.adamcin.oakpal</groupId>
<artifactId>net.adamcin.oakpal.interactive</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
16 changes: 15 additions & 1 deletion aem/net.adamcin.oakpal.interactive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>net.adamcin.oakpal</groupId>
<artifactId>oakpal-aem-parent</artifactId>
<version>1.3.1-SNAPSHOT</version>
<version>1.4.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

Expand Down Expand Up @@ -81,6 +81,7 @@
net.adamcin.oakpal.interactive.models
Private-Package: net.adamcin.oakpal.interactive.impl
Sling-Model-Packages: net.adamcin.oakpal.interactive.models
Import-Package: javax.annotation;version=0.0.0
]]></bnd>
</configuration>
</execution>
Expand Down Expand Up @@ -111,6 +112,12 @@
</build>

<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.cmpn</artifactId>
Expand All @@ -122,10 +129,17 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>oakpal-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package net.adamcin.oakpal.interactive.impl;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -28,6 +29,7 @@
import net.adamcin.oakpal.core.Locator;
import net.adamcin.oakpal.core.OakMachine;
import net.adamcin.oakpal.core.ProgressCheck;
import net.adamcin.oakpal.core.ScanTempSpace;
import net.adamcin.oakpal.interactive.ChecklistTracker;
import net.adamcin.oakpal.interactive.OakpalScanInput;
import net.adamcin.oakpal.interactive.OakpalScanResult;
Expand Down Expand Up @@ -105,8 +107,8 @@ public OakpalScanResult performScan(final ResourceResolver resolver, final Oakpa
builder.withInitStages(planner.getInitStages());
builder.withProgressChecks(allChecks);

try (ScanTempSpace preInstallSpace = new ScanTempSpace(prePkgResources);
ScanTempSpace scanSpace = new ScanTempSpace(pkgResources);
try (ScanTempSpace<Resource> preInstallSpace = new ScanTempSpace<>(prePkgResources, OakpalScanServiceImpl::adaptResource, null);
ScanTempSpace<Resource> scanSpace = new ScanTempSpace<>(pkgResources, OakpalScanServiceImpl::adaptResource, null);
PlatformCndExport cndExport = new PlatformCndExport(resolver)) {

if (input.isInstallPlatformNodetypes()) {
Expand All @@ -122,6 +124,10 @@ public OakpalScanResult performScan(final ResourceResolver resolver, final Oakpa
}
}

static InputStream adaptResource(final Resource resource) {
return resource.adaptTo(InputStream.class);
}

class ScanResult implements OakpalScanResult {
private final OakpalScanInput input;
private List<CheckReport> reports;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package net.adamcin.oakpal.interactive.impl;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -33,6 +34,7 @@
import net.adamcin.oakpal.core.OakMachine;
import net.adamcin.oakpal.core.ProgressCheck;
import net.adamcin.oakpal.core.ReportMapper;
import net.adamcin.oakpal.core.ScanTempSpace;
import net.adamcin.oakpal.interactive.ChecklistTracker;
import org.apache.jackrabbit.vault.packaging.Packaging;
import org.apache.sling.api.SlingHttpServletRequest;
Expand Down Expand Up @@ -115,7 +117,8 @@ protected void doPost(final SlingHttpServletRequest request,

final OakMachine machine = builder.build();

try (ScanTempSpace tempSpace = new ScanTempSpace(pkgResources)) {
try (ScanTempSpace<Resource> tempSpace = new ScanTempSpace<>(pkgResources,
res -> res.adaptTo(InputStream.class), null)) {
List<CheckReport> reportList = machine.scanPackages(tempSpace.open());
ReportMapper.writeReports(reportList, response::getWriter);
} catch (final AbortedScanException e) {
Expand Down
16 changes: 2 additions & 14 deletions aem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<parent>
<groupId>net.adamcin.oakpal</groupId>
<artifactId>oakpal</artifactId>
<version>1.3.1-SNAPSHOT</version>
<version>1.4.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

Expand Down Expand Up @@ -89,7 +89,7 @@
<dependency>
<groupId>net.adamcin.oakpal</groupId>
<artifactId>net.adamcin.oakpal.interactive</artifactId>
<version>1.3.1-SNAPSHOT</version>
<version>1.4.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -147,18 +147,6 @@
<url>https://repo.adobe.com/nexus/content/groups/public/</url>
<layout>default</layout>
</pluginRepository>
<pluginRepository>
<id>oss-github-maven-plugins</id>
<url>https://raw.github.com/home1-oss/maven-plugins/mvn-repo</url>
<name>Forked github-maven-plugins that upload faster</name>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>

</project>
14 changes: 14 additions & 0 deletions cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# prototype dockerfile for faster iterations
FROM adoptopenjdk/openjdk8:alpine
COPY --from=registry.hub.docker.com/adamcin/jvshim /go/bin/jvshim /usr/bin/java
RUN mkdir -p /app/oakpal-cli
COPY target/oakpal-cli-*-dist.tar.gz /app
RUN tar --strip-components 1 -C /app/oakpal-cli -zxf /app/oakpal-cli-*-dist.tar.gz \
&& rm -f /app/oakpal-cli-*-dist.tar.gz

ENV JAVA_OPTS ""
ENV OAKPAL_OPEAR "."
RUN mkdir -p /work
WORKDIR /work
ENTRYPOINT ["/app/oakpal-cli/bin/oakpal.sh"]

17 changes: 17 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CLI architecture
================

* Docker-oriented: the Dockerfile will live in the root of the oakpal repo, and it will run a multi-stage build to execute maven, then extract the cli distributable.
* Multi-stage, and multi-space (base command home dir + machine workspace + scan workspace)

## Environment Variables

`OAKPAL_HOME`: defines base command directory. `${OAKPAL_HOME}/bin/oakpal` should execute the tool with standard classpath behavior of listing `${OAKPAL_HOME}/lib/*.jar`.
The contents of `OAKPAL_HOME` should be established in the base docker image. This base image should also set the `ENTRYPOINT` to properly execute the `bin/oakpal` command
with the appropriate `OAKPAL_PLAN` directory referenced

`OAKPAL_PLAN`: defines the directory where additional modules, checklists, configurations, and pre-install packages are downloaded prior to a scan. Downstream Dockerfiles
should use the base oakpal command to prepare the OAKPAL_PLAN directory using `RUN` directives.



Loading

0 comments on commit ecc44e6

Please sign in to comment.