Skip to content

Commit

Permalink
kie-issues#960: Upgrade kie-tools to Java 17, Maven 3.9.6, and Quar…
Browse files Browse the repository at this point in the history
…kus 3 (apache#2182)
  • Loading branch information
yesamer authored and paulovmr committed Mar 28, 2024
1 parent fbe1966 commit 01b1765
Show file tree
Hide file tree
Showing 65 changed files with 433 additions and 344 deletions.
27 changes: 4 additions & 23 deletions .ci/jenkins/Jenkinsfile.staging-build
Original file line number Diff line number Diff line change
Expand Up @@ -626,23 +626,25 @@ pipeline {
}
}

stage('Build (dev-deployment-base-image)') {
stage('Build (dev-deployment-base-image and dev-deployment-kogito-quarkus-blank-app-image)') {
steps {
dir('kie-tools') {
script {
buildDevDeploymentBaseImage()
buildDevDeploymentKogitoQuarkusBlankAppImage()
}
}
}
}

stage('STAGING: Push dev-deployment-base-image to quay.io') {
stage('STAGING: Push dev-deployment-base-image and dev-deployment-kogito-quarkus-blank-app-image to quay.io') {
when {
expression { !params.DRY_RUN }
}
steps {
script {
pushDevDeploymentBaseImageToQuay()
pushDevDeploymentKogitoQuarkusBlankAppImageToQuay()
}
}
}
Expand All @@ -668,27 +670,6 @@ pipeline {
}
}

stage('Build (dev-deployment-kogito-quarkus-blank-app-image)') {
steps {
dir('kie-tools') {
script {
buildDevDeploymentKogitoQuarkusBlankAppImage()
}
}
}
}

stage('STAGING: Push dev-deployment-kogito-quarkus-blank-app-image to quay.io') {
when {
expression { !params.DRY_RUN }
}
steps {
script {
pushDevDeploymentKogitoQuarkusBlankAppImageToQuay()
}
}
}

stage('Build (serverless-logic-web-tools-base-builder-image)') {
steps {
dir('kie-tools') {
Expand Down
12 changes: 6 additions & 6 deletions .ci/kie-tools-ci-build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ libxi6 \
libnss3 \
libgconf-2-4 \
libpci-dev \
openjdk-11-jdk \
openjdk-17-jdk \
git \
jq \
vim \
Expand All @@ -44,7 +44,7 @@ RUN wget -O /tmp/firefox-latest.tar.bz2 "https://download.mozilla.org/?product=f

# Install chromedriver
RUN CHROME_VERSION=$(curl https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json | jq -r .channels.Stable.version) && \
wget -O /tmp/chromedriver-linux64.zip https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$CHROME_VERSION/linux64/chromedriver-linux64.zip && \
wget -O /tmp/chromedriver-linux64.zip https://storage.googleapis.com/chrome-for-testing-public/$CHROME_VERSION/linux64/chromedriver-linux64.zip && \
unzip /tmp/chromedriver-linux64.zip -d /tmp && mv /tmp/chromedriver-linux64/chromedriver /usr/bin/ && \
rm /tmp/chromedriver-linux64.zip

Expand Down Expand Up @@ -75,9 +75,9 @@ RUN bash -c 'source $HOME/.nvm/nvm.sh && \
npm install -g [email protected]'

# Maven setup
RUN wget https://archive.apache.org/dist/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz -P /tmp && \
sudo tar xzf /tmp/apache-maven-3.8.6-bin.tar.gz -C /opt && rm /tmp/apache-maven-3.8.6-bin.tar.gz && \
sudo ln -s /opt/apache-maven-3.8.6 /opt/maven && \
RUN wget https://archive.apache.org/dist/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz -P /tmp && \
sudo tar xzf /tmp/apache-maven-3.9.6-bin.tar.gz -C /opt && rm /tmp/apache-maven-3.9.6-bin.tar.gz && \
sudo ln -s /opt/apache-maven-3.9.6 /opt/maven && \
echo 'export M2_HOME=/opt/maven' | sudo tee -a /etc/profile.d/maven.sh && \
echo 'export MAVEN_HOME=${M2_HOME}' | sudo tee -a /etc/profile.d/maven.sh && \
echo 'export PATH=${M2_HOME}/bin:${PATH}' | sudo tee -a /etc/profile.d/maven.sh && \
Expand Down Expand Up @@ -106,7 +106,7 @@ RUN wget https://get.helm.sh/helm-v3.13.3-linux-amd64.tar.gz -P /tmp && \
sudo tar -C /usr/bin/ -zxvf /tmp/helm-v3.13.3-linux-amd64.tar.gz linux-amd64/helm --strip-components 1 && rm /tmp/helm-v3.13.3-linux-amd64.tar.gz

# Env vars
ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
ENV JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
ENV DISPLAY=":99"
ENV NODE_OPTIONS="--max_old_space_size=4096"

Expand Down
6 changes: 3 additions & 3 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ runs:
with:
node-version: 18.14.0

- name: "Setup JDK 11"
- name: "Setup JDK 17"
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: "zulu"

- name: "Set up GOLANG 1.21.5"
Expand All @@ -66,7 +66,7 @@ runs:
- name: "Set up Maven"
uses: stCarolas/[email protected]
with:
maven-version: 3.8.6
maven-version: 3.9.6

- name: Setup docker (macOS only)
if: runner.os == 'macOS'
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,13 @@ jobs:
START_SERVER_AND_TEST_INSECURE: "true"
NODE_OPTIONS: "--max_old_space_size=4096"
run: >-
pnpm
-F='!@kie-tools/serverless-logic-web-tools-swf-dev-mode-image'
pnpm
-F='!@kie-tools/serverless-logic-web-tools-swf-dev-mode-image'
-F='!@kie-tools/dev-deployment-base-image'
-F='!@kie-tools/dev-deployment-kogito-quarkus-blank-app-image'
-F='!@kie-tools/dev-deployment-dmn-form-webapp-image'
-F='!@kie-tools/serverless-logic-web-tools-base-builder-image'
-F='!@kie-tools/dashbuilder-viewer-image'
-F='!@kie-tools/serverless-logic-web-tools-base-builder-image'
-F='!@kie-tools/dashbuilder-viewer-image'
-r --workspace-concurrency=1 build:prod
- name: "FULL → Build → serverless-logic-web-tools-swf-dev-mode-image"
Expand All @@ -122,7 +123,7 @@ jobs:
echo "Build @kie-tools/serverless-logic-web-tools-swf-dev-mode-image"
pnpm -F @kie-tools/serverless-logic-web-tools-swf-dev-mode-image... --workspace-concurrency=1 build:prod
- name: "FULL → Build → dev-deployment-base-image"
- name: "FULL → Build → dev-deployment-base-image and dev-deployment-kogito-quarkus-blank-app"
if: steps.setup_build_mode.outputs.mode == 'full' && runner.os == 'Linux'
env:
KIE_TOOLS_BUILD__runTests: "true"
Expand All @@ -137,7 +138,7 @@ jobs:
podman system prune --all --force
fi
echo "Build @kie-tools/dev-deployment-base-image"
pnpm -F @kie-tools/dev-deployment-base-image... --workspace-concurrency=1 build:prod
pnpm -F @kie-tools/dev-deployment-base-image... -F @kie-tools/dev-deployment-kogito-quarkus-blank-app... --workspace-concurrency=1 build:prod
- name: "FULL → Build → dev-deployment-dmn-form-webapp-image"
if: steps.setup_build_mode.outputs.mode == 'full' && runner.os == 'Linux'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ To start building the Apache KIE Tools project, you're going to need:

- Node `18` _(To install, follow these instructions: https://nodejs.org/en/download/package-manager/)_
- pnpm `8.7.0` _(To install, follow these instructions: https://pnpm.io/installation)_
- Maven `3.8.6`
- Java `11`
- Maven `3.9.6`
- Java `17`
- Go `1.21.5` _(To install, follow these instructions: https://go.dev/doc/install)_
- Helm `3.13.3` _(To install, follow these instructions: https://helm.sh/docs/intro/install/)_

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ public void testInsertTabAndContent() {
final TabPane tabContentPane = mock(TabPane.class);
final NavTabs tabBar = mock(NavTabs.class);
final TabContent tabContent = mock(TabContent.class);
final Set<TabPanelEntry> allContentTabs = spy(new HashSet<>());
final Set<Widget> activatableWidgets = spy(new HashSet<>());
final Set<TabPanelEntry> allContentTabs = mock(Set.class);
final Set<Widget> activatableWidgets = mock(Set.class);

doReturn(tabWidget).when(tab).getTabWidget();
doReturn(tabContentPane).when(tab).getContentPane();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,14 @@
-Ddashbuilder.kieserver.serverTemplate.sample-server.password=kieserver1!
-Ddashbuilder.kieserver.defaultServerTemplate=default
-Ddashbuilder.kieserver.serverTemplate.sample-server.replace_query=true
-Ddashbuilder.dev=true</extraJvmArgs>
-Ddashbuilder.dev=true
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
--add-opens java.base/java.time=ALL-UNNAMED
--add-opens java.base/java.time.format=ALL-UNNAMED
--add-opens java.base/java.text=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
</extraJvmArgs>
<style>OBFUSCATED</style>
<noServer>false</noServer>
<!-- <server>org.jboss.errai.cdi.server.gwt.EmbeddedWildFlyLauncher</server> -->
Expand Down
10 changes: 5 additions & 5 deletions packages/dashbuilder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<version.javax.validation>1.0.0.GA</version.javax.validation>

<!-- Resolved artifacts -->
<version.org.junit>4.13.1</version.org.junit>
<version.org.junit>4.13.2</version.org.junit>
<version.org.assertj>3.14.0</version.org.assertj>
<version.org.mockito>3.6.0</version.org.mockito>
<version.org.kie>7.59.0.Final</version.org.kie>
Expand All @@ -78,7 +78,7 @@
<version.io.netty>4.1.59.Final</version.io.netty>
<version.com.google.elemental2>1.1.0</version.com.google.elemental2>
<version.com.allen-sauer.gwt.dnd>3.3.3</version.com.allen-sauer.gwt.dnd>
<version.org.freemarker>2.3.30</version.org.freemarker>
<version.org.freemarker>2.3.32</version.org.freemarker>
<version.jakarta.activation-api>1.2.2</version.jakarta.activation-api>
<version.com.google.jsinterop.base>1.0.0</version.com.google.jsinterop.base>
<version.com.google.jsinterop.annotations>2.0.0</version.com.google.jsinterop.annotations>
Expand All @@ -100,10 +100,10 @@
<version.surefire.plugin>2.22.2</version.surefire.plugin>
<version.failsafe.plugin>${version.surefire.plugin}</version.failsafe.plugin>
<version.buildhelper.plugin>3.0.0</version.buildhelper.plugin>
<version.surefire.plugin>2.22.2</version.surefire.plugin>
<version.surefire.plugin>3.2.5</version.surefire.plugin>
<version.enforcer.plugin>3.0.0-M3</version.enforcer.plugin>
<version.clean.plugin>3.1.0</version.clean.plugin>
<version.compiler.plugin>3.8.1</version.compiler.plugin>
<version.compiler.plugin>3.12.1</version.compiler.plugin>
<version.resources.plugin>3.2.0</version.resources.plugin>
<version.war.plugin>3.2.3</version.war.plugin>
<version.checkstyle.plugin>3.1.1</version.checkstyle.plugin>
Expand All @@ -112,6 +112,7 @@
<version.site.plugin>3.8.2</version.site.plugin>
<version.antrun.plugin>1.8</version.antrun.plugin>
<version.exec-maven-plugin>3.0.0</version.exec-maven-plugin>
<version.org.maven.dependency.plugin>3.1.2</version.org.maven.dependency.plugin>
<checkstyle.header.extensions>java</checkstyle.header.extensions>
<checkstyle.header.template
><![CDATA[
Expand All @@ -135,7 +136,6 @@
\*\/$
]]>
</checkstyle.header.template>
<version.org.maven.dependency.plugin>3.1.2</version.org.maven.dependency.plugin>

<!-- Properties from DROOLS-WB parent POM -->
<!-- TODO: Enable these flags after fixing all checkstyle issues -->
Expand Down
13 changes: 9 additions & 4 deletions packages/dev-deployment-base-image/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,29 @@
# specific language governing permissions and limitations
# under the License.

# Defaults to registry.access.redhat.com/ubi9/openjdk-11 (check env/index.js)
# Defaults to registry.access.redhat.com/ubi9/openjdk-17 (check env/index.js)
ARG BUILDER_IMAGE_ARG

FROM --platform=linux/amd64 ${BUILDER_IMAGE_ARG}

ENV DEV_DEPLOYMENT__UPLOAD_SERVICE_EXTRACT_TO_DIR=$HOME/app
ENV DEV_DEPLOYMENT__UPLOAD_SERVICE_PORT=8080

USER 1000
RUN mkdir -p -m 777 $HOME/app && mkdir -p -m 777 /tmp/app

RUN mkdir -p -m 777 $HOME/app
COPY dist-dev/dev-deployment-upload-service /usr/local/bin

COPY --chown=1000:1000 dist-dev/dev-deployment-upload-service /usr/local/bin
USER root

RUN chgrp -R 0 $HOME/app && \
chmod -R 777 $HOME/app

WORKDIR $HOME/app/

EXPOSE 8080

USER 185

ENTRYPOINT ["/bin/bash", "-c"]

CMD ["dev-deployment-upload-service && pwd && ls -la"]
2 changes: 1 addition & 1 deletion packages/dev-deployment-base-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Docker image with Java and Maven, as well as the dev-deployment-upload-service b

## Build arguments

- `BUILDER_IMAGE_ARG`: The base image used for building this image (defaults to `registry.access.redhat.com/ubi9/openjdk-11:1.17`).
- `BUILDER_IMAGE_ARG`: The base image used for building this image (defaults to `registry.access.redhat.com/ubi9/openjdk-17:1.18`).

## Environment variables

Expand Down
2 changes: 1 addition & 1 deletion packages/dev-deployment-base-image/env/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const { varsWithName, composeEnv, getOrDefault } = require("@kie-tools-scripts/b
module.exports = composeEnv([require("@kie-tools/root-env/env")], {
vars: varsWithName({
DEV_DEPLOYMENT_BASE_IMAGE__builderImage: {
default: "registry.access.redhat.com/ubi9/openjdk-11:1.17",
default: "registry.access.redhat.com/ubi9/openjdk-17:1.18",
description: "The image used in the FROM import.",
},
DEV_DEPLOYMENT_BASE_IMAGE__registry: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ ENV ROOT_PATH=""
ENV DEV_DEPLOYMENT__UPLOAD_SERVICE_EXTRACT_TO_DIR=$HOME/app/src/main/resources
ENV DEV_DEPLOYMENT__UPLOAD_SERVICE_PORT=8080

USER 1000
COPY --chown=185:185 dist-dev/quarkus-app $HOME/app/

COPY --chown=1000:1000 --chmod=777 dist-dev/quarkus-app $HOME/app/
RUN ./mvnw dependency:go-offline -Dmaven.repo.local=/tmp/kogito/.m2/repository && ./mvnw clean package -B -ntp -Dmaven.test.skip -Dmaven.repo.local=/tmp/kogito/.m2/repository -Dquarkus.http.non-application-root-path=${ROOT_PATH}/q -Dquarkus.http.root-path=${ROOT_PATH} \
&& chgrp -R 0 $HOME/app && chmod -R g=u $HOME/app && chgrp -R 0 /tmp/kogito && chmod -R g=u /tmp/kogito

RUN ./mvnw clean package -B -ntp -Dmaven.test.skip -Dmaven.repo.local=/tmp/kogito/.m2/repository -Dquarkus.http.non-application-root-path=${ROOT_PATH}/q -Dquarkus.http.root-path=${ROOT_PATH} \
&& chmod -R 777 /tmp/kogito/ && chmod -R 777 $HOME/app
USER 185

EXPOSE 8080

ENTRYPOINT ["/bin/bash", "-c"]

CMD ["dev-deployment-upload-service && ./mvnw quarkus:dev -Ddebug=false -Dmaven.repo.local=/tmp/kogito/.m2/repository -Dquarkus.http.non-application-root-path=${ROOT_PATH}/q -Dquarkus.http.root-path=${ROOT_PATH}"]
CMD ["dev-deployment-upload-service && cp -r $HOME/app/. /tmp/app && cd /tmp/app && ./mvnw quarkus:dev -Ddebug=false -Dmaven.repo.local=/tmp/kogito/.m2/repository -Dquarkus.http.non-application-root-path=${ROOT_PATH}/q -Dquarkus.http.root-path=${ROOT_PATH}"]
10 changes: 10 additions & 0 deletions packages/dev-deployment-kogito-quarkus-blank-app-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@ These files can decisions or processes, all of them will be used as resources fo
### Optional

- `DEV_DEPLOYMENT__UPLOAD_SERVICE_ROOT_PATH`: If the Upload Service is not running in the root path of the URL, this variable should be specified. (Usually follows the same value as `ROOT_PATH`).

## Test locally

Run the image with:

- `docker run -p 8080:8080 -e DEV_DEPLOYMENT__UPLOAD_SERVICE_API_KEY=123 quay.io/kie-tools/dev-deployment-kogito-quarkus-blank-app-image:latest`

Then upload a zip file containing the resources (DMN, BPMN, etc)

- `curl -X POST -H "Content-Type: multipart/form-data" -F "myFile=@<ABSOLUTE_PATH_TO_YOUR_FILE>" http://localhost:8080/upload?apiKey=123`
50 changes: 39 additions & 11 deletions packages/dev-deployment-kogito-quarkus-blank-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,45 @@
<artifactId>dev-deployment-kogito-quarkus-blank-app</artifactId>
<version>${revision}</version>

<repositories>
<repository>
<!-- Duplicating the Maven Central repository here (as it is already coming from Super POM) makes the build much faster,
as the Maven Central is now treated as the first (default) repository (because it is before the Apache Nexus one).
Artifacts with release (fixed) versions are being downloaded primarily from there. Without the central being the
first repository the Apache Nexus would be contacted first and since it is quite slow it slows down the build.
We use Apache repo only to download our SNAPSHOTs. -->
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>apache-public-repository-group</id>
<name>Apache Public Repository Group</name>
<url>https://repository.apache.org/content/groups/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
</repositories>

<properties>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<compiler-plugin.version>3.12.1</compiler-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
<version.junit>4.13.1</version.junit>
<surefire-plugin.version>3.2.5</surefire-plugin.version>
<version.junit>4.13.2</version.junit>
</properties>

<dependencyManagement>
Expand All @@ -48,18 +78,16 @@
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-kogito-bom</artifactId>
<version>${quarkus.platform.version}</version>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-kie-bom</artifactId>
<version>${version.org.kie.kogito}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-kie-bom</artifactId>
<artifactId>kogito-quarkus</artifactId>
<version>${version.org.kie.kogito}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
Loading

0 comments on commit 01b1765

Please sign in to comment.