From d33e58b23da75807cbc4bd4f09ea48c155ccdb50 Mon Sep 17 00:00:00 2001 From: Jean Francois Denise Date: Fri, 19 Apr 2024 10:49:09 +0200 Subject: [PATCH 1/2] Fix NPE when no ConfigResolver is set --- .../org/wildfly/glow/ScanResultsPrinter.java | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/core/src/main/java/org/wildfly/glow/ScanResultsPrinter.java b/core/src/main/java/org/wildfly/glow/ScanResultsPrinter.java index da4bb33e..96e80bde 100644 --- a/core/src/main/java/org/wildfly/glow/ScanResultsPrinter.java +++ b/core/src/main/java/org/wildfly/glow/ScanResultsPrinter.java @@ -158,7 +158,7 @@ private void detailed(ScanArguments arguments, ScanResults scanResults) throws E if (!error.getPossibleAddons().isEmpty()) { errorBuilder.append(" To correct this error, enable one of the following add-ons:\n"); for (AddOn addOn : error.getPossibleAddons()) { - String deployer = configResolver.getPossibleDeployer(addOn.getLayers()); + String deployer = configResolver == null ? null : configResolver.getPossibleDeployer(addOn.getLayers()); errorBuilder.append(" - ").append(addOn.getName()).append((deployer == null ? "" : " (supported by "+deployer+" deployer)")).append("\n"); } } @@ -190,25 +190,27 @@ private void detailed(ScanArguments arguments, ScanResults scanResults) throws E } } - Set deployers = new TreeSet<>(); - for (Layer l : scanResults.getDiscoveredLayers()) { - String deployer = configResolver.getPossibleDeployer(l); - if (deployer != null) { - deployers.add(deployer); + if (configResolver != null) { + Set deployers = new TreeSet<>(); + for (Layer l : scanResults.getDiscoveredLayers()) { + String deployer = configResolver.getPossibleDeployer(l); + if (deployer != null) { + deployers.add(deployer); + } } - } - for (Layer l : scanResults.getMetadataOnlyLayers()) { - String deployer = configResolver.getPossibleDeployer(l); - if (deployer != null) { - deployers.add(deployer); + for (Layer l : scanResults.getMetadataOnlyLayers()) { + String deployer = configResolver.getPossibleDeployer(l); + if (deployer != null) { + deployers.add(deployer); + } } - } - if (!deployers.isEmpty()) { - writer.info("deployers that would get automatically enabled when deploying to openshift"); - for (String deployer : deployers) { - writer.info("- " + deployer); + if (!deployers.isEmpty()) { + writer.info("deployers that would get automatically enabled when deploying to openshift"); + for (String deployer : deployers) { + writer.info("- " + deployer); + } + writer.info(""); } - writer.info(""); } if (!scanResults.getSuggestions().getStronglySuggestedConfigurations().isEmpty()) { From 7ef29f6f2f9f1fb1b744ee4f4cfbfa39463bb120 Mon Sep 17 00:00:00 2001 From: Jean Francois Denise Date: Fri, 19 Apr 2024 10:59:11 +0200 Subject: [PATCH 2/2] Add WildFly Maven Plugin build/test to CI --- .github/workflows/ci.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05b8844b..26adcd50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,22 +22,36 @@ jobs: java: ['21', '17', '11'] steps: + - uses: actions/checkout@v3 + with: + path: wildfly-glow - uses: actions/checkout@v2 - - uses: actions/cache@v1 with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- + repository: wildfly/wildfly-maven-plugin + path: wildfly-maven-plugin - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: ${{ matrix.java }} + cache: 'maven' + distribution: 'temurin' - name: Build and Test on ${{ matrix.java }} run: mvn clean install + shell: bash + working-directory: wildfly-glow - name: Run cli tests using bash run: bash tests/run-cli-tests.sh shell: bash + working-directory: wildfly-glow + - name: Retrieve WildFly Glow version + run: | + echo "WILDFLY_GLOW_VERSION=$(mvn -B help:evaluate -Dexpression=project.version -DforceStdout -q)" >> $GITHUB_ENV + shell: bash + working-directory: wildfly-glow + - name: Build and Test WildFly Maven Plugin on ${{ matrix.java }} + run: mvn clean install -Dversion.org.wildfly.glow=${{ env.WILDFLY_GLOW_VERSION }} + shell: bash + working-directory: wildfly-maven-plugin - uses: actions/upload-artifact@v2 if: failure() with: