diff --git a/.github/workflows/demo-testing.yml b/.github/workflows/demo-testing.yml
index e70330ca..991364fa 100644
--- a/.github/workflows/demo-testing.yml
+++ b/.github/workflows/demo-testing.yml
@@ -13,25 +13,49 @@ jobs:
env:
PULL_REQUEST_BODY: ${{ github.event.pull_request.body }}
run: |
+ echo "BUILD_BUNDLE=false" >> $GITHUB_OUTPUT
# if this is a PR, we should use the base branch
# else, use the branch on which this is running
if [ ! -z ${GITHUB_BASE_REF} ]; then
echo "Using ${GITHUB_BASE_REF}"
echo "API_TESTS_REF=${GITHUB_BASE_REF}" >> $GITHUB_OUTPUT
echo "ADDON_REF=${GITHUB_BASE_REF}" >>$GITHUB_ENV
+ echo "JAVA_BUNDLE_REF=${GITHUB_BASE_REF}" >>$GITHUB_OUTPUT
else
echo "Using ${GITHUB_REF_NAME}"
echo "API_TESTS_REF=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "ADDON_REF=${GITHUB_REF_NAME}" >>$GITHUB_ENV
+ echo "JAVA_BUNDLE_REF=${GITHUB_REF_NAME}" >>$GITHUB_OUTPUT
fi
# override with explicitely set value in PR description
echo "${PULL_REQUEST_BODY}"
- PULL_REQUEST_NUMBER=$(echo "${PULL_REQUEST_BODY}" | grep -oP '[A|a]ddon [P|p][R|r]: \K\d+' || true)
- if [ ! -z "$PULL_REQUEST_NUMBER" ]; then
- echo "Using pull/${PULL_REQUEST_NUMBER} for addon"
- echo "ADDON_REF=refs/pull/$PULL_REQUEST_NUMBER/merge" >>$GITHUB_ENV
- fi
+ ADDON_PULL_REQUEST_NUMBER=$(echo "${PULL_REQUEST_BODY}" | grep -oP '[A|a]ddon [P|p][R|r]: \K\d+' || true)
+ if [ ! -z "$ADDON_PULL_REQUEST_NUMBER" ]; then
+ echo "Using pull/${ADDON_PULL_REQUEST_NUMBER} for addon"
+ echo "ADDON_REF=refs/pull/$ADDON_PULL_REQUEST_NUMBER/merge" >>$GITHUB_ENV
+ fi
+
+ JAVA_BUNDLE_PR_NUMBER=$(echo "${PULL_REQUEST_BODY}" | grep -oP '[B|b]undle [P|p][R|r]: \K\d+' || true)
+ if [ ! -z "$JAVA_BUNDLE_PR_NUMBER" ]; then
+ echo "Using bundle PR pull/${JAVA_BUNDLE_PR_NUMBER}"
+ echo "JAVA_BUNDLE_REF=refs/pull/$JAVA_BUNDLE_PR_NUMBER/merge" >> $GITHUB_OUTPUT
+ echo "BUILD_BUNDLE=true" >>$GITHUB_OUTPUT
+ fi
+
+ - uses: actions/checkout@v3
+ if: steps.extract-info.outputs.BUILD_BUNDLE
+ with:
+ fetch-depth: 0
+ repository: konveyor/java-analyzer-bundle
+ ref: "${{ env.JAVA_BUNDLE_REF }}"
+ path: java-analyzer-bundle
+
+ - name: build java analyzer bundle image
+ if: steps.extract-info.outputs.BUILD_BUNDLE
+ working-directory: java-analyzer-bundle
+ run: |
+ podman build -t quay.io/konveyor/jdtls-server-base:latest -f Dockerfile .
- uses: actions/checkout@v3
@@ -64,7 +88,7 @@ jobs:
with:
fetch-depth: 0
repository: konveyor/tackle2-addon-analyzer
- ref: "${{ env.ADDON_REF}}"
+ ref: "${{ env.ADDON_REF }}"
path: tackle2-addon-analyzer
- name: Build addon and save image
diff --git a/demo-output.yaml b/demo-output.yaml
index 89590cb7..03f1508f 100644
--- a/demo-output.yaml
+++ b/demo-output.yaml
@@ -6,6 +6,58 @@
- Language=Golang
- License=Apache
violations:
+ builtin-inclusion-test-json:
+ description: |
+ This is same as java-io-file-usage but for the builtin providers. There are multiple instances of the same incidents in different directories.
+ We are filtering some out using includedPaths setting.
+ category: optional
+ incidents:
+ - uri: file:///examples/builtin/inclusion_tests/dir-0/inclusion-test.json
+ message: Only incidents in dir-0/inclusion-test.json should be found
+ - uri: file:///examples/builtin/inclusion_tests/dir-0/inclusion-test.json
+ message: Only incidents in dir-0/inclusion-test.json should be found
+ codeSnip: |2
+ 1 {
+ 2 "description": "Does your JSON search work?",
+ 3 "name": "test-your-json-search",
+ 4 "inclusionTestNode": "Test this node"
+ 5 }
+ lineNumber: 4
+ variables:
+ data: inclusionTestNode
+ matchingJSON: Test this node
+ - uri: file:///examples/builtin/inclusion_tests/dir-0/inclusion-test.xml
+ message: Only incidents in dir-0/inclusion-test.json should be found
+ codeSnip: |2
+ 1
+ 2 Does your XML search work?
+ 3 xml-search
+ 4 Test this node
+ 5
+ lineNumber: 4
+ variables:
+ matchingText: inclusionTestNode
+ builtin-inclusion-test-xml:
+ description: |
+ This is same as java-io-file-usage but for the builtin providers. There are multiple instances of the same incidents in different directories.
+ We are filtering some out using includedPaths setting.
+ category: optional
+ incidents:
+ - uri: file:///examples/builtin/inclusion_tests/dir-0/inclusion-test.xml
+ message: Only incidents in dir-0/inclusion-test.xml should be found
+ - uri: file:///examples/builtin/inclusion_tests/dir-0/inclusion-test.xml
+ message: Only incidents in dir-0/inclusion-test.xml should be found
+ codeSnip: |2
+ 1
+ 2 Does your XML search work?
+ 3 xml-search
+ 4 Test this node
+ 5
+ lineNumber: 4
+ variables:
+ data: inclusionTestNode
+ innerText: Test this node
+ matchingXML: Test this node
chain-pom-001:
description: ""
category: potential
@@ -520,6 +572,15 @@
kind: Class
name: Singleton
package: com.example.apps
+ - uri: file:///examples/java/example/src/main/java/com/example/apps/Bean.java
+ message: condition entries should evaluate out of order
+ codeSnip: " 1 package com.example.apps;\n 2 \n 3 import javax.ejb.SessionBean;\n 4 import javax.ejb.Singleton;\n 5 \n 6 @Singleton\n 7 public abstract class Bean implements SessionBean {\n 8 \n 9 }\n"
+ lineNumber: 7
+ variables:
+ file: file:///examples/java/example/src/main/java/com/example/apps/Bean.java
+ kind: Class
+ name: Bean
+ package: com.example.apps
singleton-sessionbean-00002:
description: ""
category: potential
@@ -533,6 +594,15 @@
kind: Class
name: Singleton
package: com.example.apps
+ - uri: file:///examples/java/example/src/main/java/com/example/apps/Bean.java
+ message: condition entries should evaluate in order
+ codeSnip: " 1 package com.example.apps;\n 2 \n 3 import javax.ejb.SessionBean;\n 4 import javax.ejb.Singleton;\n 5 \n 6 @Singleton\n 7 public abstract class Bean implements SessionBean {\n 8 \n 9 }\n"
+ lineNumber: 7
+ variables:
+ file: file:///examples/java/example/src/main/java/com/example/apps/Bean.java
+ kind: Class
+ name: Bean
+ package: com.example.apps
tech-tag-001:
description: ""
category: potential
@@ -808,8 +878,6 @@
unable to get query info: yaml: unmarshal errors:
line 9: cannot unmarshal !!map into string
unmatched:
- - builtin-inclusion-test-json
- - builtin-inclusion-test-xml
- file-002
- lang-ref-002
- python-sample-rule-003
diff --git a/provider/internal/builtin/service_client.go b/provider/internal/builtin/service_client.go
index 18c3c56f..1c58bbc6 100644
--- a/provider/internal/builtin/service_client.go
+++ b/provider/internal/builtin/service_client.go
@@ -459,8 +459,7 @@ func queryXMLFile(filePath string, query *xpath.Expr) (nodes []*xmlquery.Node, e
return nodes, err
}
-// filterByIncludedPaths given a list of file paths,
-// filters-out the ones not present in includedPaths
+// isFileIncluded given a path, returns whether the path is included in the includedPaths provider config
func (b *builtinServiceClient) isFileIncluded(absolutePath string) bool {
if b.includedPaths == nil || len(b.includedPaths) == 0 {
return true
diff --git a/rule-example.yaml b/rule-example.yaml
index 4d614909..0c8cf835 100644
--- a/rule-example.yaml
+++ b/rule-example.yaml
@@ -267,7 +267,7 @@
description: |
This is same as java-io-file-usage but for the builtin providers. There are multiple instances of the same incidents in different directories.
We are filtering some out using includedPaths setting.
- message: Only incidents in dir-0/test.json should be found
+ message: Only incidents in dir-0/inclusion-test.json should be found
ruleID: builtin-inclusion-test-json
when:
and:
@@ -281,7 +281,7 @@
description: |
This is same as java-io-file-usage but for the builtin providers. There are multiple instances of the same incidents in different directories.
We are filtering some out using includedPaths setting.
- message: Only incidents in dir-0/test.xml should be found
+ message: Only incidents in dir-0/inclusion-test.xml should be found
ruleID: builtin-inclusion-test-xml
when:
and: