calm-dawn-89594
10/11/2023, 2:24 PMssh-agent -s
# echo "$GIT_SSH_KEY" | tr -d '\r' | ssh-add -
# Update this to github.com, gitlab.com, bitbucket.org, ssh.dev.azure.com or your source control server's domain
# ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts
# git clone $BITBUCKET_GIT_SSH_ORIGIN --branch=$BITBUCKET_BRANCH --single-branch /tmp/base
# 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 using the 'update' behavior.
# This creates a single comment and updates it. The "quietest" option.
# The other valid behaviors are:
# delete-and-new - Delete previous comments and create a new one.
# new - Create a new cost estimate comment on every push.
# For Bitbucket Cloud:
# If you're using a User token or App password:
# use --bitbucket-token=myusername:$BITBUCKET_TOKEN, where the token can be a User token or App password.
# If you're using a Repository access token:
# use --bitbucket-token=$BITBUCKET_TOKEN
# For Bitbucket Server:
# use --bitbucket-token=$BITBUCKET_TOKEN with your HTTP access token.
# use --bitbucket-server-url=https://your-bitbucket-server.com to override the default https://bitbucket.org.
# See https://www.infracost.io/docs/features/cli_commands/#comment-on-pull-requests for other options
# including --exclude-cli-output that posts only the summary table.
- |
infracost comment bitbucket --path=infracost.json \
--repo=$BITBUCKET_WORKSPACE/$BITBUCKET_REPO_SLUG \
--pull-request=$BITBUCKET_PR_ID \
--bitbucket-token=stefan@domain.com:$BITBUCKET_TOKEN \
--behavior=update
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
error message is 401 see image below - Do you have any idea?little-author-61621
calm-dawn-89594
10/11/2023, 2:35 PMlittle-author-61621
<mailto:stefan@domain.com|stefan@domain.com>:$BITBUCKET_TOKEN
as the value. Does this work if you use your bitbucket username instead of your email?calm-dawn-89594
10/11/2023, 2:46 PM