From 5823e3e10efc18f90df58a961dede0589c8d121c Mon Sep 17 00:00:00 2001 From: blag Date: Fri, 13 Mar 2020 15:29:17 -0700 Subject: [PATCH 1/2] Cleanup some antipatterns --- actions/setup_e2e_tests.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/actions/setup_e2e_tests.sh b/actions/setup_e2e_tests.sh index 55a5489b..0c675d3a 100644 --- a/actions/setup_e2e_tests.sh +++ b/actions/setup_e2e_tests.sh @@ -17,8 +17,8 @@ fi PIP="pip" # Install OS specific pre-reqs (Better moved to puppet at some point.) -DEBTEST=`lsb_release -a 2> /dev/null | grep Distributor | awk '{print $3}'` -RHTEST=`cat /etc/redhat-release 2> /dev/null | sed -e "s~\(.*\)release.*~\1~g"` +DEBTEST=$(lsb_release -a 2> /dev/null | grep Distributor | awk '{print $3}') +RHTEST=$(cat /etc/redhat-release 2> /dev/null | sed -e "s~\(.*\)release.*~\1~g") # Decrease interval for MongoDB TTL expire thread. By default it runs every 60 seconds which # means we would need to wait at least 60 seconds in our key expire end to end tests. @@ -29,7 +29,7 @@ echo -e "\nsetParameter:\n ttlMonitorSleepSecs: 1" | sudo tee -a /etc/mongod.co sudo cat /etc/mongod.conf if [[ -n "$RHTEST" ]]; then - RHVERSION=`cat /etc/redhat-release 2> /dev/null | sed -r 's/([^0-9]*([0-9]*)){1}.*/\2/'` + RHVERSION=$(cat /etc/redhat-release 2> /dev/null | sed -r 's/([^0-9]*([0-9]*)){1}.*/\2/') echo "*** Detected Distro is ${RHTEST} - ${RHVERSION} ***" echo "Restarting MongoDB..." @@ -65,8 +65,8 @@ if [[ -n "$RHTEST" ]]; then git clone --branch add_per_test_timing_information --depth 1 https://github.com/Kami/bats-core.git (cd bats-core; sudo ./install.sh /usr/local) elif [[ -n "$DEBTEST" ]]; then - DEBVERSION=`lsb_release --release | awk '{ print $2 }'` - SUBTYPE=`lsb_release -a 2>&1 | grep Codename | grep -v "LSB" | awk '{print $2}'` + DEBVERSION=$(lsb_release --release | awk '{ print $2 }') + SUBTYPE=$(lsb_release -a 2>&1 | grep Codename | grep -v "LSB" | awk '{print $2}') echo "*** Detected Distro is ${DEBTEST} - ${DEBVERSION} ***" echo "Restarting MongoDB..." From 3161f0c5dae2441402e604852c94ce70a5ea3824 Mon Sep 17 00:00:00 2001 From: blag Date: Fri, 13 Mar 2020 16:29:56 -0700 Subject: [PATCH 2/2] Remove some rules and actions that aren't needed anymore --- actions/e2e_tests.meta.yaml | 55 ---- actions/workflows/e2e_tests.yaml | 300 ------------------ ...t2_add_librato_annotation_for_release.yaml | 18 -- rules/st2contrib_regenerate_readme.yaml | 20 -- 4 files changed, 393 deletions(-) delete mode 100644 actions/e2e_tests.meta.yaml delete mode 100644 actions/workflows/e2e_tests.yaml delete mode 100644 rules/st2_add_librato_annotation_for_release.yaml delete mode 100644 rules/st2contrib_regenerate_readme.yaml diff --git a/actions/e2e_tests.meta.yaml b/actions/e2e_tests.meta.yaml deleted file mode 100644 index c8a8d161..00000000 --- a/actions/e2e_tests.meta.yaml +++ /dev/null @@ -1,55 +0,0 @@ ---- - name: "e2e_tests" - runner_type: "action-chain" - description: "Runs a series of end to end tests on a StackStorm server" - enabled: true - entry_point: "workflows/e2e_tests.yaml" - parameters: - hostname: - type: "string" - description: "Host to run tests on" - required: true - repo: - type: "string" - description: "" - branch: - type: "string" - description: "" - st2tests_branch: - type: "string" - description: "" - default: "master" - build: - type: "string" - description: "Build number" - required: true - environment: - type: "string" - description: "" - revision: - type: "string" - st2_username: - type: "string" - description: "Username to authenticate to the St2 server" - default: "testu" - st2_password: - type: "string" - description: "Password to authenticate to the St2 server" - default: "testp" - windows_host: - type: "string" - description: "Windows host name. If not specified, test will only check prerequisites" - default: "" - windows_username: - type: "string" - description: "Windows username. Default is Administrator" - default: "Administrator" - windows_password: - type: "string" - secret: true - description: "Windows password" - default: "" - protocol: - type: "string" - description: "http/https" - default: "http" diff --git a/actions/workflows/e2e_tests.yaml b/actions/workflows/e2e_tests.yaml deleted file mode 100644 index 2e78afe3..00000000 --- a/actions/workflows/e2e_tests.yaml +++ /dev/null @@ -1,300 +0,0 @@ ---- - chain: - - - name: "get_st2_token" - ref: "st2cd.get_st2_token" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - hosts: "{{hostname}}" - st2_username: "{{st2_username}}" - st2_password: "{{st2_password}}" - publish: - st2_token: "{{get_st2_token[hostname].stdout.token}}" - on-success: "install_fixtures" - - - name: "install_fixtures" - ref: "st2cd.install_tests" - params: - hosts: "{{hostname}}" - pack: "fixtures" - branch: "{{st2tests_branch}}" - on-success: "install_asserts" - - - name: "install_asserts" - ref: "st2cd.install_tests" - params: - hosts: "{{hostname}}" - pack: "asserts" - branch: "{{st2tests_branch}}" - on-success: "install_tests" - - - name: "install_tests" - ref: "st2cd.install_tests" - params: - hosts: "{{hostname}}" - pack: "tests" - branch: "{{st2tests_branch}}" - on-success: "install_webui" - - - name: "install_webui" - ref: "st2cd.install_tests" - params: - hosts: "{{hostname}}" - pack: "webui" - branch: "{{st2tests_branch}}" - on-success: "install_examples" - - - name: "install_examples" - ref: "st2cd.install_examples" - params: - hosts: "{{hostname}}" - on-success: "core_local_date" - - - name: "core_local_date" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "core_local_date" - token: "{{st2_token}}" - action: "core.local" - params: "date" - hosts: "{{hostname}}" - on-success: "core_http_google" - - - name: "core_http_google" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "core_http_google" - token: "{{st2_token}}" - action: "core.http" - params: "url=https://www.google.com" - hosts: "{{hostname}}" - on-success: "core_remote_single_host" - - - name: "core_remote_single_host" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "core_remote_single_host" - token: "{{st2_token}}" - action: "core.remote" - params: "hosts={{hostname}} hostname" - hosts: "{{hostname}}" - on-success: "test_quickstart" - - - name: "test_quickstart" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_quickstart" - token: "{{st2_token}}" - action: "tests.test_quickstart" - params: "token={{st2_token}} protocol={{protocol}}" - hosts: "{{hostname}}" - timeout: 180 - on-success: "test_quickstart_key" - - - name: "test_quickstart_key" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_quickstart_key" - token: "{{st2_token}}" - action: "tests.test_quickstart_key" - params: "token={{st2_token}} protocol={{protocol}}" - hosts: "{{hostname}}" - on-success: "test_quickstart_rules" - - - name: "test_quickstart_rules" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_quickstart_rules" - token: "{{st2_token}}" - action: "tests.test_quickstart_rules" - params: "token={{st2_token}} protocol={{protocol}}" - hosts: "{{hostname}}" - timeout: 600 - on-success: "test_quickstart_packs" - - - name: "test_quickstart_packs" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_packs_pack" - token: "{{st2_token}}" - action: "tests.test_packs_pack" - params: "token={{st2_token}} protocol={{protocol}}" - hosts: "{{hostname}}" - timeout: 600 - on-success: "test_quickstart_local_script" - - - name: "test_quickstart_local_script" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_quickstart_local_script" - token: "{{st2_token}}" - action: "tests.test_quickstart_local_script_actions" - params: "token={{st2_token}} protocol={{protocol}}" - hosts: "{{hostname}}" - timeout: 600 - on-success: "test_quickstart_remote_script" - - - name: "test_quickstart_remote_script" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_quickstart_remote_script" - token: "{{st2_token}}" - action: "tests.test_quickstart_remote_script_actions" - params: "token={{st2_token}} protocol={{protocol}}" - hosts: "{{hostname}}" - timeout: 600 - on-success: "test_quickstart_passive_sensor" - - - name: "test_quickstart_passive_sensor" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_quickstart_passive_sensor" - token: "{{st2_token}}" - action: "tests.test_quickstart_passive_sensor" - params: "token={{st2_token}} protocol={{protocol}}" - hosts: "{{hostname}}" - timeout: 600 - on-success: "test_quickstart_polling_sensor" - - - name: "test_quickstart_polling_sensor" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_quickstart_polling_sensor" - token: "{{st2_token}}" - action: "tests.test_quickstart_polling_sensor" - params: "token={{st2_token}} protocol={{protocol}}" - hosts: "{{hostname}}" - timeout: 600 - on-success: "test_quickstart_python" - - - name: "test_quickstart_python" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_quickstart_python" - token: "{{st2_token}}" - action: "tests.test_quickstart_python_actions" - params: "token={{st2_token}} protocol={{protocol}}" - hosts: "{{hostname}}" - timeout: 600 - on-success: "test_mistral_examples" - - - name: "test_mistral_examples" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_mistral_examples" - token: "{{st2_token}}" - params: "" - action: "examples.mistral_examples" - hosts: "{{hostname}}" - timeout: 600 - on-success: "test_timer_rule" - on-failure: "test_timer_rule" - - - name: "test_timer_rule" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_timer_rule" - token: "{{st2_token}}" - action: "tests.test_timer_rule" - params: "token={{st2_token}} protocol={{protocol}}" - hosts: "{{hostname}}" - timeout: 600 - on-success: "test_windows_runners" - on-failure: "test_windows_runners" - - - name: "test_windows_runners" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "test_windows_runners" - token: "{{st2_token}}" - action: "tests.test_windows_runners" - params: "token={{st2_token}} protocol={{protocol}} windows_host={{windows_host}} windows_username={{windows_username}} windows_password={{windows_password}}" - hosts: "{{hostname}}" - timeout: 600 - on-success: "selenium" - on-failure: "selenium" - - - name: "selenium" - ref: "st2cd.action_run" - params: - env: - ST2_BASE_URL: "{{protocol}}://{{hostname}}" - ST2_AUTH_URL: "{{protocol}}://{{hostname}}:9100" - ST2_API_URL: "{{protocol}}://{{hostname}}:9101" - name: "webui_selenium" - token: "{{st2_token}}" - action: "webui.selenium" - params: "token={{st2_token}} protocol={{protocol}} branch=master repo=https://github.com/StackStorm/st2e2e.git web_host={{hostname}}" - hosts: "{{hostname}}" - timeout: 600 - on-failure: "ignore_selenium_failure" - - - name: "ignore_selenium_failure" - ref: "core.local" - params: - cmd: "echo 'Selenium tests failed, but all other tests were successful. Setting overall status to success'" - - default: "get_st2_token" diff --git a/rules/st2_add_librato_annotation_for_release.yaml b/rules/st2_add_librato_annotation_for_release.yaml deleted file mode 100644 index 2c31ec90..00000000 --- a/rules/st2_add_librato_annotation_for_release.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- - name: "st2_add_librato_annotation_for_release" - description: "Creates librato annotation when a release is created." - enabled: false - trigger: - type: "githubwebhook.github_event" - criteria: - trigger.body.ref: - pattern: "^refs/heads/v(\\d+\\.)(\\d+)$" - type: "matchregex" - trigger.body.repository.full_name: - pattern: "StackStorm/st2" - type: "equals" - action: - ref: "st2cd.st2_add_annotation_for_release" - parameters: - branch: "{{trigger.body.ref | replace('refs/heads/', '')}}" - pack: "st2cd" diff --git a/rules/st2contrib_regenerate_readme.yaml b/rules/st2contrib_regenerate_readme.yaml deleted file mode 100644 index 25f6a7da..00000000 --- a/rules/st2contrib_regenerate_readme.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- - name: "st2contrib_regenerate_readme" - description: "Re-generate README.md on push to master in st2contrib" - enabled: true - trigger: - type: "githubwebhook.github_event" - criteria: - trigger.body.ref: - pattern: "refs/heads/master" - type: "equals" - trigger.body.repository.full_name: - pattern: "StackStorm/st2contrib" - type: "equals" - action: - ref: "st2cd.st2contrib_regenerate_readme" - parameters: - branch: "master" - revision: "{{trigger.body.head_commit.id}}" - author: "{{trigger.body.head_commit.author.username}}" - pack: "st2cd"