This message was deleted.
# help
b
This message was deleted.
m
Hi @orange-midnight-75948 can you paste the CI/CD pipeline configuration you are using to run Infracost?
o
Yes!
Copy code
infracost:
  stage: infracost
  image:
    name: infracost/infracost:ci-0.10
    entrypoint: [""]
  before_script:
    - cd directory
  script:
    - |
      infracost breakdown --path output.json \
                          --format=json \
                          --out-file=infracost-base.json
    - |
      infracost diff --path output.json \
                    --compare-to=infracost-base.json \
                    --format=json \
                    --out-file=infracost.json
    - |
      infracost comment gitlab --path=infracost.json \
                              --repo=$CI_PROJECT_PATH \
                              --merge-request=$CI_MERGE_REQUEST_IID \
                              --gitlab-server-url=$CI_SERVER_URL \
                              --gitlab-token=$GITLAB_TOKEN \
                              --behavior=new
m
and what are you expecting
output.json
to be?
is this the output from your terraform plan?
o
My output.json is an artefact from terraform
Yes
m
so the error suggests that the artefact hasn’t been found by Infracost - this could be because it’s not available at that path or your not making it available to this stage in the pipeline.
hence why we show the error:
no such file or directory output.json
o
Yes
Do you know the path of an artefact on Gitlab?
Maybe repo-name/artefact.txt?
m
I believe it’s just mounted at the root of the stage - however it looks like you’re doing a
cd
at the beginning of this stage into a different directory so it’s most likely one directory backwards
I’d suggest running a
ls
step first in the stage to make sure the artefact is there
1
also FYI if you are using a terraform plan JSON you do not need the
infracost diff
step as this is implicit from the terraform plan
1
o
I will try, I keep you in touch! Ok!
m
so your stage would look like:
Copy code
infracost:
  stage: infracost
  image:
    name: infracost/infracost:ci-0.10
    entrypoint: [""]
  before_script:
    - cd directory
  script:
    - |
      infracost breakdown --path output.json \
                          --format=json \
                          --out-file=infracost.json
    - |
      infracost comment gitlab --path=infracost.json \
                              --repo=$CI_PROJECT_PATH \
                              --merge-request=$CI_MERGE_REQUEST_IID \
                              --gitlab-server-url=$CI_SERVER_URL \
                              --gitlab-token=$GITLAB_TOKEN \
                              --behavior=new
1
o
Yes, thanks!
@mysterious-teacher-68276 Ok it's good
Merci!
m
pas soucis
❤️ 1