From 46580e7bef9112cf941d10b1d25ac28f6ed11893 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Thu, 27 Jun 2019 00:35:19 +0200 Subject: Removing color-based checks. --- bin/taler-deployment-sign | 5 - bin/taler-deployment-switch-test-blue | 15 --- bin/taler-deployment-switch-test-green | 15 --- buildbot/build.sh | 10 +- buildbot/checks.sh | 20 +--- buildbot/config.sh | 5 +- buildbot/demo-checker-master.cfg | 179 --------------------------------- buildbot/demo-oldchecks.sh | 103 ------------------- buildbot/keys.sh | 5 +- buildbot/make_auditor_reports.sh | 2 + buildbot/restart.sh | 5 +- buildbot/sign.sh | 5 +- buildbot/switch.sh | 7 -- buildbot/top_reserve.sh | 5 +- 14 files changed, 10 insertions(+), 371 deletions(-) delete mode 100755 bin/taler-deployment-switch-test-blue delete mode 100755 bin/taler-deployment-switch-test-green delete mode 100644 buildbot/demo-checker-master.cfg delete mode 100755 buildbot/demo-oldchecks.sh delete mode 100755 buildbot/switch.sh diff --git a/bin/taler-deployment-sign b/bin/taler-deployment-sign index c5fb3b7..c5ea621 100755 --- a/bin/taler-deployment-sign +++ b/bin/taler-deployment-sign @@ -14,11 +14,6 @@ if ! test -f $HOME/.config/taler.conf; then exit 1 fi -if ! test -f $(taler-config -s paths -o taler_deployment_shared -f)/hier.lock; then - echo "shared-data/ hier not made yet, please run 'taler-deployment-hier' first" - exit 1 -fi - WIRE_RESPONSE=$(taler-config -s account-1 -o wire_response -f) if test -e "$WIRE_RESPONSE"; then diff --git a/bin/taler-deployment-switch-test-blue b/bin/taler-deployment-switch-test-blue deleted file mode 100755 index e3d6272..0000000 --- a/bin/taler-deployment-switch-test-blue +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -if ! test $(whoami) = test; then - echo Please run as the 'test' user. Exiting. - exit 1 -fi - -rm /home/test/sockets || true -rm /home/test/landing || true -rm /home/test/auditor || true -ln -s /home/test-blue/sockets /home/test/sockets -ln -s /home/test-blue/landing /home/test/landing -ln -s /home/test-blue/auditor /home/test/auditor -echo "test-blue" > /home/test/active -echo "test-green" > /home/test/nonactive diff --git a/bin/taler-deployment-switch-test-green b/bin/taler-deployment-switch-test-green deleted file mode 100755 index 07ec403..0000000 --- a/bin/taler-deployment-switch-test-green +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -if ! test $(whoami) = test; then - echo Please run as the 'test' user. Exiting. - exit 1 -fi - -rm /home/test/sockets || true -rm /home/test/landing || true -rm /home/test/auditor || true -ln -s /home/test-green/sockets /home/test/sockets -ln -s /home/test-green/landing /home/test/landing -ln -s /home/test-green/auditor /home/test/auditor -echo "test-green" > /home/test/active -echo "test-blue" > /home/test/nonactive diff --git a/buildbot/build.sh b/buildbot/build.sh index 2203e7e..2e8894f 100755 --- a/buildbot/build.sh +++ b/buildbot/build.sh @@ -1,14 +1,6 @@ #!/bin/bash -WHOAMI="$(whoami)" -ACTIVE_COLOR="$(cat /home/test/active)" - -echo "whoami: $WHOAMI, active color: $ACTIVE_COLOR" - -if test $WHOAMI = $ACTIVE_COLOR; then - echo "I'm the active color, no need to build Taler!" - exit 1 -fi +set -eu PAUSE_LOCKFILE=/tmp/buildbot_pause.lock diff --git a/buildbot/checks.sh b/buildbot/checks.sh index a53d005..f529a11 100755 --- a/buildbot/checks.sh +++ b/buildbot/checks.sh @@ -1,21 +1,13 @@ #!/bin/bash +set -eu + if test -z "${DEPLOYMENT}"; then echo Please provide DEPLOYMENT env var: 'test' or 'demo' exit 1 fi DOMAIN="taler.net" -## -# Will stay as 'dummy' for 'demo' DEPLOYMENTs since we do -# want to get this value ignored and the active deployment -# to be checked. -NONACTIVE_COLOR="notneeded" - -if test "test" = "${DEPLOYMENT}"; then - NONACTIVE_COLOR="$(cat /home/test/nonactive)" -fi - error_stringify () { case $1 in @@ -30,7 +22,6 @@ error_fmt="%s (http status code: %s)/(curl condition: %s - %s)\n" URL="https://exchange.${DEPLOYMENT}.${DOMAIN}/" http_status_code=$(curl \ - -H "X-Taler-Deployment-Color: ${NONACTIVE_COLOR}" \ -s "$URL" -o /dev/null \ -w "%{http_code}") if ! test 200 = $http_status_code; then @@ -43,7 +34,6 @@ fi URL="http://backend.${DEPLOYMENT}.${DOMAIN}/" http_status_code=$(curl \ - -H "X-Taler-Deployment-Color: ${NONACTIVE_COLOR}" \ -s $URL \ --header "Authorization: ApiKey sandbox" \ -o /dev/null \ @@ -59,7 +49,6 @@ fi URL="https://shop.${DEPLOYMENT}.${DOMAIN}/" http_status_code=$(curl \ - -H "X-Taler-Deployment-Color: ${NONACTIVE_COLOR}" \ -s $URL -o /dev/null \ -w "%{http_code}") if ! test 200 = $http_status_code; then @@ -72,7 +61,6 @@ fi URL="https://survey.${DEPLOYMENT}.${DOMAIN}/" http_status_code=$(curl \ - -H "X-Taler-Deployment-Color: ${NONACTIVE_COLOR}" \ -s $URL -o /dev/null \ -w "%{http_code}") if ! test 200 = $http_status_code; then @@ -85,7 +73,6 @@ fi URL="https://donations.${DEPLOYMENT}.${DOMAIN}/" http_status_code=$(curl \ - -H "X-Taler-Deployment-Color: ${NONACTIVE_COLOR}" \ -s $URL -o /dev/null \ -w "%{http_code}") if ! test 200 = $http_status_code; then @@ -98,7 +85,6 @@ fi URL="https://bank.${DEPLOYMENT}.${DOMAIN}/" http_status_code=$(curl \ - -H "X-Taler-Deployment-Color: ${NONACTIVE_COLOR}" \ -s $URL -o /dev/null \ -w "%{http_code}") if ! test 302 = $http_status_code; then @@ -111,7 +97,6 @@ fi URL="https://${DEPLOYMENT}.${DOMAIN}/en/index.html" http_status_code=$(curl \ - -H "X-Taler-Deployment-Color: ${NONACTIVE_COLOR}" \ -s $URL -o /dev/null \ -w "%{http_code}") if ! test 200 = $http_status_code; then @@ -126,7 +111,6 @@ fi if test "test" = ${DEPLOYMENT}; then URL="https://twister-backend.wild.gv.taler.net" http_status_code=$(curl \ - -H "X-Taler-Deployment-Color: ${NONACTIVE_COLOR}" \ -H "Authorization: ApiKey sandbox" \ -s $URL -o /dev/null \ -w "%{http_code}") diff --git a/buildbot/config.sh b/buildbot/config.sh index 410973b..4a2a16d 100755 --- a/buildbot/config.sh +++ b/buildbot/config.sh @@ -1,9 +1,6 @@ #!/bin/bash -if test "$(whoami)" = "$(cat /home/test/active)"; then - echo "I'm the active color, not my duty to generate configuration." - exit 0 -fi +set -eu source "${HOME}/activate" taler-deployment-config-generate diff --git a/buildbot/demo-checker-master.cfg b/buildbot/demo-checker-master.cfg deleted file mode 100644 index 3b25e2f..0000000 --- a/buildbot/demo-checker-master.cfg +++ /dev/null @@ -1,179 +0,0 @@ -import re -from buildbot.steps.source.git import Git -from buildbot.steps.shell import ShellCommand -from buildbot.plugins import (reporters, - worker, - changes, - schedulers, - util) - -# This is a sample buildmaster config file. It must be installed as -# 'master.cfg' in your buildmaster's base directory. - -# This is the dictionary that the buildmaster pays attention to. -# We also use a shorter alias to save typing. -c = BuildmasterConfig = {} - -# Silence warning and allow very basic phoning home. -c["buildbotNetUsageData"] = "basic" - -####### WORKERS - -# The 'workers' list defines the set of recognized workers. Each -# element is a Worker object, specifying a unique worker name and -# password. The same worker name and password must be configured -# on the worker. -c["workers"] = [ - worker.Worker("demo-checker", "demo-pass")] - -# 'protocols' contains information about protocols which master -# will use for communicating with workers. You must define at -# least 'port' option that workers could connect to your master -# with this protocol. 'port' must match the value configured into -# the workers (with their --master option) -c["protocols"] = { - "pb": { - "port": "tcp:9989:interface=127.0.0.1"}} - -####### CHANGESOURCES - -# the 'change_source' setting tells the buildmaster how it should -# find out about source code changes. - -# No need for change sources. - -####### SCHEDULERS - -# Configure the Schedulers, which decide how to react to incoming -# changes. - -DEMO_SERVICES_CHECKER_SCHEDULER = schedulers.Periodic( - name="demo-check-scheduler", - periodicBuildTimer=60*30, # 1/2 hour - builderNames=["demo-check-builder"]) - - -# Provide "force" button in the web UI. To be removed in the -# future ? -FORCE_SCHEDULER = schedulers.ForceScheduler( - name="force-scheduler", - builderNames=[ - "demo-check-builder"]) - -c["schedulers"] = [ - DEMO_SERVICES_CHECKER_SCHEDULER, - FORCE_SCHEDULER] - -####### BUILDERS - -# The 'builders' list defines the Builders, which tell Buildbot -# how to perform a build: what steps, and which workers can execute -# them. Note that any particular build will only take place on -# one worker. - -DEMO_SERVICES_CHECKER_FACTORY = util.BuildFactory() -DEMO_SERVICES_CHECKER_FACTORY.addStep(ShellCommand( - name="demo services checker", - description="Checking demo services are online", - descriptionDone="Demo services are online!.", - # a symlink to a nonupdated deployment checkout. - command=["/home/demo/demo-oldchecks.sh"], - workdir="build/buildbot", - haltOnFailure=True)) - -DEMO_SERVICES_CHECKER_BUILDER = util.BuilderConfig( - name="demo-check-builder", - workernames="demo-checker", - factory=DEMO_SERVICES_CHECKER_FACTORY) - -c["builders"] = [ - DEMO_SERVICES_CHECKER_BUILDER] - -####### BUILDBOT SERVICES - -# 'services' is a list of BuildbotService items like reporter -# targets. The status of each build will be pushed to these -# targets. buildbot/reporters/*.py has a variety to choose from, -# like IRC bots. - - -## -# Currently not used. -def message_formatter(mode, name, build, results, master_status): - - logs = list() - for line in build.getLogs(): - logs.append(line.getText().splitlines()) - - return { - "body": "\n".join(logs), - "type": "plain"} - -EMAIL = reporters.MailNotifier( -fromaddr="noreply-demochecks@taler.net", -sendToInterestedUsers=False, -# notify from pass to fail, and viceversa. -mode=("change"), -builders=("demo-check-builder"), - extraRecipients=["demo-feedback@taler.net"], - subject="Demo state changed.") - -c["services"] = [EMAIL] - -####### PROJECT IDENTITY - -c["title"] = "Taler" -c["titleURL"] = "https://taler.net" - -# We use nginx to expose the BB under this URL. -c["buildbotURL"] = "https://buildbot.taler.net/" - -from taler_bb_userpass_db import USER_PASSWORD_DB - -BUILDER_LIST = ["demo-check-builder"] - -authz = util.Authz( - allowRules=[ - util.ForceBuildEndpointMatcher( - role="admins", - builder=b) for b in BUILDER_LIST] - + [util.StopBuildEndpointMatcher( - role="admins", - builder=b) for b in BUILDER_LIST] - + [util.RebuildBuildEndpointMatcher( - role="admins", - builder=b) for b in BUILDER_LIST] - + [util.ForceBuildEndpointMatcher( - role="norole", - builder=b) for b in BUILDER_LIST] - + [util.StopBuildEndpointMatcher( - role="norole", - builder=b) for b in BUILDER_LIST] - + [util.RebuildBuildEndpointMatcher( - role="norole", - builder=b) for b in BUILDER_LIST], - roleMatchers=[ - util.RolesFromUsername(roles=["admins"], - usernames=["marcello", - "florian", - "christian"])]) - -# minimalistic config to activate new web UI -c["www"] = { - "port": 8010, - "plugins" : { - "waterfall_view": {}, - "console_view":{}}, - "allowed_origins": ["https://*.taler.net"], - "avatar_methods": [], - "auth": util.UserPasswordAuth(USER_PASSWORD_DB), - "authz": authz} - -####### DB URL - -c["db"] = { - # This specifies what database buildbot uses to store its - # state. You can leave this at its default for all but the - # largest installations. - "db_url" : "sqlite:///state.sqlite", -} diff --git a/buildbot/demo-oldchecks.sh b/buildbot/demo-oldchecks.sh deleted file mode 100755 index 736c9d6..0000000 --- a/buildbot/demo-oldchecks.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash - -error_fmt="%s (http status code: %s)/(curl exit code: %s - %s)\n" -error_stringify () -{ - case $1 in - 28) echo "connection timed out" ;; - 7) echo "failed to connect to host" ;; - 0) echo "not a error, curl went fine" ;; - *) echo "unknown, see curl man page" ;; - esac -} - -DOMAIN="taler.net" -DEPLOYMENT="demo" - -URL="https://exchange.${DEPLOYMENT}.${DOMAIN}/" -http_status_code=$(curl \ - -s "$URL" -o /dev/null \ - -w "%{http_code}") -if ! test 200 = $http_status_code; then - printf "'%s' failed\n" $URL - printf "$error_fmt" \ - "Exchange (${URL}) down" \ - $http_status_code $? "$(error_stringify $?)" - exit 1 -fi - -URL="http://backend.${DEPLOYMENT}.${DOMAIN}/" -http_status_code=$(curl \ - -s $URL \ - --header "Authorization: ApiKey sandbox" \ - -o /dev/null \ - -w "%{http_code}") -if ! test 200 = $http_status_code; then - printf "'%s' failed\n" $URL - printf "$error_fmt" \ - "Merchant ${URL} down" \ - $http_status_code $? "$(error_stringify $?)" - exit 1 -fi - -URL="https://shop.${DEPLOYMENT}.${DOMAIN}/" -http_status_code=$(curl \ - -s $URL -o /dev/null \ - -w "%{http_code}") -if ! test 200 = $http_status_code; then - printf "%s failed\n" $URL - printf "$error_fmt" \ - "Blog (${URL}) down" \ - $http_status_code $? "$(error_stringify $?)" - exit 1 -fi - -URL="https://survey.${DEPLOYMENT}.${DOMAIN}/" -http_status_code=$(curl \ - -s $URL -o /dev/null \ - -w "%{http_code}") -if ! test 200 = $http_status_code; then - printf "%s failed\n" $URL - printf "$error_fmt" \ - "Survey (${URL}) is down" \ - $http_status_code $? "$(error_stringify $?)" - exit 1 -fi - -URL="https://donations.${DEPLOYMENT}.${DOMAIN}/" -http_status_code=$(curl \ - -s $URL -o /dev/null \ - -w "%{http_code}") -if ! test 200 = $http_status_code; then - printf "%s failed\n" $URL - printf "$error_fmt" \ - "Donations (${URL}) is down" \ - $http_status_code $? "$(error_stringify $?)" - exit 1 -fi - -URL="https://bank.${DEPLOYMENT}.${DOMAIN}/" -http_status_code=$(curl \ - -s $URL -o /dev/null \ - -w "%{http_code}") -if ! test 302 = $http_status_code; then - printf "%s failed\n" $URL - printf "$error_fmt" \ - "Bank (${URL}) is down" \ - $http_status_code $? "$(error_stringify $?)" - exit 1 -fi - -URL="https://${DEPLOYMENT}.${DOMAIN}/en/index.html" -http_status_code=$(curl \ - -s $URL -o /dev/null \ - -w "%{http_code}") -if ! test 200 = $http_status_code; then - printf "%s failed\n" $URL - printf "$error_fmt" \ - "Landing (${URL}) is down." \ - $http_status_code $? "$(error_stringify $?)" - exit 1 -fi - -printf "All services correctly restarted!\n" diff --git a/buildbot/keys.sh b/buildbot/keys.sh index 2be5086..3bf1601 100755 --- a/buildbot/keys.sh +++ b/buildbot/keys.sh @@ -1,9 +1,6 @@ #!/bin/bash -if test "$(whoami)" = "$(cat /home/test/active)"; then - echo "I'm the active color, not my duty to generate keys!" - exit 0 -fi +set -eu source "${HOME}/activate" taler-deployment-keyup diff --git a/buildbot/make_auditor_reports.sh b/buildbot/make_auditor_reports.sh index d1515d8..53211fd 100755 --- a/buildbot/make_auditor_reports.sh +++ b/buildbot/make_auditor_reports.sh @@ -4,6 +4,8 @@ # the config file that lives under ${HOME}/.config/taler.conf. # The results will be found under ${HOME}/reports/ +set -eu + DATE=$(date +%Y-%m-%d) REPORT_FILE_NOEXT=${HOME}/audit_report.${DATE} WIRE_REPORT_FILE_NOEXT=${HOME}/wire_audit_report.${DATE} diff --git a/buildbot/restart.sh b/buildbot/restart.sh index 1ef76cd..e27181e 100755 --- a/buildbot/restart.sh +++ b/buildbot/restart.sh @@ -1,9 +1,6 @@ #!/bin/bash -if test "$(whoami)" = "$(cat /home/test/active)"; then - echo "I'm the active color, not my duty to restart Taler!" - exit 0 -fi +set -eu source "${HOME}/activate" taler-deployment-restart diff --git a/buildbot/sign.sh b/buildbot/sign.sh index e563898..ac04807 100755 --- a/buildbot/sign.sh +++ b/buildbot/sign.sh @@ -1,9 +1,6 @@ #!/bin/bash -if test "$(whoami)" = "$(cat /home/test/active)"; then - echo "I am the active color, not my duty to generate wire responses." - exit 0 -fi +set -eu source "${HOME}/activate" taler-deployment-sign diff --git a/buildbot/switch.sh b/buildbot/switch.sh deleted file mode 100755 index 5279de7..0000000 --- a/buildbot/switch.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -NONACTIVE_COLOR="$(cat /home/test/nonactive)" -CMD="${HOME}/deployment/bin/taler-deployment-switch-${NONACTIVE_COLOR}" - -echo "Switching to ${NONACTIVE_COLOR}." -bash -c "${CMD}" diff --git a/buildbot/top_reserve.sh b/buildbot/top_reserve.sh index fff605d..c2538bc 100755 --- a/buildbot/top_reserve.sh +++ b/buildbot/top_reserve.sh @@ -1,9 +1,6 @@ #!/bin/bash -if ! test "$(whoami)" = "$(cat /home/test/active)"; then - echo "I'm the inactive color, will not top the reserve up!" - exit 0 -fi +set -eu source "${HOME}/activate" taler-deployment-top-reserve -- cgit v1.2.3