This message was deleted.
# general
b
This message was deleted.
b
Hi Kristian! Nice to meet you! 🙂 May I ask you if you used our updated process for GitLab? It's described here using our CI docker image: https://gitlab.com/infracost/infracost-gitlab-ci/
And if yes, can you confirm that you saw similar output in CI?
Copy code
Running compost:
  compost autodetect update --body-file /tmp/tmp.JfADgb
Detected GitLab CI
  Platform: gitlab
  Project: infracost/gitlab-ci-demo
  Target type: merge-request
  Target ref: 22
Finding matching comments for tag `compost-comment`
Found 1 matching comment
Updating comment <https://gitlab.com/infracost/gitlab-ci-demo/-/merge_requests/22#note_811904842>
r
yup, I’ve adapted your pipeline somewhat just to fit the convention of where my tf files are etc, but the bones are the same. This is the output I get:
Copy code
$ infracost breakdown --path plan.json --format json --out-file infracost.json
time="2022-01-26T09:44:58Z" level=info msg="Detected Terraform plan JSON file at plan.json"
time="2022-01-26T09:44:58Z" level=info msg="Starting: Calculating monthly cost estimate"
Output saved to infracost.json
$ /scripts/ci/comment.sh infracost.json
Running infracost output:
  infracost output  --path infracost.json --format gitlab-comment --show-skipped --out-file /tmp/tmp.dBJoFK
Output saved to /tmp/tmp.dBJoFK
Running compost:
  compost autodetect update --body-file /tmp/tmp.dBJoFK
Detected GitLab CI
  Platform: gitlab
  Project: [redacted, but correct!]
  Target type: merge-request
  Target ref: 1
Finding matching comments for tag `compost-comment`
Found 0 matching comments
Creating new comment
    Error: Request failed with status code 403
It’s weird, because obviously some communication with the API is working because it’s found the correct project, and target MR
b
Indeed, and this line tells that it was able to make a request and get the result:
Found 0 matching comments
r
I confirmed via a manual API post that the token I’m using does have permission to create comments on the MR:
Copy code
curl -X POST --header "PRIVATE-TOKEN: redacted" --data-urlencode "body=test" <https://gitlab>.[redacted]/merge_requests/1/notes
b
Not related to GitLab, but I saw a similar 403 in Azure DevOps, when I used my personal token to post an Infracost comment to a PR. And then when I tried it in CI (with system token), it was failing because it was trying to update my previous comment, but couldn't do it, because it was not an author. But apparently your comment with
body=test
is not recognized by CI as from Infracost. 🤔
Is it possible to give the token more access rights? Maybe full access, just rule out the scope issue?
@mysterious-teacher-68276 Have you seen any 403s working with GitLab CI?
m
👋
@rich-artist-32531 what kind of token are you using - personal or project?
r
Is it possible to give the token more access rights? Maybe full access, just rule out the scope issue?
the
api
level it has is actually already the full level it can have for a project access token (that’s unrestricted read/write to this project)
@rich-artist-32531 what kind of token are you using - personal or project?
Project
m
@rich-artist-32531 do you want to hop on a call with @busy-agent-35515 and I and try and get this sorted for you?
r
sure, that would be great!
m
ok I’ll ping you in a separate chat
👏 1
DEBUG=*