From 34117451a368abf5e0f3cdc44baa7705c3d27290 Mon Sep 17 00:00:00 2001 From: Hara Prasad Juvvala Date: Wed, 11 Dec 2024 16:15:26 -0600 Subject: [PATCH 1/7] Self-hosted runner setup --- .../workflows/shared_integration_tests.yaml | 74 +------------------ 1 file changed, 2 insertions(+), 72 deletions(-) diff --git a/.github/workflows/shared_integration_tests.yaml b/.github/workflows/shared_integration_tests.yaml index a4e07268..66d21cd1 100644 --- a/.github/workflows/shared_integration_tests.yaml +++ b/.github/workflows/shared_integration_tests.yaml @@ -89,28 +89,6 @@ jobs: if: ${{ env.SKIP_TESTS != 'true' }} uses: actions/checkout@v4 - # Skip tests when there are only markdown files - - name: Skip integration tests if PR contains only Markdown files - if: ${{ env.SKIP_TESTS != 'true' }} - working-directory: ${{ github.workspace }} - run: | - git fetch -q - FILE_TYPES=$(git show --name-only ${{ env.COMMIT_SHA }} | grep -o '\S\+\.\S\+' | grep -v '@' | awk -F . '{print $NF}' | sort -u) - echo $FILE_TYPES - - # Check if the only file type is markdown - if [[ "$FILE_TYPES" == "md" ]]; then - echo "All files are markdown, skipping step." - echo "SKIP_TESTS=true" >> $GITHUB_ENV - fi - - # Checkout master branch of gen3-code-vigil when another repo is under test - - name: Checkout integration test code - if: ${{ env.SKIP_TESTS != 'true' && github.event.repository.name != 'gen3-code-vigil' }} - uses: actions/checkout@v4 - with: - repository: uc-cdis/gen3-code-vigil - ref: master # gen3-integration-tests run with python 3.9 - name: Set up Python @@ -144,40 +122,6 @@ jobs: poetry show poetry run playwright install chromium - - name: Get commit time - if: ${{ env.SKIP_TESTS != 'true' }} - run: | - commit_time=$(gh api repos/$REPO_FN/commits/$COMMIT_SHA | jq -r '.commit.committer.date') - echo "COMMIT_TIME=$commit_time" >> $GITHUB_ENV - - # TODO: Rely on a database in AWS to make this faster - # Select an unlocked environment - # If an env is specified in a PR label use it, else pick one from the pool - - name: Select CI environment - if: ${{ env.SKIP_TESTS != 'true' }} - id: select_ci_env - run: | - env_label=$(gh api repos/$REPO_FN/pulls/$PR_NUM --jq '.labels | map(select(.name | startswith("jenkins-"))) | .[0].name') - echo "$env_label" - if [[ $env_label != "" && $env_label != null ]]; then - echo "Found PR label $env_label" - poetry run python -m gen3_ci.scripts.select_ci_environment $env_label - else - poetry run python -m gen3_ci.scripts.select_ci_environment - fi - - # TODO: Improve the logic to do differential updates to the env, not roll all services - # Apply the changes to the manifest of the selected CI environment, roll the pods and run usersync - # Generate API keys for test users for the environment - - name: Prepare CI environment - id: prep_ci_env - if: ${{ env.SKIP_TESTS != 'true' && steps.select_ci_env.outcome == 'success' }} - continue-on-error: true # if this fails, we still need to run clean-up steps - run: | - mkdir $HOME/.gen3 - poetry run python -m gen3_ci.scripts.prepare_ci_environment - env: - QUAY_REPO: ${{ inputs.QUAY_REPO }} # This is used for running specific test suites by labeling the PR with the test class # Multiple suites can be executed by adding multiple labels @@ -196,7 +140,7 @@ jobs: continue-on-error: true # if this fails, we still need to run clean-up steps run: | mkdir output - GEN3_INSTANCE_TYPE="ADMINVM_REMOTE" poetry run pytest -n auto -m "${{ inputs.SERVICE_TO_TEST }} and not wip" --alluredir allure-results --no-header --dist loadscope ${{ env.TEST_LABEL }} + GEN3_INSTANCE_TYPE="HELM_LOCAL" poetry run pytest -n auto -m "${{ inputs.SERVICE_TO_TEST }} and not wip" --alluredir allure-results --no-header --dist loadscope ${{ env.TEST_LABEL }} - name: Run tests id: run_tests @@ -204,7 +148,7 @@ jobs: continue-on-error: true # if this fails, we still need to run clean-up steps run: | mkdir output - GEN3_INSTANCE_TYPE="ADMINVM_REMOTE" poetry run pytest -n auto -m "not wip" --alluredir allure-results --no-header --dist loadscope ${{ env.TEST_LABEL }} + GEN3_INSTANCE_TYPE="HELM_LOCAL" poetry run pytest -n auto -m "not wip" --alluredir allure-results --no-header --dist loadscope ${{ env.TEST_LABEL }} - name: Debug logging if: ${{ env.SKIP_TESTS != 'true' }} @@ -280,17 +224,3 @@ jobs: payload-file-path: "./gen3-integration-tests/slack_report.json" env: SLACK_BOT_TOKEN: ${{ secrets.CI_SLACK_BOT_TOKEN }} - - - name: Release CI environment - id: release_ci_env - if: ${{ env.SKIP_TESTS != 'true' && steps.select_ci_env.outcome == 'success' || cancelled() }} - continue-on-error: true # if this fails, we still need to run clean-up steps - run: poetry run python -m gen3_ci.scripts.release_ci_environment - - - name: Mark workflow as failed for unsuccessful test runs - if: ${{ env.SKIP_TESTS != 'true' && steps.run_service_tests.outcome != 'success' && steps.run_tests.outcome != 'success' }} - run: echo "Test run was unsuccessful, marking workflow as failed" && exit 1 - - - name: Stop pending jenkins jobs for cancelled run - if: ${{ env.SKIP_TESTS != 'true' && cancelled() }} - run: poetry run python -m gen3_ci.scripts.clean_up_jenkins From 3c41099f6a0f4ea1e27011d8de3c73de5c5f4348 Mon Sep 17 00:00:00 2001 From: Hara Prasad Juvvala Date: Wed, 11 Dec 2024 16:16:30 -0600 Subject: [PATCH 2/7] runs on self-hosted --- .github/workflows/shared_integration_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shared_integration_tests.yaml b/.github/workflows/shared_integration_tests.yaml index 66d21cd1..104a7a77 100644 --- a/.github/workflows/shared_integration_tests.yaml +++ b/.github/workflows/shared_integration_tests.yaml @@ -44,7 +44,7 @@ concurrency: jobs: integration_tests: - runs-on: ubuntu-latest + runs-on: self-hosted defaults: run: From 8e4ab36bd4193d9a6726fcc6ddf628acf0758bfa Mon Sep 17 00:00:00 2001 From: Hara Prasad Juvvala Date: Wed, 11 Dec 2024 16:19:09 -0600 Subject: [PATCH 3/7] don't install python --- .../workflows/shared_integration_tests.yaml | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/.github/workflows/shared_integration_tests.yaml b/.github/workflows/shared_integration_tests.yaml index 104a7a77..ad02721a 100644 --- a/.github/workflows/shared_integration_tests.yaml +++ b/.github/workflows/shared_integration_tests.yaml @@ -90,26 +90,6 @@ jobs: uses: actions/checkout@v4 - # gen3-integration-tests run with python 3.9 - - name: Set up Python - if: ${{ env.SKIP_TESTS != 'true' }} - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - - name: Set up Go - if: ${{ env.SKIP_TESTS != 'true' }} - uses: actions/setup-go@v5 - with: - go-version: '1.17' - - # allure report generation needs node - - name: Set up node - if: ${{ env.SKIP_TESTS != 'true' }} - uses: actions/setup-node@v4 - with: - node-version: 20 - # Install gen3-integration-tests dependencies # wamerican: data-simulator needs "/usr/share/dict/words" to generate data that isn't random strings - name: Install dependencies From c3b66526c887eeb9c5bcb32e6ffa669f9e1b9989 Mon Sep 17 00:00:00 2001 From: Hara Prasad Juvvala Date: Wed, 11 Dec 2024 16:22:29 -0600 Subject: [PATCH 4/7] remove wamerican --- .github/workflows/shared_integration_tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/shared_integration_tests.yaml b/.github/workflows/shared_integration_tests.yaml index ad02721a..be05c052 100644 --- a/.github/workflows/shared_integration_tests.yaml +++ b/.github/workflows/shared_integration_tests.yaml @@ -95,7 +95,6 @@ jobs: - name: Install dependencies if: ${{ env.SKIP_TESTS != 'true' }} run: | - sudo apt-get install -y --reinstall wamerican python -m pip install --upgrade pip pip install poetry poetry install From 72a9a6e9610938ec7a34f632d4d182239f87a76c Mon Sep 17 00:00:00 2001 From: Hara Prasad Juvvala Date: Wed, 11 Dec 2024 16:23:18 -0600 Subject: [PATCH 5/7] use python3 --- .github/workflows/shared_integration_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/shared_integration_tests.yaml b/.github/workflows/shared_integration_tests.yaml index be05c052..b9403c03 100644 --- a/.github/workflows/shared_integration_tests.yaml +++ b/.github/workflows/shared_integration_tests.yaml @@ -95,7 +95,7 @@ jobs: - name: Install dependencies if: ${{ env.SKIP_TESTS != 'true' }} run: | - python -m pip install --upgrade pip + python3 -m pip install --upgrade pip pip install poetry poetry install poetry show From 96cb3f5da0e1969684ac5d8aa1bf7536dcad4728 Mon Sep 17 00:00:00 2001 From: Hara Prasad Juvvala Date: Wed, 11 Dec 2024 16:43:18 -0600 Subject: [PATCH 6/7] don't skip pls --- .github/workflows/shared_integration_tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/shared_integration_tests.yaml b/.github/workflows/shared_integration_tests.yaml index b9403c03..9f3256b6 100644 --- a/.github/workflows/shared_integration_tests.yaml +++ b/.github/workflows/shared_integration_tests.yaml @@ -106,7 +106,7 @@ jobs: # Multiple suites can be executed by adding multiple labels - name: Get test labels id: get_test_labels - if: ${{ env.SKIP_TESTS != 'true' && steps.prep_ci_env.outcome == 'success' }} + if: ${{ env.SKIP_TESTS != 'true' }} continue-on-error: true # if this fails, we still need to run clean-up steps run: | test_label=$(gh api repos/$REPO_FN/pulls/$PR_NUM --jq '.labels | map(select(.name | startswith("Test"))) | map(.name) | if length > 0 then "-k \"" + join(" or ") + "\"" else "" end') @@ -115,7 +115,7 @@ jobs: - name: Run tests pertaining to specific service id: run_service_tests - if: ${{ env.SKIP_TESTS != 'true' && inputs.SERVICE_TO_TEST && steps.prep_ci_env.outcome == 'success' }} + if: ${{ env.SKIP_TESTS != 'true' && inputs.SERVICE_TO_TEST }} continue-on-error: true # if this fails, we still need to run clean-up steps run: | mkdir output @@ -123,7 +123,7 @@ jobs: - name: Run tests id: run_tests - if: ${{ env.SKIP_TESTS != 'true' && !inputs.SERVICE_TO_TEST && steps.prep_ci_env.outcome == 'success' }} + if: ${{ env.SKIP_TESTS != 'true' && !inputs.SERVICE_TO_TEST }} continue-on-error: true # if this fails, we still need to run clean-up steps run: | mkdir output From 17b5837f1aa339ec16a2712765b5843f6eeaf999 Mon Sep 17 00:00:00 2001 From: Hara Prasad Juvvala Date: Wed, 11 Dec 2024 16:55:28 -0600 Subject: [PATCH 7/7] set hostname --- .github/workflows/shared_integration_tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/shared_integration_tests.yaml b/.github/workflows/shared_integration_tests.yaml index 9f3256b6..9a35955c 100644 --- a/.github/workflows/shared_integration_tests.yaml +++ b/.github/workflows/shared_integration_tests.yaml @@ -68,6 +68,7 @@ jobs: CI_TEST_RAS_PASSWORD: ${{ secrets.CI_TEST_RAS_PASSWORD }} CI_TEST_RAS_2_USERID: ${{ secrets.CI_TEST_RAS_2_USERID }} CI_TEST_RAS_2_PASSWORD: ${{ secrets.CI_TEST_RAS_2_PASSWORD }} + HOSTNAME: "hara.dev.planx-pla.net" steps: # # Enable step debugging. Uncomment this to debug pipeline issues