This message was deleted.
# general
b
This message was deleted.
c
Hi Aléxis, currently the dashboard reads the PR and repo information from the JSON file and it doesn’t take into account the arguments passed to the comment command (but I agree that would make sense). I believe the breakdown/diff commands look for that info in environment variables and populate it into the json from there. Let me look at the code to see if I can get you more details.
Well, this is not perfect but if you set
INFRACOST_VCS_REPOSITORY_URL
and
INFRACOST_VCS_PULL_REQUEST_URL
while generating the breakdown I can get it to show up in the list BUT that only works if it is not a directory that has been checked out from git (if the CLI detects the git directory, it ignores those env variables 😞). Further, the PR name in the dashboard shows up as empty and there isn’t a way to set that manually.
Do you mind submitting a github issue about this? I will do if you don’t want to but it may be better to get the specifics of your case in there.
f
Hi Tim. Thanks for answering me. I'm going to create the issue and I will try to set those variables in my automation to see if I can see the dashboard PR graph.
I still cannot see the dots graph in the dashboard. I'm doing this in my Jenkins automaition:
Copy code
"curl -fsSL <https://raw.githubusercontent.com/infracost/infracost/master/scripts/install.sh> | sh || true && " +
"infracost --version && " +
"INFRACOST_VCS_REPOSITORY_URL=${ghRepo} INFRACOST_VCS_PULL_REQUEST_URL=${prURL} INFRACOST_ENABLE_CLOUD=true infracost diff --format json --path ${tfPlan} --project-name ${goEnvironment}${projectName}"
c
What version of the infracost CLI are you using?
f
Infracost v0.10.10
But I can see the projects:
c
Do you see the “vcsRepoUrl” and “vcsPullRequestUrl” populated in the top-level “metadata” key in the generated json?
f
Hmmm.. let me I make some changes to see the json file content in the automation.
I've started the automation. In few minutes we'll have the results.
👍 1
I can see the vcsRepoUrl but I cant see the vcsPullRequestUrl:
c
Ok, it must be a running in a directory that’s checked out from git, so it’s picking up the repo from git, but it unfortunately ignores the env variables in that case.
f
Is there a workaround for it?
c
yeah, sorry I was just looking at the code. So probably the cleanest thing to do is to set those keys in the json manually, after running diff but before running comment.
That would be the best because then in addition to “vcsPullRequestUrl” and “vcsPullRequestId” you can also set the “vcsPullRequestTitle” and “vcsPullRequestAuthor” keys (if you have them available to the ci)
Do you have something like
jq
available in the environment?
f
I'm not running the comment command, because I built a custom comment in gh which is populated by the automation. For this reason, I suggested that the github api key argument should be optional, but the PR data should be sent to infracost directly.
Do you have something like
jq
available in the environment? Yes.
c
I see you don’t even bother with
infracost comment
, sorry I missed that. Right now the PR stuff is only created with the
comment
command. So even if we get the pr info in the json it won’t display in the dashboard PR view. We may need need to add something like an
infracost upload
command to support people who don’t need comment.
f
It would be awesome!.
Thank you very much!