Comments (5)
I see. Can we achieve the same solution running datree config set token $TOKEN && datree test ...
?
I'm trying to avoid multiple touch-points for token insertion. This can add complexity to debugging if we place the same token in multiple places with ambiguity regarding variable precedence.
This is not a constraint though, if adding a token flag is the best solution we can certainly do that and update docs for clarity
from datree.
I'll mock something up to see if we can get $TOKEN into the datree docker img that pre-commit runs. It's not something that I've run into in the documentation so it might be supported just undocumented. It makes sense to try and exhaust our potential solutions before adding more complexity to the app.
from datree.
Would you consider a PR to add in a --token
flag to the CLI that accepts this parameter rather than an environment variable? Through this approach a user could configure their .pre-commit-config.yaml file like so:
repos:
- repo: https://github.com/datreeio/datree
rev: 0.14.49
hooks:
- id: datree-docker
args: ['--token abcd123456789']
If you're open to that approach I could mock something up to quickly test if this solution will work with the existing pre-commit-hooks.yaml file and the existing args being passed in using the docker_image
language type in pre-commit.
from datree.
Hi @kevholmes ,
We actually have support for env variable. If you use DATREE_TOKEN
(https://hub.datree.io/account-token#lz-how-it-works) you can set a token in runtime, which will work similarly to --token
flag.
Using datree config set token <token>
will also do the trick.
The issue here is adding this behavior to the docker run functionality, allowing docker to have the local token in the pre-commit step. One of the solutions can be doing docker run -e DATREE_TOKEN=$LOCAL_TOKEN
with a script running beforehand updating LOCAL_TOKEN
with the token located in ~/.datree/config.yaml
if exists.
from datree.
Hey @dimabru,
Yeah, that's my issue with using the env var solution, there's not really any support for that with the docker_image
type in pre-commit. We can pass in extra command line args
for the cli invocation of datree but there's no documented way to use environment variables in such a way with pre-commit. I could try to write a test script up where we attempt to pass in an env-var through pre-commit but I do not believe it supports any kind of env var awareness.
from datree.
Related Issues (20)
- Dashboard login giving error in verifying token. HOT 7
- Datree installation fails in Minikube due to insufficient cpu HOT 3
- Datree Support for SOPS or ability to skip files where "sops" is contained HOT 5
- Datree installation is failing HOT 1
- could not find schema for PodDisruptionBudget HOT 2
- k8s object names are not displayed during datree kustomize test schema validation HOT 3
- datree fails with yaml anchors on linux HOT 4
- Datree update causing validation errors on non-existent fields in deployment files HOT 2
- Cannot use Policy as code from CLI HOT 12
- Why `Prevent containers from accessing host files by using high UIDs` request uid > 10 000 HOT 8
- Error messages logged to stdout instead of stderr break Json and Yaml output formats HOT 1
- Fail to evaluate custom rule with Rego HOT 3
- showing container name in addition of array index.
- Support skipping on a single container
- Disable some of built-in rules? HOT 1
- Add optional rule to lint kubernetes resource names
- CIS_INVALID_VALUE_SECCOMP_PROFILE Is reporting error when it should not HOT 4
- documentation link is not working properly
- Datree outage? HOT 4
- get.datree.io is down HOT 3
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 datree.