1
0
Fork 0

fix: docker examples, container output, misc lint

This commit is contained in:
ssube 2019-06-25 08:15:04 -05:00
parent a2b42e4e46
commit 670e45a9d0
3 changed files with 13 additions and 8 deletions

View File

@ -22,7 +22,8 @@ To run with Docker (**recommended**): `docker run --rm ssube/salty-dog:master`
To download, validate, and apply a Kubernetes resource: To download, validate, and apply a Kubernetes resource:
```shell ```shell
> curl https://raw.githubusercontent.com/ssube/k8s-shards/master/roles/apps/gitlab/server/templates/ingress.yml | salty-dog \ > curl https://raw.githubusercontent.com/ssube/k8s-shards/master/roles/apps/gitlab/server/templates/ingress.yml |\
salty-dog \
--rules rules/kubernetes.yml \ --rules rules/kubernetes.yml \
--source - \ --source - \
--tag important | kubectl apply --dry-run -f - --tag important | kubectl apply --dry-run -f -
@ -39,8 +40,8 @@ The latest semi-stable image is `ssube/salty-dog:master`.
The Docker container is published for each branch and git tag, tagged with the version slug (`.` replaced with `-`, The Docker container is published for each branch and git tag, tagged with the version slug (`.` replaced with `-`,
mostly). mostly).
Rules are baked into the image in `/rules`. To use custom rules, mount them with `-v $(pwd)/rules:/rules:ro` and Rules are baked into the image in `/salty-dog/rules`. To use custom rules, mount them with
load with `--rules /rules/foo.yml`. `-v $(pwd)/rules:/salty-dog/rules:ro` and load with `--rules /rules/foo.yml`.
### Check Mode ### Check Mode

View File

@ -3,7 +3,7 @@ data:
level: info level: info
name: salty-dog name: salty-dog
streams: streams:
- level: warn - level: info
path: !stream stderr stream: !stream stderr
- level: info - level: info
path: /tmp/salty-dog.log path: /tmp/salty-dog.log

View File

@ -118,7 +118,7 @@ export async function main(argv: Array<string>): Promise<number> {
const activeRules = await resolveRules(rules, args as any); const activeRules = await resolveRules(rules, args as any);
if (args.mode === 'list') { if (args.mode === 'list') {
logger.info({rules: activeRules}, 'listing active rules'); logger.info({ rules: activeRules }, 'listing active rules');
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -136,11 +136,15 @@ export async function main(argv: Array<string>): Promise<number> {
} else { } else {
const itemDiff = diff(item, itemCopy); const itemDiff = diff(item, itemCopy);
if (Array.isArray(itemDiff) && itemDiff.length > 0) { if (Array.isArray(itemDiff) && itemDiff.length > 0) {
logger.info({ diff: itemDiff, item, rule }, 'rule passed with modifications'); logger.info({
diff: itemDiff,
item,
rule: rule.name,
}, 'rule passed with modifications');
applyDiff(item, itemCopy); applyDiff(item, itemCopy);
} else { } else {
logger.info({ rule }, 'rule passed'); logger.info({ rule: rule.name }, 'rule passed');
} }
} }
} }