|
| 1 | +#!/bin/bash |
| 2 | +set -o errexit |
| 3 | +set -o pipefail |
| 4 | +set -o nounset |
| 5 | + |
| 6 | +readonly CWD="$PWD" |
| 7 | +readonly TESTS_DIR="integration-tests/Dockerfiles" |
| 8 | + |
| 9 | +function git_clone() { |
| 10 | + local git_url="$1" |
| 11 | + git clone --quiet --depth 1 "$git_url" |
| 12 | +} |
| 13 | + |
| 14 | +function git_named_clone() { |
| 15 | + local git_url="$1" |
| 16 | + local dir="$2" |
| 17 | + git clone --quiet --depth 1 "$git_url" "$dir" |
| 18 | +} |
| 19 | + |
| 20 | +function clone_repos() { |
| 21 | + rm -rf "$TESTS_DIR" && mkdir -p "$TESTS_DIR" && cd "$TESTS_DIR" |
| 22 | + # offical docker images |
| 23 | + git_clone https://github.com/docker-library/ruby.git & |
| 24 | + git_clone https://github.com/docker-library/mariadb.git & |
| 25 | + git_clone https://github.com/docker-library/ghost.git & |
| 26 | + git_clone https://github.com/docker-library/redis.git & |
| 27 | + git_clone https://github.com/docker-library/python.git & |
| 28 | + git_clone https://github.com/docker-library/buildpack-deps.git & |
| 29 | + git_clone https://github.com/docker-library/postgres.git & |
| 30 | + git_clone https://github.com/docker-library/rabbitmq.git & |
| 31 | + git_clone https://github.com/docker-library/redmine.git & |
| 32 | + git_clone https://github.com/docker-library/mysql.git & |
| 33 | + git_clone https://github.com/docker-library/golang.git & |
| 34 | + git_clone https://github.com/docker-library/drupal.git & |
| 35 | + git_clone https://github.com/docker-library/haproxy.git & |
| 36 | + git_clone https://github.com/docker-library/elasticsearch.git & |
| 37 | + git_clone https://github.com/docker-library/kibana.git & |
| 38 | + git_clone https://github.com/docker-library/php.git & |
| 39 | + git_clone https://github.com/docker-library/mongo.git & |
| 40 | + git_clone https://github.com/docker-library/gcc.git & |
| 41 | + git_clone https://github.com/docker-library/httpd.git & |
| 42 | + git_clone https://github.com/docker-library/java.git & |
| 43 | + git_clone https://github.com/docker-library/wordpress.git & |
| 44 | + git_clone https://github.com/docker-library/tomcat.git & |
| 45 | + git_clone https://github.com/docker-library/logstash.git & |
| 46 | + git_clone https://github.com/docker-library/julia.git & |
| 47 | + git_clone https://github.com/docker-library/busybox.git & |
| 48 | + git_clone https://github.com/docker-library/percona.git & |
| 49 | + git_clone https://github.com/docker-library/django.git & |
| 50 | + git_clone https://github.com/docker-library/memcached.git & |
| 51 | + git_clone https://github.com/docker-library/docker.git & |
| 52 | + git_clone https://github.com/docker-library/rails.git & |
| 53 | + git_clone https://github.com/docker-library/pypy.git & |
| 54 | + git_clone https://github.com/docker-library/hello-world.git & |
| 55 | + git_clone https://github.com/docker-library/celery.git & |
| 56 | + git_clone https://github.com/nodejs/docker-node.git & |
| 57 | + git_clone https://github.com/nginxinc/docker-nginx.git & |
| 58 | + |
| 59 | + |
| 60 | + # popular Dockerfile repos |
| 61 | + git_clone https://github.com/wking/dockerfile.git & |
| 62 | + git_clone https://github.com/eugeneware/docker-wordpress-nginx.git & |
| 63 | + git_clone https://github.com/CentOS/CentOS-Dockerfiles.git & |
| 64 | + git_clone https://github.com/octohost/octohost.git & |
| 65 | + git_clone https://github.com/komljen/dockerfile-examples.git & |
| 66 | + git_clone https://github.com/tianon/dockerfiles.git & |
| 67 | + git_clone https://github.com/Netflix-Skunkworks/zerotodocker.git & |
| 68 | + git_clone https://github.com/amplab/docker-scripts.git & |
| 69 | + git_clone https://github.com/oracle/docker-images.git & |
| 70 | + git_clone https://github.com/dockerfile/ubuntu-desktop.git & |
| 71 | + git_clone https://github.com/yesnault/docker-phabricator.git & |
| 72 | + git_clone https://github.com/mattgruter/dockerfile-guacamole.git & |
| 73 | + git_clone https://github.com/uzyexe/dockerfile-terraform.git & |
| 74 | + git_clone https://github.com/mattgruter/dockerfile-doubledocker.git & |
| 75 | + git_clone https://github.com/mattgruter/dockerfile-drone.git & |
| 76 | + git_clone https://github.com/ArchiveTeam/warrior-dockerfile.git & |
| 77 | + git_clone https://github.com/wckr/wocker-dockerfile.git & |
| 78 | + git_clone https://github.com/kartoza/docker-postgis.git & |
| 79 | + |
| 80 | + # colliding names |
| 81 | + git_named_clone https://github.com/yaronr/dockerfile.git yaronr-dockerfile & |
| 82 | + git_named_clone https://github.com/seapy/dockerfiles.git seapy-dockerfiles & |
| 83 | + git_named_clone https://github.com/nickstenning/dockerfiles.git nickstenning-dockerfiles & |
| 84 | + git_named_clone https://github.com/crosbymichael/Dockerfiles.git crosbymichael-dockerfiles & |
| 85 | + git_named_clone https://github.com/SvenDowideit/dockerfiles.git svendowideit-dockerfiles & |
| 86 | + git_named_clone https://github.com/codenvy/dockerfiles.git codenvy-dockerfiles & |
| 87 | + git_named_clone https://github.com/couchbase/docker.git couchbase-docker & |
| 88 | + git_named_clone https://github.com/EvaEngine/Dockerfiles.git evaengine-dockerfiles & |
| 89 | + git_named_clone https://github.com/yankcrime/dockerfiles.git yankcrime-dockerfiles & |
| 90 | + git_named_clone https://github.com/voxxit/dockerfiles.git voxxit-dockerfiles & |
| 91 | + git_named_clone https://github.com/mikz/dockerfiles.git mikz-dockerfiles & |
| 92 | + git_named_clone https://github.com/ksoichiro/dockerfiles.git ksoichiro-dockerfiles & |
| 93 | + git_named_clone https://github.com/jgautheron/dockerfiles.git jgautheron-dockerfiles & |
| 94 | + git_named_clone https://github.com/coderstephen/dockerfiles.git coderstephen-dockerfiles & |
| 95 | + git_named_clone https://github.com/ehazlett/dockerfiles.git ehazlett-dockerfiles & |
| 96 | + git_named_clone https://github.com/Evlos/dockerfile.git evlos-dockerfile & |
| 97 | + |
| 98 | + wait |
| 99 | + cd "${CWD}/integration-tests/" |
| 100 | +} |
| 101 | + |
| 102 | +function parse_dockerfiles() { |
| 103 | + local dockerfiles |
| 104 | + local result |
| 105 | + stack ghc parseFile.hs |
| 106 | + dockerfiles=$(find . -name 'Dockerfile') |
| 107 | + for dockerfile in $dockerfiles; do |
| 108 | + if ./parseFile "$dockerfile" | grep -a1 unexpected; then |
| 109 | + result="false" |
| 110 | + fi |
| 111 | + done |
| 112 | + if [[ ${result} == "false" ]]; then false; fi |
| 113 | +} |
| 114 | + |
| 115 | +function main() { |
| 116 | + clone_repos |
| 117 | + parse_dockerfiles |
| 118 | +} |
| 119 | + |
| 120 | +main |
0 commit comments