silly-laptop-9121
08/26/2022, 8:21 AMlittle-author-61621
08/26/2022, 8:34 AMsilly-laptop-9121
08/26/2022, 8:51 AM+ git clone $BITBUCKET_GIT_HTTP_ORIGIN --branch=$BITBUCKET_PR_DESTINATION_BRANCH --single-branch /tmp/base
Cloning into '/tmp/base'...
fatal: could not read Username for '<https://bitbucket.org>': No such device or address
pull-requests:
"**":
- step:
name: Run infracost
image: infracost/infracost:ci-0.10
script:
- git clone $BITBUCKET_GIT_HTTP_ORIGIN --branch=$BITBUCKET_PR_DESTINATION_BRANCH --single-branch /tmp/base
#- |
# mkdir -p ~/.ssh
`# eval `ssh-agent -s``
_`# echo "$GIT_SSH_KEY" | tr -d '\r' | ssh-add -`_
_`# ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts`_
`# Generate Infracost JSON file as the baseline, add any required sub-directories to path, e.g. /tmp/base/PATH/TO/TERRAFORM/CODE
.`
- _|_
infracost breakdown --path=/tmp/base/ \
--format=json \
--out-file=infracost-base.json
# Generate an Infracost diff and save it to a JSON file.
- _|_
infracost diff --path=./ \
--compare-to=infracost-base.json \
--format=json \
--out-file=infracost.json
# Posts a comment to the PR.
- _|_
INFRACOST_ENABLE_CLOUD=true infracost comment bitbucket --path=infracost.json \
--repo=$BITBUCKET_WORKSPACE/$BITBUCKET_REPO_SLUG \
--pull-request=$BITBUCKET_PR_ID \
--bitbucket-token=radiateb2b3:$BITBUCKET_TOKEN \
--behavior=update
little-author-61621
08/26/2022, 8:54 AM- git clone $BITBUCKET_GIT_SSH_ORIGIN...
silly-laptop-9121
08/26/2022, 8:58 AMlittle-author-61621
08/26/2022, 8:59 AMsilly-laptop-9121
08/26/2022, 9:19 AMexport INFRACOST_API_KEY=
time="2022-08-26T09:21:30Z" level=info msg="Estimate uploaded to organization 'paul' in Infracost Cloud"
time="2022-08-26T09:21:30Z" level=info msg="Finding matching comments for tag generated by Infracost"
Error: The pull request comment was generated successfully but could not be posted:
Error getting comments: 401 Unauthorized
little-author-61621
08/26/2022, 9:49 AMsilly-laptop-9121
08/26/2022, 9:50 AMlittle-author-61621
08/26/2022, 10:11 AMwhat it copies though is the key with this prependedAh interesting, yeah I think that’s so it works locally, but that doesn’t make sense for CI/CD. I’ll chat to the team and see if we want to change this.export INFRACOST_API_KEY=
silly-laptop-9121
08/26/2022, 10:26 AM$BITBUCKET_TOKEN
little-author-61621
08/26/2022, 10:34 AMsilly-laptop-9121
08/26/2022, 10:36 AMlittle-author-61621
08/26/2022, 10:37 AMBITBUCKET_TOKEN
did you still have to prepend it with <username>:…
?silly-laptop-9121
08/26/2022, 10:38 AMlittle-author-61621
08/26/2022, 10:38 AM