Skip to content

Commit

Permalink
Merge pull request #69 from jfdenise/main
Browse files Browse the repository at this point in the history
Fix NPE in WildFly Maven Plugin integration. Add WildFly Maven Plugin build and test in CI
  • Loading branch information
jfdenise authored Apr 19, 2024
2 parents 997051c + 7ef29f6 commit f8b2484
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 23 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
36 changes: 19 additions & 17 deletions core/src/main/java/org/wildfly/glow/ScanResultsPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down Expand Up @@ -190,25 +190,27 @@ private void detailed(ScanArguments arguments, ScanResults scanResults) throws E
}
}

Set<String> deployers = new TreeSet<>();
for (Layer l : scanResults.getDiscoveredLayers()) {
String deployer = configResolver.getPossibleDeployer(l);
if (deployer != null) {
deployers.add(deployer);
if (configResolver != null) {
Set<String> 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()) {
Expand Down

0 comments on commit f8b2484

Please sign in to comment.