From f2563a2935535d985943a015e152d1d12e586907 Mon Sep 17 00:00:00 2001 From: Mitchell Krog Date: Sun, 19 Feb 2017 13:07:53 +0200 Subject: [PATCH] TravisCI Now to Handle Releases and Build Numbering - Preparations for introducing generator scripts and further enhancements to the Bot Blocker - Better tracking of Release Tags and Build Numbering --- .travis.yml | 41 ++++++++++++++----- travis-yml.backup | 36 ++++++++++++++++ {travis => travisCI}/blockbots.tpl.conf | 0 {travis => travisCI}/ddos.tpl.conf | 0 {travis => travisCI}/default-site.tpl.conf | 0 travisCI/deploy.sh | 16 ++++++++ {travis => travisCI}/fastcgi.tpl.conf | 0 {travis => travisCI}/globalblacklist.tpl.conf | 0 {travis => travisCI}/hhvm.tpl.ini | 0 {travis => travisCI}/install-nginx.sh | 9 +--- {travis => travisCI}/nginx.tpl.conf | 0 {travis => travisCI}/php-fpm.tpl.conf | 0 .../whitelist-domains.tpl.conf | 0 {travis => travisCI}/whitelist-ips.tpl.conf | 0 14 files changed, 83 insertions(+), 19 deletions(-) create mode 100644 travis-yml.backup rename {travis => travisCI}/blockbots.tpl.conf (100%) rename {travis => travisCI}/ddos.tpl.conf (100%) rename {travis => travisCI}/default-site.tpl.conf (100%) create mode 100755 travisCI/deploy.sh rename {travis => travisCI}/fastcgi.tpl.conf (100%) rename {travis => travisCI}/globalblacklist.tpl.conf (100%) rename {travis => travisCI}/hhvm.tpl.ini (100%) rename {travis => travisCI}/install-nginx.sh (80%) rename {travis => travisCI}/nginx.tpl.conf (100%) rename {travis => travisCI}/php-fpm.tpl.conf (100%) rename {travis => travisCI}/whitelist-domains.tpl.conf (100%) rename {travis => travisCI}/whitelist-ips.tpl.conf (100%) diff --git a/.travis.yml b/.travis.yml index 8aabddd29..853fdcf21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,17 @@ language: php -env: -- WEB_PORT_80_TCP_ADDR=localhost sudo: required dist: trusty -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 +env: + global: + - secure: unp8irwVXz37jxOFbuM4NciRaq326XktPJP0UuL5m1qdrGiLQVq18cIuXClkxbnCoXzpkL0gG1XdjaD0bRKWAnwRRZBEKDRBYXyF+IcGCfG1k8HUbZoV1OTP21qUXot70YrTiZJ3NkuS32RJdFV9qRAkaM1Srf+ZRHcsZSdXaSJTooMsDLtqk9Bjh9aHEltRCDS0AT2YPANZLW4Yn2QcwBmPhv+3xNxRt2etbl1EYvjYGbKw31JJnMHvS15DJEY52coJ+n4Yw/EI9My4O9TshrAEHeWwXT+dGACdNTD9lXkohuEyc10bgWTGeD5jytm5mbVbzlML3iro0sq6gNWr1iBzGL+FkWSR0ezkbADcnxoUwZa7OHwOPcrzmgkNp6jouGk6Xhl7NQgfwJJtQYPWfOuXIVNUk1Z2Ein/lw2WMzGmEHrqs1x2gIrD83sKqULT3kZBWr4RfhUPjol+V0MZJ+KCW2yo+2C8lZDQ5LWxftoqnG/ia70nFemWsyHSqe2OvN4WfwW9zdS0kRqMZVq/r3R+y0idacFkvO5yXk7cS45tAawIUK5Ipc3fib/ERv8zoDjcIt136hXhlYo44vPr2oprDnyvLcCbdG0A4uCnPpp3Bdbcn2NqIlsXhzBV+YJokaTv5zfWSH2YX6+wdv0C3+dkFjpZaASVg/R7oxg/oXY= + - GIT_NAME: Travis CI + - GIT_EMAIL: builds@travis-ci.org + - TRAVIS_REPO_SLUG: mitchellkrogza/nginx-ultimate-bad-bot-blocker + - GIT_BRANCH: master matrix: fast_finish: true - allow_failures: - - php: hhvm +php: + - '5.6' cache: - apt addons: @@ -22,7 +22,7 @@ install: - sudo add-apt-repository -y ppa:nginx/stable - sudo apt-get update - sudo apt-get install -y --force-yes nginx-extras - - travis/install-nginx.sh + - travisCI/install-nginx.sh script: - sudo nginx -t &> /dev/stdout - curl -vsf 'http://localhost:8080/nginx.php' &> /dev/stdout @@ -33,4 +33,23 @@ script: - STATUSCODE=$(curl -A "masscan" http://localhost:8080/nginx.php &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE 52; then exit 0; fi - STATUSCODE=$(curl -I http://localhost:8080/nginx.php -e http://100dollars-seo.com &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE 52; then exit 0; fi - STATUSCODE=$(curl -I http://localhost:8080/nginx.php -e http://zyzzcentral.ru &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE 52; then exit 0; fi - - cat /tmp/error.log \ No newline at end of file + - cat /tmp/error.log + - echo $TRAVIS_BUILD_DIR + #- travisCI/do-other-stuff.sh +before_deploy: + - travisCI/deploy.sh +deploy: + provider: releases + api_key: + secure: ${GH_TOKEN} + file: + - "conf.d/globalblacklist.conf" + - "bots.d/ddos.conf" + - "bots.d/blockbots.conf" + skip_cleanup: true + on: + repo: mitchellkrogza/nginx-ultimate-bad-bot-blocker + tags: false + all_branches: true +notifications: + email: false \ No newline at end of file diff --git a/travis-yml.backup b/travis-yml.backup new file mode 100644 index 000000000..8aabddd29 --- /dev/null +++ b/travis-yml.backup @@ -0,0 +1,36 @@ +language: php +env: +- WEB_PORT_80_TCP_ADDR=localhost +sudo: required +dist: trusty +php: + - 5.4 + - 5.5 + - 5.6 + - 7.0 +matrix: + fast_finish: true + allow_failures: + - php: hhvm +cache: + - apt +addons: + apt: + packages: + - realpath +install: + - sudo add-apt-repository -y ppa:nginx/stable + - sudo apt-get update + - sudo apt-get install -y --force-yes nginx-extras + - travis/install-nginx.sh +script: + - sudo nginx -t &> /dev/stdout + - curl -vsf 'http://localhost:8080/nginx.php' &> /dev/stdout + - curl -A "googlebot" http://localhost:8080/nginx.php &> /dev/stdout + - curl -A "bingbot" http://localhost:8080/nginx.php &> /dev/stdout + - curl -I http://localhost:8080/nginx.php -e http://google.com + - STATUSCODE=$(curl -A "80legs" http://localhost:8080/nginx.php &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE 52; then exit 0; fi + - STATUSCODE=$(curl -A "masscan" http://localhost:8080/nginx.php &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE 52; then exit 0; fi + - STATUSCODE=$(curl -I http://localhost:8080/nginx.php -e http://100dollars-seo.com &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE 52; then exit 0; fi + - STATUSCODE=$(curl -I http://localhost:8080/nginx.php -e http://zyzzcentral.ru &> /dev/stderr --write-out "%{http_code}") | if test $STATUSCODE 52; then exit 0; fi + - cat /tmp/error.log \ No newline at end of file diff --git a/travis/blockbots.tpl.conf b/travisCI/blockbots.tpl.conf similarity index 100% rename from travis/blockbots.tpl.conf rename to travisCI/blockbots.tpl.conf diff --git a/travis/ddos.tpl.conf b/travisCI/ddos.tpl.conf similarity index 100% rename from travis/ddos.tpl.conf rename to travisCI/ddos.tpl.conf diff --git a/travis/default-site.tpl.conf b/travisCI/default-site.tpl.conf similarity index 100% rename from travis/default-site.tpl.conf rename to travisCI/default-site.tpl.conf diff --git a/travisCI/deploy.sh b/travisCI/deploy.sh new file mode 100755 index 000000000..3861d1725 --- /dev/null +++ b/travisCI/deploy.sh @@ -0,0 +1,16 @@ +#!/bin/bash +YEAR=$(date +"%Y") +MONTH=$(date +"%m") +git config --global user.email "${GIT_EMAIL}" +git config --global user.name "${GIT_NAME}" +git config --global push.default simple +git remote add origin https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git +export GIT_TAG=2.$YEAR-$MONTH.$TRAVIS_BUILD_NUMBER +git fetch --tags +msg="Tag Generated from TravisCI for build $TRAVIS_BUILD_NUMBER" +if git tag $GIT_TAG -a -m "$msg" 2>/dev/null; then +git tag $GIT_TAG -a -m "Tag Generated from TravisCI for build $TRAVIS_BUILD_NUMBER" +git push origin master && git push origin master --tags +ls -aR +else echo Tag already exists!; fi + diff --git a/travis/fastcgi.tpl.conf b/travisCI/fastcgi.tpl.conf similarity index 100% rename from travis/fastcgi.tpl.conf rename to travisCI/fastcgi.tpl.conf diff --git a/travis/globalblacklist.tpl.conf b/travisCI/globalblacklist.tpl.conf similarity index 100% rename from travis/globalblacklist.tpl.conf rename to travisCI/globalblacklist.tpl.conf diff --git a/travis/hhvm.tpl.ini b/travisCI/hhvm.tpl.ini similarity index 100% rename from travis/hhvm.tpl.ini rename to travisCI/hhvm.tpl.ini diff --git a/travis/install-nginx.sh b/travisCI/install-nginx.sh similarity index 80% rename from travis/install-nginx.sh rename to travisCI/install-nginx.sh index e4350ff95..0b4af892a 100755 --- a/travis/install-nginx.sh +++ b/travisCI/install-nginx.sh @@ -1,12 +1,5 @@ #!/bin/bash -# Travis CI Code Adapted and Modified from 4 Sources -# Thanks go out to: -# https://github.com/tburry/travis-nginx-test -# https://github.com/alrra/travis-after-all -# https://github.com/shoonoise/lua-nginx-statistics -# https://github.com/nlindblad/nlindblad.github.io -# Without a combination of your Travis CI tests for Nginx I would never have got it working. - +# Travis CI Code to Install Nginx set -e set -x diff --git a/travis/nginx.tpl.conf b/travisCI/nginx.tpl.conf similarity index 100% rename from travis/nginx.tpl.conf rename to travisCI/nginx.tpl.conf diff --git a/travis/php-fpm.tpl.conf b/travisCI/php-fpm.tpl.conf similarity index 100% rename from travis/php-fpm.tpl.conf rename to travisCI/php-fpm.tpl.conf diff --git a/travis/whitelist-domains.tpl.conf b/travisCI/whitelist-domains.tpl.conf similarity index 100% rename from travis/whitelist-domains.tpl.conf rename to travisCI/whitelist-domains.tpl.conf diff --git a/travis/whitelist-ips.tpl.conf b/travisCI/whitelist-ips.tpl.conf similarity index 100% rename from travis/whitelist-ips.tpl.conf rename to travisCI/whitelist-ips.tpl.conf