broad-zoo-34077
06/24/2022, 5:57 PMmysterious-teacher-68276
06/24/2022, 5:58 PMmysterious-teacher-68276
06/24/2022, 5:59 PM--path
and --config-file
in the same command, however what I think you’re looking for is the --compare-to
flag built into diffvictorious-jordan-10935
06/24/2022, 6:00 PMmysterious-teacher-68276
06/24/2022, 6:01 PMvictorious-jordan-10935
06/24/2022, 6:01 PM- |
infracost breakdown --path=/tmp/base \
--format=json \
--out-file=infracost-base.json
- |
infracost diff --config-file=infracost.yml \
--compare-to=infracost-base.json \
--format=json \
--out-file=infracost.json
mysterious-teacher-68276
06/24/2022, 6:02 PMmysterious-teacher-68276
06/24/2022, 6:02 PMvictorious-jordan-10935
06/24/2022, 6:02 PM-path=./
is not able to read all my filesmysterious-teacher-68276
06/24/2022, 6:03 PM- |
infracost breakdown --config-file=/tmp/base/infracost.yml \
--format=json \
--out-file=infracost-base.json
- |
infracost diff --config-file=infracost.yml \
--compare-to=infracost-base.json \
--format=json \
--out-file=infracost.json
victorious-jordan-10935
06/24/2022, 6:03 PMvictorious-jordan-10935
06/24/2022, 6:03 PMvictorious-jordan-10935
06/24/2022, 6:03 PMmysterious-teacher-68276
06/24/2022, 6:03 PMmysterious-teacher-68276
06/24/2022, 6:04 PMmysterious-teacher-68276
06/24/2022, 6:04 PMmysterious-teacher-68276
06/24/2022, 6:04 PMvictorious-jordan-10935
06/24/2022, 6:04 PMmysterious-teacher-68276
06/24/2022, 6:09 PMpipelines:
pull-requests:
'**':
- step:
name: Run infracost
image: infracost/infracost:ci-0.10
script:
# Clone the base branch of the pull request (e.g. main/master) into a temp directory.
- git clone $BITBUCKET_GIT_HTTP_ORIGIN --branch=$BITBUCKET_PR_DESTINATION_BRANCH --single-branch /tmp/base
- |
cd /tmp/base
infracost breakdown --config-file=$BITBUCKET_CLONE_DIR/infracost.yml
--format=json \
--out-file=infracost-base.json
- |
cd $BITBUCKET_CLONE_DIR
infracost diff --config-file=infracost.yml
--compare-to=/tmp/base/infracost-base.json \
--format=json \
--out-file=infracost.json
- |
infracost comment bitbucket --path=infracost.json \
--repo=$BITBUCKET_WORKSPACE/$BITBUCKET_REPO_SLUG \
--pull-request=$BITBUCKET_PR_ID \
--bitbucket-token=myusername:$BITBUCKET_TOKEN \
--behavior=update
mysterious-teacher-68276
06/24/2022, 6:09 PMmysterious-teacher-68276
06/24/2022, 6:09 PMmysterious-teacher-68276
06/24/2022, 6:09 PMBITBUCKET_CLONE_DIR
is the what I think they provide you as the original working directoryvictorious-jordan-10935
06/24/2022, 6:09 PMvictorious-jordan-10935
06/24/2022, 6:10 PMmysterious-teacher-68276
06/24/2022, 6:10 PMvictorious-jordan-10935
06/24/2022, 6:24 PMvictorious-jordan-10935
06/24/2022, 6:24 PMvictorious-jordan-10935
06/24/2022, 6:24 PMmysterious-teacher-68276
06/24/2022, 6:24 PMvictorious-jordan-10935
06/24/2022, 6:25 PMmysterious-teacher-68276
06/24/2022, 6:25 PMmysterious-teacher-68276
06/24/2022, 6:26 PMoutput
sectionvictorious-jordan-10935
06/24/2022, 6:26 PMmysterious-teacher-68276
06/24/2022, 6:28 PMinfracost comment
is a helper to take our JSON output and POST it to the bitbucket API. --format-bitbucket-comment
outputs a markdown comment which you could send to the API using curl
or similarmysterious-teacher-68276
06/24/2022, 6:31 PMoutput
section is collapsiblevictorious-jordan-10935
06/24/2022, 6:34 PMvictorious-jordan-10935
06/24/2022, 6:35 PMmysterious-teacher-68276
06/24/2022, 6:38 PMdetails
html element in PR comments. Which is what we use to make it collapsible on other platforms.mysterious-teacher-68276
06/24/2022, 6:42 PM--format=bitbucket-comment
will produce a simple markdown format and remove any lines below the
**Infracost output:**
section using something like sed
victorious-jordan-10935
06/24/2022, 6:42 PMvictorious-jordan-10935
06/24/2022, 6:42 PMmysterious-teacher-68276
06/24/2022, 6:42 PMvictorious-jordan-10935
06/24/2022, 6:42 PMmysterious-teacher-68276
06/24/2022, 6:43 PMwhite-airport-8778