Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix a panic when dep resolver returns nil #595

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/demo-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
make run-external-providers-pod
podman build -f demo-local.Dockerfile -t localhost/testing:latest
make run-demo-image

- name: install yq for testing
run: go install github.com/mikefarah/yq/v4@latest

Expand Down
32 changes: 19 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
DOCKER_IMAGE = test
OS := $(shell uname -s)
ifeq ($(OS),Linux)
MOUNT_OPT := :z
else
MOUNT_OPT :=
endif

build: analyzer deps golang-dependency-provider external-generic yq-external-provider java-external-provider

Expand Down Expand Up @@ -42,11 +48,11 @@ build-yq-provider:
podman build -f external-providers/yq-external-provider/Dockerfile -t yq-provider .

run-external-providers-local:
podman run --name java-provider -d -p 14651:14651 -v $(PWD)/external-providers/java-external-provider/examples:/examples java-provider --port 14651
podman run --name yq -d -p 14652:14652 -v $(PWD)/examples:/examples yq-provider --port 14652
podman run --name golang-provider -d -p 14653:14653 -v $(PWD)/examples:/examples generic-provider --port 14653
podman run --name nodejs -d -p 14654:14654 -v $(PWD)/examples:/examples generic-provider --port 14654 --name nodejs
podman run --name python -d -p 14655:14655 -v $(PWD)/examples:/examples generic-provider --port 14655 --name pylsp
podman run --name java-provider -d -p 14651:14651 -v $(PWD)/external-providers/java-external-provider/examples:/examples$(MOUNT_OPT) java-provider --port 14651
podman run --name yq -d -p 14652:14652 -v $(PWD)/examples:/examples yq-provider$(MOUNT_OPT) --port 14652
podman run --name golang-provider -d -p 14653:14653 -v $(PWD)/examples:/examples$(MOUNT_OPT) generic-provider --port 14653
podman run --name nodejs -d -p 14654:14654 -v $(PWD)/examples:/examples$(MOUNT_OPT) generic-provider --port 14654 --name nodejs
podman run --name python -d -p 14655:14655 -v $(PWD)/examples:/examples$(MOUNT_OPT) generic-provider --port 14655 --name pylsp

stop-external-providers:
podman kill java-provider || true
Expand All @@ -64,19 +70,19 @@ stop-external-providers:
run-external-providers-pod:
podman volume create test-data
# copy data to test data volume
podman run --rm -v test-data:/target -v $(PWD)/examples:/src/ --entrypoint=cp alpine -a /src/. /target/
podman run --rm -v test-data:/target -v $(PWD)/external-providers/java-external-provider/examples:/src/ --entrypoint=cp alpine -a /src/. /target/
podman run --rm -v test-data:/target$(MOUNT_OPT) -v $(PWD)/examples:/src/$(MOUNT_OPT) --entrypoint=cp alpine -a /src/. /target/
podman run --rm -v test-data:/target$(MOUNT_OPT) -v $(PWD)/external-providers/java-external-provider/examples:/src/$(MOUNT_OPT) --entrypoint=cp alpine -a /src/. /target/
# run pods w/ defined ports for the test volumes
podman pod create --name=analyzer
podman run --pod analyzer --name java-provider -d -v test-data:/analyzer-lsp/examples java-provider --port 14651
podman run --pod analyzer --name yq -d -v test-data:/analyzer-lsp/examples yq-provider --port 14652
podman run --pod analyzer --name golang-provider -d -v test-data:/analyzer-lsp/examples generic-provider --port 14653
podman run --pod analyzer --name nodejs -d -v test-data:/analyzer-lsp/examples generic-provider --port 14654 --name nodejs
podman run --pod analyzer --name python -d -v test-data:/analyzer-lsp/examples generic-provider --port 14655 --name pylsp
podman run --pod analyzer --name java-provider -d -v test-data:/analyzer-lsp/examples$(MOUNT_OPT) java-provider --port 14651
podman run --pod analyzer --name yq -d -v test-data:/analyzer-lsp/examples$(MOUNT_OPT) yq-provider --port 14652
podman run --pod analyzer --name golang-provider -d -v test-data:/analyzer-lsp/examples$(MOUNT_OPT) generic-provider --port 14653
podman run --pod analyzer --name nodejs -d -v test-data:/analyzer-lsp/examples$(MOUNT_OPT) generic-provider --port 14654 --name nodejs
podman run --pod analyzer --name python -d -v test-data:/analyzer-lsp/examples$(MOUNT_OPT) generic-provider --port 14655 --name pylsp
podman build -f demo-local.Dockerfile -t localhost/testing:latest

run-demo-image:
podman run --entrypoint /usr/local/bin/konveyor-analyzer --pod=analyzer -v $(PWD)/demo-dep-output.yaml:/analyzer-lsp/demo-dep-output.yaml:Z -v $(PWD)/demo-output.yaml:/analyzer-lsp/output.yaml:Z localhost/testing:latest --dep-output-file=demo-dep-output.yaml
podman run --entrypoint /usr/local/bin/konveyor-analyzer --pod=analyzer -v $(PWD)/demo-dep-output.yaml:/analyzer-lsp/demo-dep-output.yaml:Z -v $(PWD)/demo-output.yaml:/analyzer-lsp/output.yaml:Z localhost/testing:latest --output-file=/analyzer-lsp/output.yaml --dep-output-file=/analyzer-lsp/demo-dep-output.yaml

stop-external-providers-pod: stop-external-providers
podman pod kill analyzer
Expand Down
5 changes: 5 additions & 0 deletions demo-dep-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@
labels:
- konveyor.io/dep-source=downloadable
- konveyor.io/language=go
- name: go
version: "1.18"
labels:
- konveyor.io/dep-source=downloadable
- konveyor.io/language=go
- name: go.etcd.io/etcd/client/pkg/v3
version: v3.5.1
labels:
Expand Down
2 changes: 1 addition & 1 deletion provider/grpc/dependency_resolver_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (d *dependencyLocationResolverClient) GetLocation(ctx context.Context, dep
},
DepFile: depFile,
})
if res.Location == nil {
if res == nil || res.Location == nil {
return engine.Location{}, nil
}
loc := engine.Location{}
Expand Down
Loading