From 49368c746f01698839cc6b84e37009f21ff62154 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Fri, 20 Nov 2020 15:19:28 +0000 Subject: [PATCH] Improve env check (#6361) * improve env check * fix * wrong fit * log --- .travis.yml | 19 ++++++++++++++----- scripts/ci/check-env/check-cs-env.sh | 9 +++++++++ scripts/ci/check-env/check-ps-cloud-env.sh | 9 +++++++++ scripts/ci/check-env/check-ps-env.sh | 9 +++++++++ scripts/travis/e2e/content-services-e2e.sh | 2 -- scripts/travis/e2e/core-e2e.sh | 2 -- .../travis/e2e/process-services-cloud-e2e.sh | 8 -------- scripts/travis/e2e/process-services-e2e.sh | 2 -- scripts/travis/e2e/search-e2e.sh | 1 - 9 files changed, 41 insertions(+), 20 deletions(-) create mode 100755 scripts/ci/check-env/check-cs-env.sh create mode 100755 scripts/ci/check-env/check-ps-cloud-env.sh create mode 100755 scripts/ci/check-env/check-ps-env.sh diff --git a/.travis.yml b/.travis.yml index d90ba5572b..0266262183 100644 --- a/.travis.yml +++ b/.travis.yml @@ -90,31 +90,40 @@ jobs: - stage: e2e Test name: core - before_script: ./scripts/ci/job_hooks/before_e2e.sh + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh + - ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1 script: ./scripts/travis/e2e/core-e2e.sh after_script: ./scripts/ci/job_hooks/after_e2e.sh - stage: e2e Test name: content - before_script: ./scripts/ci/job_hooks/before_e2e.sh + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh + - ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1 script: ./scripts/travis/e2e/content-services-e2e.sh after_script: ./scripts/ci/job_hooks/after_e2e.sh - stage: e2e Test name: search - before_script: ./scripts/ci/job_hooks/before_e2e.sh + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh + - ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1 script: ./scripts/travis/e2e/search-e2e.sh after_script: ./scripts/ci/job_hooks/after_e2e.sh - stage: e2e Test name: process - before_script: ./scripts/ci/job_hooks/before_e2e.sh + before_script: ./scripts/ci/job_hooks/before_e2e.sh || travis_terminate 1 script: ./scripts/travis/e2e/process-services-e2e.sh after_script: ./scripts/ci/job_hooks/after_e2e.sh - stage: e2e Test name: process Cloud - before_script: ./scripts/ci/job_hooks/before_e2e.sh + before_script: + - ./scripts/ci/job_hooks/before_e2e.sh + - ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1 + - ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1 script: ./scripts/travis/e2e/process-services-cloud-e2e.sh after_script: ./scripts/ci/job_hooks/after_e2e.sh diff --git a/scripts/ci/check-env/check-cs-env.sh b/scripts/ci/check-env/check-cs-env.sh new file mode 100755 index 0000000000..6b0ebfc940 --- /dev/null +++ b/scripts/ci/check-env/check-cs-env.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +cd $DIR/../../../ + +echo "====== Check content UP =====" + +./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 diff --git a/scripts/ci/check-env/check-ps-cloud-env.sh b/scripts/ci/check-env/check-ps-cloud-env.sh new file mode 100755 index 0000000000..a75c9bde0b --- /dev/null +++ b/scripts/ci/check-env/check-ps-cloud-env.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +cd $DIR/../../../ + +echo "====== Check PS Cloud UP =====" + +./node_modules/@alfresco/adf-cli/bin/adf-cli init-aae-env --host "$E2E_HOST" --oauth "$HOST_SSO" --modelerUsername "$E2E_MODELER_USERNAME" --modelerPassword "$E2E_MODELER_PASSWORD" --devopsUsername "$E2E_DEVOPS_USERNAME" --devopsPassword "$E2E_DEVOPS_PASSWORD" --clientId 'alfresco' || exit 1 diff --git a/scripts/ci/check-env/check-ps-env.sh b/scripts/ci/check-env/check-ps-env.sh new file mode 100755 index 0000000000..42e8207634 --- /dev/null +++ b/scripts/ci/check-env/check-ps-env.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +cd $DIR/../../../ + +echo "====== Check PS UP =====" + +#./node_modules/@alfresco/adf-cli/bin/adf-cli check-ps-env --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 TODO chanvge login check SSO diff --git a/scripts/travis/e2e/content-services-e2e.sh b/scripts/travis/e2e/content-services-e2e.sh index dd486c22db..8bac93a815 100755 --- a/scripts/travis/e2e/content-services-e2e.sh +++ b/scripts/travis/e2e/content-services-e2e.sh @@ -19,8 +19,6 @@ if [ "${TRAVIS_EVENT_TYPE}" == "pull_request" ]; then echo "Affected e2e ${AFFECTED_E2E}" fi; -./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 - #-b is needed to run the Folder upload test that are not workin in Headless chrome RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" --use-dist || exit 1) if [[ $AFFECTED_LIBS =~ "testing" || $AFFECTED_LIBS =~ "$CONTEXT_ENV" || "${TRAVIS_EVENT_TYPE}" == "push" || "${TRAVIS_EVENT_TYPE}" == "api" ]]; then diff --git a/scripts/travis/e2e/core-e2e.sh b/scripts/travis/e2e/core-e2e.sh index 26b581270e..11baecdcd8 100755 --- a/scripts/travis/e2e/core-e2e.sh +++ b/scripts/travis/e2e/core-e2e.sh @@ -20,8 +20,6 @@ if [ "${TRAVIS_EVENT_TYPE}" == "pull_request" ]; then echo "Affected e2e ${AFFECTED_E2E}" fi; -#./node_modules/@alfresco/adf-cli/bin/adf-cli check-ps-env --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 TODO chanvge login check SSO -./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" --use-dist || exit 1) if [[ $AFFECTED_LIBS =~ "testing" || $AFFECTED_LIBS =~ "$CONTEXT_ENV" || "${TRAVIS_EVENT_TYPE}" == "push" || "${TRAVIS_EVENT_TYPE}" == "api" ]]; then diff --git a/scripts/travis/e2e/process-services-cloud-e2e.sh b/scripts/travis/e2e/process-services-cloud-e2e.sh index 62dc4d00f7..05ad2f25a2 100755 --- a/scripts/travis/e2e/process-services-cloud-e2e.sh +++ b/scripts/travis/e2e/process-services-cloud-e2e.sh @@ -21,19 +21,11 @@ fi; RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" -host_sso "$HOST_SSO" -identity_admin_email "$E2E_ADMIN_EMAIL_IDENTITY" -identity_admin_password "$E2E_ADMIN_PASSWORD_IDENTITY" -prefix $TRAVIS_BUILD_NUMBER --use-dist ) -check_env(){ - ./node_modules/@alfresco/adf-cli/bin/adf-cli init-aae-env --host "$E2E_HOST" --oauth "$HOST_SSO" --modelerUsername "$E2E_MODELER_USERNAME" --modelerPassword "$E2E_MODELER_PASSWORD" --devopsUsername "$E2E_DEVOPS_USERNAME" --devopsPassword "$E2E_DEVOPS_PASSWORD" --clientId 'alfresco' || exit 1 - - ./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host "$E2E_HOST" -u "$E2E_ADMIN_EMAIL_IDENTITY" -p "$E2E_ADMIN_PASSWORD_IDENTITY" || exit 1 -} - if [[ $AFFECTED_LIBS =~ "testing" || $AFFECTED_LIBS =~ "$CONTEXT_ENV" || "${TRAVIS_EVENT_TYPE}" == "push" || "${TRAVIS_EVENT_TYPE}" == "api" ]]; then echo "Run all e2e $CONTEXT_ENV" - check_env; $RUN_E2E --folder $CONTEXT_ENV else if [[ $AFFECTED_E2E == "e2e/$CONTEXT_ENV" ]]; then echo "Run affected e2e" - check_env; HEAD_SHA_BRANCH="$(git merge-base origin/$TRAVIS_BRANCH HEAD)" LIST_SPECS="$(git diff --name-only $HEAD_SHA_BRANCH HEAD | grep "^e2e/$CONTEXT_ENV/" | paste -sd , -)" diff --git a/scripts/travis/e2e/process-services-e2e.sh b/scripts/travis/e2e/process-services-e2e.sh index a41b2529df..be61b92412 100755 --- a/scripts/travis/e2e/process-services-e2e.sh +++ b/scripts/travis/e2e/process-services-e2e.sh @@ -19,8 +19,6 @@ if [ "${TRAVIS_EVENT_TYPE}" == "pull_request" ]; then echo "Affected e2e ${AFFECTED_E2E}" fi; -#./node_modules/@alfresco/adf-cli/bin/adf-cli check-ps-env --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 TODO chanvge login check SSO - RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -host_sso "$HOST_SSO" -identity_admin_email "$E2E_ADMIN_EMAIL_IDENTITY" -identity_admin_password "$E2E_ADMIN_PASSWORD_IDENTITY" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" --use-dist || exit 1) if [[ $AFFECTED_LIBS =~ "testing" || $AFFECTED_LIBS =~ "$CONTEXT_ENV" || "${TRAVIS_EVENT_TYPE}" == "push" || "${TRAVIS_EVENT_TYPE}" == "api" ]]; then diff --git a/scripts/travis/e2e/search-e2e.sh b/scripts/travis/e2e/search-e2e.sh index 5700a38f9e..dc08b3cbc8 100755 --- a/scripts/travis/e2e/search-e2e.sh +++ b/scripts/travis/e2e/search-e2e.sh @@ -19,7 +19,6 @@ if [ "${TRAVIS_EVENT_TYPE}" == "pull_request" ];then echo "Affected e2e ${AFFECTED_E2E}" fi; -./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 RUN_E2E=$(echo ./scripts/test-e2e-lib.sh -host http://localhost:4200 -proxy "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" --use-dist || exit 1) if [[ $AFFECTED_LIBS =~ "testing" || $AFFECTED_LIBS =~ "content-services" || "${TRAVIS_EVENT_TYPE}" == "push" || "${TRAVIS_EVENT_TYPE}" == "api" ]];