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

Running gcpviz errors #1238

Open
BachateroJ opened this issue Mar 26, 2024 · 9 comments
Open

Running gcpviz errors #1238

BachateroJ opened this issue Mar 26, 2024 · 9 comments

Comments

@BachateroJ
Copy link

Im trying to run gcpviz on my environment. ive setup everything needed.

now when i created the json, im trying to create a graph:

VirtualBox:~$ ~/go/bin/gcpviz -query-file /home/ubuntu/professional-services/tools/gcpviz/queries/network-basic.js -mode visualize -relations-file /home/ubuntu/professional-services/tools/gcpviz/relations.yaml -labels-file /home/ubuntu/professional-services/tools/gcpviz/labels.yaml -style-file /home/ubuntu/professional-services/tools/gcpviz/style.yaml

I get the following error:

██████  ██████ ██████  ██  ██ ██ ███████ 

██       ██      ██   ██ ██  ██ ██    ███  

██  ███ ██  ██████  ██  ██ ██  ███  

██  ██ ██  ██       ██  ██  ██  ███  

 ██████   ██████ ██   ████   ██ ███████

2024/03/26 17:00:58 Failed to create graph: SyntaxError: (anonymous): Line 116:16 Unexpected token ILLEGAL (and 2 more errors)

@rosmo
Copy link
Collaborator

rosmo commented Apr 7, 2024

Do other queries work?

@yiqingzhang
Copy link

Hi, I got the same error, the other queries won't help either, they all result in the same errors. I wonder if there is any updates on this.
Thanks

@yiqingzhang
Copy link

Steps to reproduce the errors:

Update the docker file to avoid failure when building

FROM golang:1.14 AS builder

WORKDIR /go/src/github.com/GoogleCloudPlatform/professional-services/tools/gcpviz
COPY go.mod go.sum *.go ./
RUN mkdir -p cmd/gcpviz
COPY cmd/gcpviz/*.go ./cmd/gcpviz/
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o $GOPATH/bin ./cmd/gcpviz

FROM google/cloud-sdk:slim

RUN apt-get update
RUN apt-get install -y graphviz

WORKDIR /gcpviz
COPY --from=builder /go/bin/gcpviz gcpviz
COPY style.yaml relations.yaml labels.yaml ./
COPY wait_for_export.sh gcpviz.sh ./
COPY redactor.py requirements.txt ./
COPY queries ./queries/
# RUN pip3 install -r requirements.txt

RUN chmod +x wait_for_export.sh gcpviz.sh redactor.py

ENV PATH "$PATH:/gcpviz"
mkdir cai
cp resource_inventory.json cai/resource_inventory.json
docker run --rm -v $PWD/cai:/gcpviz/cai gcpviz gcpviz.sh network --query-file queries/everything.js

What I got is:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

  ██████   ██████ ██████  ██    ██ ██ ███████
 ██       ██      ██   ██ ██    ██ ██    ███
 ██   ███ ██      ██████  ██    ██ ██   ███
 ██    ██ ██      ██       ██  ██  ██  ███
  ██████   ██████ ██        ████   ██ ███████

Reading assets: 1348101/1348101 bytes processed.
Creating reference aliases for assets...
Creating references between assets...
Processing resource IP addresses...
Integrating subassets as part of main assets...

Total vertexes: 1173, total edges: 1299, total aliases: 16, total IPs: 0

  ██████   ██████ ██████  ██    ██ ██ ███████
 ██       ██      ██   ██ ██    ██ ██    ███
 ██   ███ ██      ██████  ██    ██ ██   ███
 ██    ██ ██      ██       ██  ██  ██  ███
  ██████   ██████ ██        ████   ██ ███████

2024/07/15 07:18:20 Failed to create graph: SyntaxError: (anonymous): Line 32:16 Unexpected token ILLEGAL (and 2 more errors)

I have tried all the files under queries/

All of them failed with this error, except queries/shared-vpc.js and queries/one-project-example.js.
However, the successful one generated graph with a dot and nothing in it.
What I provided as input is a reasonable side input project CAI export.

@rosmo Do you have any suggestions?

Thanks

@yiqingzhang
Copy link

@rosmo I can create GCP support ticket if needed. Can you suggest how can I reach out with a GCP support ticket?

@codeangler
Copy link

@yiqingzhang if you do, please post the number here, and I'll put it on our GCP TAMs radar to push internally.

@codeangler
Copy link

@yiqingzhang @rosmo, is the Docker build error a platform problem? As I read the errors, it appears you are building on M1 / arm arch. I'm speculating that one of the dependencies is not compatible. However, to test my hypothesis, I spun up the GCE Debian instance and ran the original and then again with @yiqingzhang Dockerfile, and both failed to build.

@twigley
Copy link

twigley commented Oct 6, 2024

For anyone else it might be worth reviewing the older issue #573 as that seems to be the same issue. You have to export the organisation not a single project.

@rosmo
Copy link
Collaborator

rosmo commented Oct 7, 2024

Looks like the build process was broken due to things being updated, I create a PR with fixes.

@rosmo
Copy link
Collaborator

rosmo commented Oct 8, 2024

@codeangler The Docker build ought to be fixed now. However, you can always install the tool using go install and just avoid containers all together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants