Skip to content

Commit

Permalink
Add "ymlfmt" for enforcing consistent YAML whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed Nov 28, 2017
1 parent 14c4a7c commit 9efeec1
Show file tree
Hide file tree
Showing 18 changed files with 218 additions and 191 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
language: go

sudo: false
language: bash
services: docker

install:
- .travis/get-markdownfmt.sh
- docker pull tianon/markdownfmt
- docker pull tianon/ymlfmt

script:
- .travis/check-markdownfmt.sh
- .travis/check-ymlfmt.sh
- .travis/check-short.sh
- .travis/check-required-files.sh
- .travis/check-pr-no-readme.sh
4 changes: 2 additions & 2 deletions .travis/check-markdownfmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ files="$(
-name '*.md' \
-not -name 'README.md' \
\) -exec test -s '{}' ';' -print0 \
| xargs -0 markdownfmt -l)"
| xargs -0 ./markdownfmt.sh -l)"
if [ "$files" ]; then
echo >&2 'Need markdownfmt:'
echo >&2 "$files"
echo >&2
echo "$files" | xargs markdownfmt -d >&2
echo "$files" | xargs ./markdownfmt.sh -d >&2
exit 1
fi
22 changes: 22 additions & 0 deletions .travis/check-ymlfmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -Eeuo pipefail

cd "$(dirname "$(readlink -f "$BASH_SOURCE")")/.."

files="$(find -name '*.yml')"
need=()
needdiff=
for f in $files; do
fdiff="$(./ymlfmt.sh -d "$f")"
if [ -n "$fdiff" ]; then
need+=( "$f" )
needdiff+="$fdiff"$'\n'
fi
done
if [ -n "$needdiff" ]; then
echo >&2 'Need ymlfmt:'
echo >&2 "${need[@]}"
echo >&2
echo >&2 -n "$needdiff"
exit 1
fi
20 changes: 10 additions & 10 deletions adminer/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ version: '3.1'

services:

adminer:
image: adminer
restart: always
ports:
- 8080:8080
adminer:
image: adminer
restart: always
ports:
- 8080:8080

db:
image: mysql:5.6
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
db:
image: mysql:5.6
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
80 changes: 40 additions & 40 deletions bonita/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,43 @@
version: '3'

services:
db:
image: postgres:9.3
environment:
POSTGRES_PASSWORD: example
restart: always
command:
- -c
- max_prepared_transactions=100
bonita:
image: bonita
ports:
- 8080:8080
environment:
- POSTGRES_ENV_POSTGRES_PASSWORD=example
- DB_VENDOR=postgres
- DB_HOST=db
- TENANT_LOGIN=tech_user
- TENANT_PASSWORD=secret
- PLATFORM_LOGIN=pfadmin
- PLATFORM_PASSWORD=pfsecret
restart: always
depends_on:
- db
entrypoint:
- bash
- -c
- |
set -e
echo 'Waiting for Postgres to be available'
export PGPASSWORD="$$POSTGRES_ENV_POSTGRES_PASSWORD"
maxTries=10
while [ "$$maxTries" -gt 0 ] && ! psql -h "$$DB_HOST" -U 'postgres' -c '\l'; do
sleep 1
done
echo
if [ "$$maxTries" -le 0 ]; then
echo >&2 'error: unable to contact Postgres after 10 tries'
exit 1
fi
exec /opt/files/startup.sh
db:
image: postgres:9.3
environment:
POSTGRES_PASSWORD: example
restart: always
command:
- -c
- max_prepared_transactions=100
bonita:
image: bonita
ports:
- 8080:8080
environment:
- POSTGRES_ENV_POSTGRES_PASSWORD=example
- DB_VENDOR=postgres
- DB_HOST=db
- TENANT_LOGIN=tech_user
- TENANT_PASSWORD=secret
- PLATFORM_LOGIN=pfadmin
- PLATFORM_PASSWORD=pfsecret
restart: always
depends_on:
- db
entrypoint:
- bash
- -c
- |
set -e
echo 'Waiting for Postgres to be available'
export PGPASSWORD="$$POSTGRES_ENV_POSTGRES_PASSWORD"
maxTries=10
while [ "$$maxTries" -gt 0 ] && ! psql -h "$$DB_HOST" -U 'postgres' -c '\l'; do
sleep 1
done
echo
if [ "$$maxTries" -le 0 ]; then
echo >&2 'error: unable to contact Postgres after 10 tries'
exit 1
fi
exec /opt/files/startup.sh
12 changes: 6 additions & 6 deletions elasticsearch/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ version: '3.1'

services:

elasticsearch:
image: elasticsearch
elasticsearch:
image: elasticsearch

kibana:
image: kibana
ports:
- 5601:5601
kibana:
image: kibana
ports:
- 5601:5601
20 changes: 10 additions & 10 deletions geonetwork/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
version: '3.1'
services:

geonetwork:
image: geonetwork
restart: always
ports:
- 8080:8080
environment:
DATA_DIR: /var/lib/geonetwork_data
volumes:
- geonetwork:/var/lib/geonetwork_data
geonetwork:
image: geonetwork
restart: always
ports:
- 8080:8080
environment:
DATA_DIR: /var/lib/geonetwork_data
volumes:
- geonetwork:/var/lib/geonetwork_data

volumes:
geonetwork:
geonetwork:
30 changes: 15 additions & 15 deletions joomla/stack.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
version: '3.1'

services:
joomla:
image: joomla
restart: always
links:
- joomladb:mysql
ports:
- 8080:80
environment:
JOOMLA_DB_HOST: joomladb
JOOMLA_DB_PASSWORD: example
joomla:
image: joomla
restart: always
links:
- joomladb:mysql
ports:
- 8080:80
environment:
JOOMLA_DB_HOST: joomladb
JOOMLA_DB_PASSWORD: example

joomladb:
image: mysql:5.6
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
joomladb:
image: mysql:5.6
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
12 changes: 6 additions & 6 deletions kibana/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ version: '3.1'

services:

kibana:
image: kibana
ports:
- 5601:5601
kibana:
image: kibana
ports:
- 5601:5601

elasticsearch:
image: elasticsearch
elasticsearch:
image: elasticsearch

20 changes: 10 additions & 10 deletions mariadb/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ version: '3.1'

services:

db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example

adminer:
image: adminer
restart: always
ports:
- 8080:8080
adminer:
image: adminer
restart: always
ports:
- 8080:8080
2 changes: 1 addition & 1 deletion markdownfmt.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
set -e

exec docker run -i --rm -v "$PWD":/scratch -w /scratch tianon/markdownfmt markdownfmt "$@"
exec docker run -i --rm -v "$PWD":/scratch -w /scratch -u "$(id -u):$(id -g)" tianon/markdownfmt markdownfmt "$@"
8 changes: 4 additions & 4 deletions mediawiki/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
restart: always
environment:
# @see https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/DefaultSettings.php
MYSQL_DATABASE: 'my_wiki'
MYSQL_USER: 'wikiuser'
MYSQL_PASSWORD: 'example'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_DATABASE: my_wiki
MYSQL_USER: wikiuser
MYSQL_PASSWORD: example
MYSQL_RANDOM_ROOT_PASSWORD: yes
20 changes: 10 additions & 10 deletions mysql/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ version: '3.1'

services:

db:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
db:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: example

adminer:
image: adminer
restart: always
ports:
- 8080:8080
adminer:
image: adminer
restart: always
ports:
- 8080:8080
20 changes: 10 additions & 10 deletions percona/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ version: '3.1'

services:

db:
image: percona
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
db:
image: percona
restart: always
environment:
MYSQL_ROOT_PASSWORD: example

adminer:
image: adminer
restart: always
ports:
- 8080:8080
adminer:
image: adminer
restart: always
ports:
- 8080:8080
20 changes: 10 additions & 10 deletions postgres/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ version: '3.1'

services:

db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: example
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: example

adminer:
image: adminer
restart: always
ports:
- 8080:8080
adminer:
image: adminer
restart: always
ports:
- 8080:8080
Loading

0 comments on commit 9efeec1

Please sign in to comment.