Comments (6)
Hello!
Thank you for creating the issue!
Could you please explain why CLI should read from this file, so I understand your context better? From my understanding, Atlantis is already aware of the GitHub token. The --write-git-creds
option saves the token to the file, but Atlantis gets it from somewhere. I assume it is provided to Atlantis from an env var so that the same env var can be used for infracost comment
. Or maybe you have a different setup.
UPD: You can also try to use our GitHub app integration which can take care of the private modules. You can read about the benefits here: https://www.infracost.io/docs/integrations/github_app/#benefits
from infracost-atlantis.
infracost comment
require --github-token
to comment on PRs. My setup with Atlantis is via Github App, and Github App creates token on the fly. For my setup to work I have to pass generated token which is inside ~/.git-credentials
manually. Can you help me how I can workaround manual passing of token to --github-token
?
from infracost-atlantis.
According to the Atlantis source code it saves the URL in the format of https://user:[email protected]
. If this is the case, you can add a line in your step with infracost comment
command. For example:
- run: |
GITHUB_TOKEN=$(cat ~/.git-credentials | cut -d '@' -f1 | cut -d ':' -f3)
infracost comment github --repo $BASE_REPO_OWNER/$BASE_REPO_NAME \
--pull-request $PULL_NUM \
--path /tmp/$BASE_REPO_OWNER-$BASE_REPO_NAME-$PULL_NUM/'*'-infracost.json \
--github-token $GITHUB_TOKEN \
--behavior new
Explanation of the $(cat ~/.git-credentials | cut -d '@' -f1 | cut -d ':' -f3)
:
cat ~/.git-credentials
would producehttps://user:[email protected]
- The first
cut -d '@' -f1
will split the string by@
and will pick the first (-f1
) group -https://user:token
- The second
cut -d ':' -f3
will split thehttps://user:token
substring into 3 groupshttps
,//user
andtoken
where we pick the third one. - This output is assigned to an env var
GITHUB_TOKEN
which should be used asinfracost comment
's--github-token
value.
I'm sure there are better ways to extract the token using sed/regex, but this works well too :) Please give it a try.
from infracost-atlantis.
That's how I am doing it. My point was should not infracost comment
supporting the Github App authentication and read the token from the file or is there better way to do this with Github App authentication?
from infracost-atlantis.
We tried to make infracost comment
work for any setup where the explicit flag seems to be the most versatile. I believe it's the first time the GH app authentication was brought up for Atlantis. I could recommend trying our own GItHub app integration in Infracost Cloud: it's fast and easy to set up. It posts PR comments on a free plan as well. Can you give it a try? https://dashboard.infracost.io/
from infracost-atlantis.
The Infracost GitHub App is now free: https://www.infracost.io/docs/integrations/github_app/
from infracost-atlantis.
Related Issues (19)
- Version the infracost-atlantis integration and setup corresponding Docker tags HOT 1
- Output details on failure but don't fail the build HOT 1
- Use this GitHub discussion to tell us what you'd like next
- [Feature] Instead of specifying the env var 'INFRACOST_TERRAFORM_BINARY', infracost should use the default atlantis TF binary HOT 4
- [Feature] Hide the informational/verbose logging HOT 2
- Can this be updated to the latest Atlantis release? HOT 2
- Switch to using latest release of atlantis_diff.sh HOT 1
- Infracost comment Error reading JSON file HOT 18
- Differnt paths for infracost.json used in Azure DevOps documentation HOT 4
- Add Bitbucket example HOT 1
- Warnings/deprecations fail Atlantis plans/applys HOT 9
- WORKSPACE and REPO_REL_DIR not available on post_workflow_hooks HOT 3
- Support arm image HOT 1
- Can we add some guides on integrating Infracost alongside existing policy_checks HOT 2
- [Doubt] How to use Github + Terragrunt HOT 3
- Allow passing in `GITHUB_TOKEN` as an env var instead of a flag HOT 8
- github app instead of github token HOT 2
- Documentation for combined-infracost-comment/README.md might have a config error HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from infracost-atlantis.