Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…er-lsp into patch
  • Loading branch information
Vickysomtee committed May 5, 2024
2 parents e100d4a + 3cc65e2 commit a4b30e1
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 18 deletions.
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ we must start the provider before running the analyzer.

```shell
podman run -it --rm -P -u 1000:1000 \
-v $PWD/external-providers/dotnet-external-provider/examples/:$PWD/external-providers/dotnet-external-provider/examples/ \
-v $PWD/external-providers/dotnet-external-provider/examples/:$PWD/external-providers/dotnet-external-provider/examples/:z \
quay.io/konveyor/dotnet-external-provider:latest
```

**NOTE** Using the exact same path inside the container and host is our way of
simulating a shared filesystem between the analyzer and provider.
**NOTEs**
* Using the exact same path inside the container and host is our way of
simulating a shared filesystem between the analyzer and provider.
* `:z` is necessary on hosts with labeling systems like SELinux that require
proper labels be placed on volume content mounted into a container. See
[podman documentation](https://docs.podman.io/en/latest/markdown/podman-run.1.html)
for more information (specifically under "Labeling Volume Mounts").

Verify provider is running and take note of open ports:

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

0 comments on commit a4b30e1

Please sign in to comment.