From 2ba31506c4c37c25473b419574fe2cbe31d0ceb2 Mon Sep 17 00:00:00 2001 From: Vadym Yarosh Date: Mon, 19 Feb 2024 15:23:09 +0100 Subject: [PATCH] PMM-12296 added all jobs (#655) * PMM-12296 added all jobs * PMM-12296 switched version getter --- .github/workflows/e2e-tests.yml | 60 +++ .../e2e-upgrade-tests-matrix-full.yml | 130 ++++++ .../workflows/e2e-upgrade-tests-matrix.yml | 122 +++++ .github/workflows/e2e-upgrade-tests.yml | 153 ++++++ .github/workflows/package-test-fb.yml | 95 ++++ .../workflows/package-test-matrix-full.yml | 140 ++++++ .github/workflows/package-test-matrix.yml | 63 +++ .github/workflows/package-test-single.yml | 93 ++++ .github/workflows/pmm-version-getter.yml | 106 +++++ .github/workflows/portal-tests-matrix.yml | 33 ++ .../workflows/runner-cli-integration-test.yml | 289 ++++++++++++ .../workflows/runner-e2e-tests-codeceptjs.yml | 163 +++++++ .../workflows/runner-e2e-tests-playwright.yml | 207 +++++++++ .github/workflows/runner-e2e-tests-podman.yml | 239 ++++++++++ .../workflows/runner-e2e-upgrade-tests.yml | 435 ++++++++++++++++++ .github/workflows/runner-package-test.yml | 307 ++++++++++++ 16 files changed, 2635 insertions(+) create mode 100644 .github/workflows/e2e-tests.yml create mode 100644 .github/workflows/e2e-upgrade-tests-matrix-full.yml create mode 100644 .github/workflows/e2e-upgrade-tests-matrix.yml create mode 100644 .github/workflows/e2e-upgrade-tests.yml create mode 100644 .github/workflows/package-test-fb.yml create mode 100644 .github/workflows/package-test-matrix-full.yml create mode 100644 .github/workflows/package-test-matrix.yml create mode 100644 .github/workflows/package-test-single.yml create mode 100644 .github/workflows/pmm-version-getter.yml create mode 100644 .github/workflows/portal-tests-matrix.yml create mode 100644 .github/workflows/runner-cli-integration-test.yml create mode 100644 .github/workflows/runner-e2e-tests-codeceptjs.yml create mode 100644 .github/workflows/runner-e2e-tests-playwright.yml create mode 100644 .github/workflows/runner-e2e-tests-podman.yml create mode 100644 .github/workflows/runner-e2e-upgrade-tests.yml create mode 100644 .github/workflows/runner-package-test.yml diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml new file mode 100644 index 00000000..376845c7 --- /dev/null +++ b/.github/workflows/e2e-tests.yml @@ -0,0 +1,60 @@ +name: PMM e2e Tests(Playwright) + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + inputs: + pmm_ui_tests_branch: + description: 'pmm-ui-tests repository branch' + default: 'main' + required: true + pmm_qa_branch: + description: 'pmm-qa repository branch(for setup)' + default: 'main' + required: true + pmm_server_version: + description: 'PMM Server docker image' + default: 'perconalab/pmm-server:dev-latest' + required: true + pmm_client_version: + description: 'PMM Client version to test (dev-latest|pmm2-latest|pmm2-rc|x.xx.x)' + default: 'dev-latest' + required: true + +jobs: + rbac: + name: RBAC + uses: ./.github/workflows/runner-e2e-tests-playwright.yml + secrets: inherit + with: + pmm_ui_tests_branch: ${{ github.event.inputs.pmm_ui_tests_branch || github.head_ref || 'main '}} + pmm_test_flag: '@rbac' + pmm_server_version: ${{ github.event.inputs.pmm_server_version || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ github.event.inputs.pmm_client_version || 'dev-latest' }} + pmm_clients: '--addclient=ps,1 --addclient=pdpgsql,1' + pmm_qa_branch: ${{ github.event.inputs.pmm_qa_branch || 'main' }} + + portal: + name: Portal + uses: ./.github/workflows/runner-e2e-tests-playwright.yml + secrets: inherit + with: + pmm_ui_tests_branch: ${{ github.event.inputs.pmm_ui_tests_branch || github.head_ref || 'main '}} + pmm_test_flag: '@portal' + pmm_server_version: ${{ github.event.inputs.pmm_server_version || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ github.event.inputs.pmm_client_version || 'dev-latest' }} + pmm_clients: '' + pmm_qa_branch: ${{ github.event.inputs.pmm_qa_branch || 'main' }} + + inventory: + name: Inventory + uses: ./.github/workflows/runner-e2e-tests-playwright.yml + secrets: inherit + with: + pmm_ui_tests_branch: ${{ github.event.inputs.pmm_ui_tests_branch || github.head_ref || 'main '}} + pmm_test_flag: '@inventory' + pmm_server_version: ${{ github.event.inputs.pmm_server_version || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ github.event.inputs.pmm_client_version || 'dev-latest' }} + pmm_clients: '--addclient=modb,1 --addclient=ps,1 --addclient=pdpgsql,1' + pmm_qa_branch: ${{ github.event.inputs.pmm_qa_branch || 'main' }} diff --git a/.github/workflows/e2e-upgrade-tests-matrix-full.yml b/.github/workflows/e2e-upgrade-tests-matrix-full.yml new file mode 100644 index 00000000..f1e26e77 --- /dev/null +++ b/.github/workflows/e2e-upgrade-tests-matrix-full.yml @@ -0,0 +1,130 @@ +name: "PMM Upgrade Full Matrix (e2e tests)" + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + inputs: + pmm_ui_tests_branch: + description: 'pmm-ui-tests repository branch' + default: 'main' + required: true + pmm_qa_branch: + description: 'pmm-qa repository branch(for setup)' + default: 'main' + required: true + repository: + description: 'Upgrade to:' + required: true + default: 'dev-latest' + type: choice + options: + - release + - release candidate + - dev-latest + versions_range: + description: 'Last versions range:' + default: 5 + required: true + +jobs: + get_versions: + name: Get versions + uses: ./.github/workflows/pmm-version-getter.yml + with: + repository: ${{ inputs.repository || 'dev-latest'}} + matrix_range: ${{ inputs.versions_range || '5' }} + + configuration: + name: 'Configuration / Settings' + uses: ./.github/workflows/runner-e2e-upgrade-tests.yml + secrets: inherit + needs: get_versions + strategy: + fail-fast: false + matrix: + old_version: ${{ fromJSON(needs.get_versions.outputs.version_matrix) }} + upgrade_type: ["UI way", "Docker way", "Podman way"] + with: + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pre_upgrade_tests: '@config-pre-upgrade' + post_upgrade_tests: '@config-post-upgrade' + pmm_server_start_version: ${{ matrix.old_version }} + pmm_client_start_version: ${{ matrix.old_version }} + upgrade_type: ${{ matrix.upgrade_type }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + services_list: '' + repository: ${{ inputs.repository || 'dev-latest'}} + version_string_from: ${{needs.get_versions.outputs.start_version}} + version_string_to: ${{needs.get_versions.outputs.finish_version}} + + rbac: + name: "RBAC / User Roles" + uses: ./.github/workflows/runner-e2e-upgrade-tests.yml + secrets: inherit + needs: get_versions + strategy: + fail-fast: false + matrix: + old_version: ${{ fromJSON(needs.get_versions.outputs.version_matrix) }} + upgrade_type: ["UI way", "Docker way", "Podman way"] + with: + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pre_upgrade_tests: '@rbac-pre-upgrade' + post_upgrade_tests: '@rbac-post-upgrade' + pmm_server_start_version: ${{ matrix.old_version }} + pmm_client_start_version: ${{ matrix.old_version }} + upgrade_type: ${{ matrix.upgrade_type }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + services_list: '--addclient=ps,1 --addclient=pdpgsql,1' + repository: ${{ inputs.repository || 'dev-latest'}} + version_string_from: ${{needs.get_versions.outputs.start_version}} + version_string_to: ${{needs.get_versions.outputs.finish_version}} + +# portal: +# ### '/' in the job name is for good sub-jobs grouping +# name: Portal / Portal +# uses: ./.github/workflows/runner-e2e-upgrade-tests.yml +# secrets: inherit +# needs: get_versions +# strategy: +# fail-fast: false +# matrix: +# old_version: ${{ fromJSON(needs.get_versions.outputs.version_matrix) }} +# upgrade_type: [ "UI way", "Docker way" ] +# with: +# pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} +# pre_upgrade_tests: '@pre-pmm-portal-upgrade' +# post_upgrade_tests: '@post-pmm-portal-upgrade' +# pmm_server_start_version: ${{ matrix.old_version }} +# pmm_client_start_version: ${{ matrix.old_version }} +# upgrade_type: ${{ matrix.upgrade_type }} +# pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} +# services_list: '' +# repository: ${{ inputs.repository || 'dev-latest'}} +# version_string_from: ${{needs.get_versions.outputs.start_version}} +# version_string_to: ${{needs.get_versions.outputs.finish_version}} + +# inventory: +# # TODO: add / in the job names for good sub-jobs grouping +# name: 'Inventory' +# uses: ./.github/workflows/runner-e2e-upgrade-tests.yml +# secrets: inherit +# needs: get_versions +# strategy: +# fail-fast: false +# matrix: +# old_version: ${{ fromJSON(needs.get_versions.outputs.version_matrix) }} +# upgrade_type: [ "UI way", "Docker way" ] +# with: +# pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch }} +# pre_upgrade_tests: '@inventory-pre-upgrade' +# post_upgrade_tests: '@inventory-post-upgrade' +# pmm_server_start_version: ${{ inputs.pmm_server_start_version }} +# pmm_client_start_version: ${{ inputs.pmm_client_start_version }} +# upgrade_type: ${{ inputs.upgrade_type }} +# pmm_qa_branch: ${{ inputs.pmm_qa_branch }} +# services_list: '--addclient=modb,1' +# repository: ${{ inputs.repository }} +# version_string_from: ${{needs.get_versions.outputs.start_version}} +# version_string_to: ${{needs.get_versions.outputs.finish_version}} diff --git a/.github/workflows/e2e-upgrade-tests-matrix.yml b/.github/workflows/e2e-upgrade-tests-matrix.yml new file mode 100644 index 00000000..584b1b8b --- /dev/null +++ b/.github/workflows/e2e-upgrade-tests-matrix.yml @@ -0,0 +1,122 @@ +name: "PMM Upgrade Matrix (e2e tests)" + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + inputs: + pmm_ui_tests_branch: + description: 'pmm-ui-tests repository branch' + default: 'main' + required: true + pmm_qa_branch: + description: 'pmm-qa repository branch(for setup)' + default: 'main' + required: true + upgrade_type: + description: 'Upgrade way:' + required: true + default: 'Docker way' + type: choice + options: + - UI way + - Docker way + - Podman way + repository: + description: 'Upgrade to:' + required: true + default: 'dev-latest' + type: choice + options: + - release + - release candidate + - dev-latest + +jobs: + get_versions: + name: Get versions + uses: ./.github/workflows/pmm-version-getter.yml + with: + repository: ${{ inputs.repository || 'dev-latest'}} + matrix_range: 10 + + configuration: + name: 'Configuration / Settings' + uses: ./.github/workflows/runner-e2e-upgrade-tests.yml + secrets: inherit + needs: get_versions + strategy: + fail-fast: false + matrix: + old_version: ${{ fromJSON(needs.get_versions.outputs.version_matrix) }} + with: + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pre_upgrade_tests: '@config-pre-upgrade' + post_upgrade_tests: '@config-post-upgrade' + pmm_server_start_version: ${{ matrix.old_version }} + pmm_client_start_version: ${{ matrix.old_version }} + upgrade_type: ${{ inputs.upgrade_type || 'Docker way' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + services_list: '' + repository: ${{ inputs.repository || 'dev-latest'}} + version_string_from: ${{needs.get_versions.outputs.start_version}} + version_string_to: ${{needs.get_versions.outputs.finish_version}} + + rbac: + name: "RBAC / User Roles" + uses: ./.github/workflows/runner-e2e-upgrade-tests.yml + secrets: inherit + needs: get_versions + strategy: + fail-fast: false + matrix: + old_version: ${{ fromJSON(needs.get_versions.outputs.version_matrix) }} + with: + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pre_upgrade_tests: '@rbac-pre-upgrade' + post_upgrade_tests: '@rbac-post-upgrade' + pmm_server_start_version: ${{ matrix.old_version }} + pmm_client_start_version: ${{ matrix.old_version }} + upgrade_type: ${{ inputs.upgrade_type || 'Docker way' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + services_list: '--addclient=ps,1 --addclient=pdpgsql,1' + repository: ${{ inputs.repository || 'dev-latest'}} + version_string_from: ${{needs.get_versions.outputs.start_version}} + version_string_to: ${{needs.get_versions.outputs.finish_version}} + +# TODO: add / in the job names for good sub-jobs grouping +# portal: +# name: Portal +# uses: ./.github/workflows/runner-e2e-upgrade-tests.yml +# secrets: inherit +# needs: get_versions +# with: +# pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch }} +# pre_upgrade_tests: '@pre-pmm-portal-upgrade' +# post_upgrade_tests: '@post-pmm-portal-upgrade' +# pmm_server_start_version: ${{ inputs.pmm_server_start_version }} +# pmm_client_start_version: ${{ inputs.pmm_client_start_version }} +# upgrade_type: ${{ inputs.upgrade_type || 'Docker way' }} +# pmm_qa_branch: ${{ inputs.pmm_qa_branch }} +# services_list: '' +# repository: ${{ inputs.repository }} +# version_string_from: ${{needs.get_versions.outputs.start_version}} +# version_string_to: ${{needs.get_versions.outputs.finish_version}} +# +# inventory: +# name: 'Inventory' +# uses: ./.github/workflows/runner-e2e-upgrade-tests.yml +# secrets: inherit +# needs: get_versions +# with: +# pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch }} +# pre_upgrade_tests: '@inventory-pre-upgrade' +# post_upgrade_tests: '@inventory-post-upgrade' +# pmm_server_start_version: ${{ inputs.pmm_server_start_version }} +# pmm_client_start_version: ${{ inputs.pmm_client_start_version }} +# upgrade_type: ${{ inputs.upgrade_type || 'Docker way' }} +# pmm_qa_branch: ${{ inputs.pmm_qa_branch }} +# services_list: '--addclient=modb,1' +# repository: ${{ inputs.repository }} +# version_string_from: ${{needs.get_versions.outputs.start_version}} +# version_string_to: ${{needs.get_versions.outputs.finish_version}} diff --git a/.github/workflows/e2e-upgrade-tests.yml b/.github/workflows/e2e-upgrade-tests.yml new file mode 100644 index 00000000..04c82f04 --- /dev/null +++ b/.github/workflows/e2e-upgrade-tests.yml @@ -0,0 +1,153 @@ +name: "PMM Upgrade (e2e Tests)" + +on: + workflow_dispatch: + inputs: + pmm_ui_tests_branch: + description: 'pmm-ui-tests repository branch' + default: 'main' + required: true + pmm_qa_branch: + description: 'pmm-qa repository branch(for setup)' + default: 'main' + required: true + pmm_server_start_version: + description: 'PMM Server version to upgrade (latest|dev-latest|x.xx.x|x.xx.x-rc)' + default: 'latest' + required: true + pmm_client_start_version: + description: 'PMM Client version to upgrade from (dev-latest|pmm2-latest|pmm2-rc|x.xx.x)' + default: 'pmm2-latest' + required: true + upgrade_type: + description: 'Upgrade way:' + required: true + default: 'UI way' + type: choice + options: + - UI way + - Docker way + - Podman way + repository: + description: 'Upgrade to:' + required: true + default: 'dev-latest' + type: choice + options: + - release + - release candidate + - dev-latest + + workflow_call: + inputs: + pmm_ui_tests_branch: + description: 'pmm-ui-tests repository branch' + default: 'main' + type: string + required: true + pmm_qa_branch: + description: 'pmm-qa repository branch(for setup)' + default: 'main' + type: string + required: true + pmm_server_start_version: + description: 'PMM Server version to upgrade (latest|dev-latest|x.xx.x|x.xx.x-rc)' + default: 'latest' + type: string + required: true + pmm_client_start_version: + description: 'PMM Client version to upgrade from (dev-latest|pmm2-latest|pmm2-rc|x.xx.x)' + default: 'pmm2-latest' + type: string + required: true + upgrade_type: + description: 'Upgrade way:' + required: true + default: 'UI way' + type: string + repository: + description: 'Upgrade to:' + required: true + default: 'dev-latest' + type: string + +jobs: + get_versions: + name: Get versions + uses: ./.github/workflows/pmm-version-getter.yml + with: + pmm_server_start_version: ${{ inputs.pmm_server_start_version || 'latest'}} + repository: ${{ inputs.repository || 'dev-latest'}} + matrix_range: 10 + + configuration: + name: 'Configuration / Settings' + uses: ./.github/workflows/runner-e2e-upgrade-tests.yml + secrets: inherit + needs: get_versions + with: + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch }} + pre_upgrade_tests: '@config-pre-upgrade' + post_upgrade_tests: '@config-post-upgrade' + pmm_server_start_version: ${{ inputs.pmm_server_start_version }} + pmm_client_start_version: ${{ inputs.pmm_client_start_version }} + upgrade_type: ${{ inputs.upgrade_type }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch }} + services_list: '' + repository: ${{ inputs.repository }} + version_string_from: ${{needs.get_versions.outputs.start_version}} + version_string_to: ${{needs.get_versions.outputs.finish_version}} + + rbac: + name: RBAC + uses: ./.github/workflows/runner-e2e-upgrade-tests.yml + secrets: inherit + needs: get_versions + with: + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch }} + pre_upgrade_tests: '@rbac-pre-upgrade' + post_upgrade_tests: '@rbac-post-upgrade' + pmm_server_start_version: ${{ inputs.pmm_server_start_version }} + pmm_client_start_version: ${{ inputs.pmm_client_start_version }} + upgrade_type: ${{ inputs.upgrade_type }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch }} + services_list: '--addclient=ps,1 --addclient=pdpgsql,1' + repository: ${{ inputs.repository }} + version_string_from: ${{needs.get_versions.outputs.start_version}} + version_string_to: ${{needs.get_versions.outputs.finish_version}} + +# portal: +# name: Portal / Portal +# uses: ./.github/workflows/runner-e2e-upgrade-tests.yml +# secrets: inherit +# needs: get_versions +# with: +# pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch }} +# pre_upgrade_tests: '@pre-pmm-portal-upgrade' +# post_upgrade_tests: '@post-pmm-portal-upgrade' +# pmm_server_start_version: ${{ inputs.pmm_server_start_version }} +# pmm_client_start_version: ${{ inputs.pmm_client_start_version }} +# upgrade_type: ${{ inputs.upgrade_type }} +# pmm_qa_branch: ${{ inputs.pmm_qa_branch }} +# services_list: '' +# repository: ${{ inputs.repository }} +# version_string_from: ${{needs.get_versions.outputs.start_version}} +# version_string_to: ${{needs.get_versions.outputs.finish_version}} +# +# inventory: +# name: 'Inventory' +# uses: ./.github/workflows/runner-e2e-upgrade-tests.yml +# secrets: inherit +# needs: get_versions +# with: +# pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch }} +# pre_upgrade_tests: '@inventory-pre-upgrade' +# post_upgrade_tests: '@inventory-post-upgrade' +# pmm_server_start_version: ${{ inputs.pmm_server_start_version }} +# pmm_client_start_version: ${{ inputs.pmm_client_start_version }} +# upgrade_type: ${{ inputs.upgrade_type }} +# pmm_qa_branch: ${{ inputs.pmm_qa_branch }} +# services_list: '--addclient=modb,1' +# repository: ${{ inputs.repository }} +# version_string_from: ${{needs.get_versions.outputs.start_version}} +# version_string_to: ${{needs.get_versions.outputs.finish_version}} diff --git a/.github/workflows/package-test-fb.yml b/.github/workflows/package-test-fb.yml new file mode 100644 index 00000000..650121c5 --- /dev/null +++ b/.github/workflows/package-test-fb.yml @@ -0,0 +1,95 @@ +--- +name: Package Test FB + +on: + workflow_dispatch: + inputs: + package_testing_branch: + description: 'Target branch for package-testing repository' + type: string + default: 'master' + required: true + pmm_server_image: + description: "pmm-server docker image" + required: true + type: string + default: "perconalab/pmm-server:dev-latest" + pmm_client_tarball: + description: "PMM Client tarball link or FB-code" + type: string + required: true + playbook: + description: 'Select test to run:' + default: 'pmm2-client_integration' + required: true + type: choice + options: + - pmm2-client_custom_path + - pmm2-client_integration_custom_path + - pmm2-client_integration_custom_port + - pmm2-client_integration_upgrade_custom_path + metrics_mode: + description: 'Select the Metrics Mode for PMM Client:' + required: true + default: 'auto' + type: choice + options: + - auto + - push + - pull + + workflow_call: + inputs: + package_testing_branch: + description: 'Target branch for package-testing repository' + type: string + default: 'master' + required: false + pmm_server_image: + description: "pmm-server docker image" + required: true + type: string + default: "perconalab/pmm-server:dev-latest" + pmm_client_tarball: + description: "PMM Client tarball link or FB-code" + type: string + required: true + playbook: + description: 'Select test to run:' + default: 'pmm2-client_integration' + required: true + type: string + metrics_mode: + description: 'Select the Metrics Mode for PMM Client:' + default: 'auto' + type: string + test_name: + description: 'Name of the test to pretty display in checks list' + type: string + +jobs: + get_versions: + name: Get versions + uses: ./.github/workflows/pmm-version-getter.yml + with: + repository: 'dev-latest' + + fb_test: + name: ${{ inputs.playbook }} + uses: ./.github/workflows/runner-package-test.yml + secrets: inherit + needs: get_versions + strategy: + fail-fast: false + matrix: + os: ${{ fromJSON(needs.get_versions.outputs.pt_os) }} + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + pmm_server_image: ${{ inputs.pmm_server_image }} + pmm_client_tarball: ${{ inputs.pmm_client_tarball == 'dev-latest' && needs.get_versions.outputs.finish_version || inputs.pmm_client_tarball }} + expected_version: ${{needs.get_versions.outputs.finish_version}} + repository: 'dev-latest' + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: ${{ inputs.playbook || 'pmm2-client_integration_custom_path' }} + test_name: ${{ inputs.test_name > '' && format('{0} {1}', inputs.test_name, matrix.os) || matrix.os }} + os: ${{ matrix.os }} diff --git a/.github/workflows/package-test-matrix-full.yml b/.github/workflows/package-test-matrix-full.yml new file mode 100644 index 00000000..b9bc2bfd --- /dev/null +++ b/.github/workflows/package-test-matrix-full.yml @@ -0,0 +1,140 @@ +--- +name: Package Test Matrix(full) + +on: + workflow_dispatch: + inputs: + package_testing_branch: + description: 'Target branch for package-testing repository' + type: string + default: 'master' + required: true + repository: + description: 'Select Repo for Client:' + required: true + default: 'dev-latest' + type: choice + options: + - release + - release candidate + - dev-latest + metrics_mode: + description: 'Select the Metrics Mode for PMM Client:' + required: true + default: 'auto' + type: choice + options: + - auto + - push + - pull + +jobs: + c_test: + name: "Package Install (basic)" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration" + + i_test: + name: "Package Install" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration" + + auth_config_test: + name: "Package Install (auth config)" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration_auth_config" + + auth_register_test: + name: "Package Install (auth register)" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration_auth_register" + + cu_test: + name: "Package Upgrade (basic)" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_upgrade" + + iu_test: + name: "Package Upgrade" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration_upgrade" + + port_u_test: + name: "Package Upgrade: custom port" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration_upgrade_custom_port" + + tb_test: + name: "Tarball Install (basic)" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_custom_path" + + tbi_test: + name: "Tarball Install (custom path)" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration_custom_path" + + port_test: + name: "Tarball Install (custom port)" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration_custom_port" + + tu_test: + name: "Tarball Upgrade (custom path)" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration_upgrade_custom_path" diff --git a/.github/workflows/package-test-matrix.yml b/.github/workflows/package-test-matrix.yml new file mode 100644 index 00000000..fb72feef --- /dev/null +++ b/.github/workflows/package-test-matrix.yml @@ -0,0 +1,63 @@ +--- +name: Package Test Matrix + +on: + schedule: + - cron: '0 0 * * *' + + workflow_dispatch: + inputs: + package_testing_branch: + description: 'Target branch for package-testing repository' + type: string + default: 'master' + required: true + repository: + description: 'Select Repo for Client:' + required: true + default: 'dev-latest' + type: choice + options: + - release + - release candidate + - dev-latest + metrics_mode: + description: 'Select the Metrics Mode for PMM Client:' + required: true + default: 'auto' + type: choice + options: + - auto + - push + - pull + +jobs: + i_test: + name: "Package Install" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration" + + u_test: + name: "Package Upgrade" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration_upgrade" + + t_test: + name: "Tarball Upgrade (custom path)" + uses: ./.github/workflows/package-test-single.yml + secrets: inherit + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: "pmm2-client_integration_upgrade_custom_path" diff --git a/.github/workflows/package-test-single.yml b/.github/workflows/package-test-single.yml new file mode 100644 index 00000000..8fa5e748 --- /dev/null +++ b/.github/workflows/package-test-single.yml @@ -0,0 +1,93 @@ +--- +name: Package Test(single) + +on: + workflow_dispatch: + inputs: + package_testing_branch: + description: 'Target branch for package-testing repository' + type: string + default: 'master' + required: true + playbook: + description: 'Select test to run:' + default: 'pmm2-client_integration' + required: true + type: choice + options: + - pmm2-client + - pmm2-client_upgrade + - pmm2-client_custom_path + - pmm2-client_integration + - pmm2-client_integration_upgrade + - pmm2-client_integration_auth_config + - pmm2-client_integration_auth_register + - pmm2-client_integration_custom_path + - pmm2-client_integration_custom_port + - pmm2-client_integration_upgrade_custom_port + - pmm2-client_integration_upgrade_custom_path + repository: + description: 'Select Repo for Client:' + required: true + default: 'dev-latest' + type: choice + options: + - release + - release candidate + - dev-latest + metrics_mode: + description: 'Select the Metrics Mode for PMM Client:' + required: true + default: 'auto' + type: choice + options: + - auto + - push + - pull + + workflow_call: + inputs: + package_testing_branch: + description: 'Target branch for package-testing repository' + type: string + default: 'master' + required: true + playbook: + description: 'Select test to run:' + default: 'pmm2-client_integration' + required: true + type: string + repository: + description: 'Select Repo for Client:' + required: true + default: 'dev-latest' + type: string + metrics_mode: + description: 'Select the Metrics Mode for PMM Client:' + default: 'auto' + type: string + +jobs: + get_versions: + name: Get versions + uses: ./.github/workflows/pmm-version-getter.yml + with: + repository: ${{ inputs.repository || 'release'}} + + p_test: + name: ${{ inputs.playbook }} + uses: ./.github/workflows/runner-package-test.yml + secrets: inherit + needs: get_versions + strategy: + fail-fast: false + matrix: + os: ${{ fromJSON(needs.get_versions.outputs.pt_os) }} + with: + package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + expected_version: ${{needs.get_versions.outputs.finish_version}} + repository: ${{ inputs.repository || 'dev-latest' }} + metrics_mode: ${{ inputs.metrics_mode || 'auto' }} + playbook: ${{ inputs.playbook || 'pmm2-client_integration' }} + test_name: ${{ matrix.os }} + os: ${{ matrix.os }} diff --git a/.github/workflows/pmm-version-getter.yml b/.github/workflows/pmm-version-getter.yml new file mode 100644 index 00000000..4ba0f12c --- /dev/null +++ b/.github/workflows/pmm-version-getter.yml @@ -0,0 +1,106 @@ +name: "version detector for PMM jobs" + +on: + workflow_call: + inputs: + pmm_server_start_version: + description: 'PMM Server version to upgrade (latest|dev-latest|x.xx.x|x.xx.x-rc)' + type: string + pmm_client_start_version: + description: 'PMM Client version to upgrade from (dev-latest|pmm2-latest|pmm2-rc|x.xx.x)' + type: string + repository: + description: 'Upgrade to:' + required: true + default: 'dev-latest' + type: string + matrix_range: + default: '10' + type: string + outputs: + start_version: + description: "Version detected based on tag input" + value: ${{ jobs.push_versions.outputs.start_version }} + finish_version: + description: "Version detected based on repository input" + value: ${{ jobs.push_versions.outputs.finish_version }} + version_matrix: + description: "Json array with number of last versions" + value: ${{ jobs.push_versions.outputs.version_matrix }} + pt_os: + description: "Json array with Package Tests Operating Systems" + value: ${{ jobs.push_versions.outputs.pt_os_matrix }} + + +jobs: + push_versions: + name: Get versions + runs-on: ubuntu-latest + timeout-minutes: 1 + outputs: + start_version: ${{ steps.get-start.outputs.result }} + finish_version: ${{ steps.get-finish.outputs.result }} + version_matrix: ${{ steps.get-matrix.outputs.result }} + pt_os_matrix: "[\"buster\", \"bullseye\", \"bookworm\", \"focal\", \"jammy\", \"centos-7\", \"ol-8\", \"ol-9\"]" + steps: + - name: Prevent upgrade to the same version + shell: bash + run: | + if [[ "${{ inputs.pmm_server_start_version }}" == "latest" && "${{ inputs.repository }}" == "release" ]]; then + echo "Upgrade to the same version is forbidden!" + exit 1 + fi + if [[ "${{ inputs.pmm_server_start_version }}" == "dev-latest" && "${{ inputs.repository }}" == "dev-latest" ]]; then + echo "Upgrade to the same version is forbidden!" + exit 1 + fi + + - name: Discover latest versions + shell: bash + run: | + r_latest=$(wget -q https://registry.hub.docker.com/v2/repositories/percona/pmm-client/tags -O - | jq -r .results[].name | grep -v latest | sort -V | tail -n1) + rc_latest=$(wget -q "https://registry.hub.docker.com/v2/repositories/perconalab/pmm-client/tags?page_size=25&name=rc" -O - | jq -r .results[].name | grep 2.*.*-rc$ | sort -V | tail -n1) + d_latest=$(wget -q https://raw.githubusercontent.com/Percona-Lab/pmm-submodules/PMM-2.0/VERSION -O -) + + echo "release_latest=$r_latest" >> $GITHUB_ENV + echo "rc_latest=$rc_latest" >> $GITHUB_ENV + echo "dev_latest=$d_latest" >> $GITHUB_ENV + + - name: Get start version string + id: get-start + shell: bash + run: | + if [[ "${{ inputs.pmm_server_start_version }}" == "latest" ]]; then + echo "result=$release_latest" >> "$GITHUB_OUTPUT" + fi + if [[ "${{ inputs.pmm_server_start_version }}" == "dev-latest" ]]; then + echo "result=$dev_latest" >> "$GITHUB_OUTPUT" + fi + + - name: Get finish version string + id: get-finish + shell: bash + run: | + if [[ "${{ inputs.repository }}" == "dev-latest" ]]; then + echo "result=$dev_latest" >> "$GITHUB_OUTPUT" + fi + if [[ "${{ inputs.repository }}" == "release candidate" ]]; then + echo "result=$rc_latest" >> "$GITHUB_OUTPUT" + fi + if [[ "${{ inputs.repository }}" == "release" ]]; then + echo "result=$release_latest" >> "$GITHUB_OUTPUT" + fi + + - name: Get versions matrix + id: get-matrix + shell: bash + run: | + range=${{ inputs.matrix_range }} + if [[ "${{ inputs.repository }}" == "release" ]]; then + array=$(wget -q https://registry.hub.docker.com/v2/repositories/percona/pmm-client/tags?page_size=250 -O - | jq -r .results[].name | grep -v latest | sort -V | grep -E '[[:digit:]]\.[[:digit:]]+\.[[:digit:]]' | tail -$((++range)) | head -$((range))) + else + array=$(wget -q https://registry.hub.docker.com/v2/repositories/percona/pmm-client/tags?page_size=250 -O - | jq -r .results[].name | grep -v latest | sort -V | grep -E '[[:digit:]]\.[[:digit:]]+\.[[:digit:]]' | tail -$((range))) + fi + jq -c -n '$ARGS.positional' --args ${array[@]} + echo "result=$(jq -c -n '$ARGS.positional' --args ${array[@]})" >> "$GITHUB_OUTPUT" + #echo "result=$(jq -c -n '$ARGS.positional' --args '2.11.0' ${array[@]})" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/portal-tests-matrix.yml b/.github/workflows/portal-tests-matrix.yml new file mode 100644 index 00000000..7d0c25f3 --- /dev/null +++ b/.github/workflows/portal-tests-matrix.yml @@ -0,0 +1,33 @@ +name: "Portal Tests Matrix" + +on: + push: + branches: + - "PMM-7-fix-portal-pipeline" + +jobs: + get_versions: + name: Get versions + uses: ./.github/workflows/pmm-version-getter.yml + with: + repository: ${{ inputs.repository || 'dev-latest'}} + matrix_range: 5 + + portal: + name: 'Portal / Integration' + uses: ./.github/workflows/portal-ui-tests.yml + secrets: inherit + needs: get_versions + strategy: + fail-fast: false + matrix: + old_version: ${{ fromJSON(needs.get_versions.outputs.version_matrix) }} + with: + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_test_flag: '@portal' + pmm_server_version: ${{ matrix.old_version }} + pmm_client_version: ${{ matrix.old_version }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_clients: '' + version_string_from: ${{needs.get_versions.outputs.start_version}} + diff --git a/.github/workflows/runner-cli-integration-test.yml b/.github/workflows/runner-cli-integration-test.yml new file mode 100644 index 00000000..257c581d --- /dev/null +++ b/.github/workflows/runner-cli-integration-test.yml @@ -0,0 +1,289 @@ +name: PMM Integration Tests +on: + # run with default inputs + workflow_dispatch: + inputs: + server_image: + description: "pmm-server docker image, default perconalab/pmm-server:dev-latest" + required: false + type: string + client_version: + description: "pmm2-client version Tarball or Dev-latest, default is dev-latest" + required: false + type: string + client_image: + description: "pmm2-client docker image, default perconalab/pmm-client:dev-latest" + required: false + type: string + pmm_qa_branch: + description: "Branch for PMM-QA to checkout" + required: false + type: string + pmm_ui_branch: + description: "Branch for PMM-UI(CLI) tests to checkout" + required: false + type: string + sha: + description: "SHA (leave empty if running manually, default - 'null')" + required: false + type: string + workflow_call: + inputs: + server_image: + description: "pmm-server docker image, default perconalab/pmm-server:dev-latest" + required: false + type: string + client_version: + description: "pmm2-client version Tarball or Dev-latest, default is dev-latest" + required: false + type: string + client_image: + description: "pmm2-client docker image, default perconalab/pmm-client:dev-latest" + required: false + type: string + pmm_qa_branch: + description: "Branch for PMM-QA to checkout" + required: false + type: string + pmm_ui_branch: + description: "Branch for PMM-UI(CLI) tests to checkout" + required: false + type: string + sha: + description: "SHA (leave empty if running manually, default - 'null')" + required: false + type: string + +jobs: + cli-tests: + runs-on: ubuntu-latest + timeout-minutes: 40 + env: + SERVER_IMAGE: ${{ github.event.inputs.server_image || inputs.server_image || 'perconalab/pmm-server:dev-latest' }} + CLIENT_IMAGE: ${{ github.event.inputs.client_image || inputs.client_image || 'perconalab/pmm-client:dev-latest' }} + CLIENT_VERSION: ${{ github.event.inputs.client_version || inputs.client_version || 'dev-latest' }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PMM_QA_BRANCH: ${{ github.event.inputs.pmm_qa_branch || inputs.pmm_qa_branch || 'main' }} + PMM_UI_BRANCH: ${{ github.event.inputs.pmm_ui_branch || inputs.pmm_ui_branch || 'main' }} + DOCKER_VERSION: ${{ github.event.inputs.server_image || inputs.server_image || 'perconalab/pmm-server:dev-latest' }} + CLIENT_DOCKER_VERSION: ${{ github.event.inputs.client_image || inputs.client_image || 'perconalab/pmm-client:dev-latest' }} + SHA: ${{ github.event.inputs.sha || inputs.sha || github.event.pull_request.head.sha || github.event.pull_request.head.sha || github.sha || 'null' }} + strategy: + fail-fast: false + matrix: + db-type: [ps5.7, ps8, ms8.0, pdpgsql13, pdpgsql14, pdpgsql15, modb4.4, modb5, modb6, help, generic, server-container, clientContainer, haproxy, proxysql, remove] + + steps: + - name: Create status check + if: ${{ env.SHA != 'null' }} + uses: percona/gh-action-github-status-action@update-node + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ matrix.db-type }} CLI tests" + description: "Test execution ${{ job.status }}" + state: "pending" + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + + - name: Checkout PMM-QA tests ${{ env.PMM_QA_BRANCH }} branch + uses: actions/checkout@v4 + with: + ref: ${{ env.PMM_QA_BRANCH }} + repository: percona/pmm-qa + path: ./ + + - name: Checkout PMM UI tests + uses: actions/checkout@v4 + with: + ref: ${{ env.PMM_UI_BRANCH }} + repository: percona/pmm-ui-tests + path: ./pmm-ui-tests + + - name: Install playwright + working-directory: ./pmm-ui-tests/cli + run: | + npm ci + + - name: Setup tools + run: | + sudo apt-get install -y apt-transport-https ca-certificates dirmngr ansible libaio1 libaio-dev libnuma-dev libncurses5 socat sysbench + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 + echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \ + /etc/apt/sources.list.d/clickhouse.list + sudo apt-get update + sudo apt-get install -y clickhouse-client + sudo curl -s https://raw.githubusercontent.com/datacharmer/dbdeployer/master/scripts/dbdeployer-install.sh | bash + wget https://raw.githubusercontent.com/Percona-QA/percona-qa/master/get_download_link.sh + chmod +x get_download_link.sh + + - name: Setup PMM2-Server + run: | + docker create -v /srv --name pmm-server-data ${{ env.SERVER_IMAGE }} + docker run -d -p 80:80 -p 443:443 -p 9000:9000 \ + -e PERCONA_TEST_PLATFORM_ADDRESS=https://check-dev.percona.com:443 \ + -e PERCONA_TEST_PLATFORM_PUBLIC_KEY=RWTg+ZmCCjt7O8eWeAmTLAqW+1ozUbpRSKSwNTmO+exlS5KEIPYWuYdX \ + --volumes-from pmm-server-data --name pmm-server --restart always ${{ env.SERVER_IMAGE }} + timeout 240 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://127.0.0.1/v1/readyz)" != "200" ]]; do sleep 2; done' || false + + - name: Setup PMM2-Client + run: sudo -E bash -x ./pmm-tests/pmm2-client-setup.sh --pmm_server_ip 127.0.0.1 --client_version ${{ env.CLIENT_VERSION }} --admin_password admin --use_metrics_mode no + + - name: Setup npm modules for the integration setup + working-directory: pmm-integration + run: npm ci + + - name: Run CLI '--help' tests + if: ${{ matrix.db-type == 'help' }} + working-directory: ./pmm-ui-tests/cli + run: npx playwright test pmm-ui-tests/cli/tests/help.spec.ts --quiet + + - name: Run CLI remove tests + if: ${{ matrix.db-type == 'remove' }} + working-directory: ./pmm-ui-tests/cli + run: npx playwright test pmm-ui-tests/cli/tests/remove.spec.ts --quiet + + - name: Run Setup for ps5.7 + working-directory: pmm-integration + if: ${{ matrix.db-type == 'ps5.7' }} + run: | + sudo npx ts-node ./integration-setup.ts --ps-version=5.7 --ci --addclient=ps,1 + + - name: Run Setup for ps8.0 + working-directory: pmm-integration + if: ${{ matrix.db-type == 'ps8' }} + run: | + sudo npx ts-node ./integration-setup.ts --ps-version=8 --ci --addclient=ps,1 + + - name: Run CLI tests for PS + if: ${{ matrix.db-type == 'ps5.7' || matrix.db-type == 'ps8' }} + working-directory: ./pmm-ui-tests/cli + run: npx playwright test pmm-ui-tests/cli/tests/perconaMySqlServer.spec.ts --quiet + + - name: Run Setup for pdpgsql 13 + working-directory: pmm-integration + if: ${{ matrix.db-type == 'pdpgsql13' }} + run: | + sudo npx ts-node ./integration-setup.ts --ci --addclient=pdpgsql,1 --pdpgsql-version=13 + + - name: Run Setup for pdpgsql 14 + working-directory: pmm-integration + if: ${{ matrix.db-type == 'pdpgsql14' }} + run: | + sudo npx ts-node ./integration-setup.ts --ci --addclient=pdpgsql,1 --pdpgsql-version=14 + + - name: Run Setup for pdpgsql 15.0 + working-directory: pmm-integration + if: ${{ matrix.db-type == 'pdpgsql15' }} + run: | + sudo npx ts-node ./integration-setup.ts --ci --addclient=pdpgsql,1 --pdpgsql-version=15.0 + + - name: Run CLI tests for PDPGSQL + if: ${{ matrix.db-type == 'pdpgsql13' || matrix.db-type == 'pdpgsql14' || matrix.db-type == 'pdpgsql15' }} + working-directory: ./pmm-ui-tests/cli + run: npx playwright test postgreSql --quiet + + - name: Run Setup for PSMDB 4.4 + working-directory: pmm-integration + if: ${{ matrix.db-type == 'modb4.4' }} + run: | + sudo npx ts-node ./integration-setup.ts --ci --addclient=modb,1 --mo-version=4 + sudo -E bash -x ../pmm-tests/pmm-framework.sh --addclient=modb,1 --mo-version=4 --with-shard --mongomagic + + - name: Run Setup for PSMDB 5 + working-directory: pmm-integration + if: ${{ matrix.db-type == 'modb5' }} + run: | + sudo npx ts-node ./integration-setup.ts --ci --addclient=modb,1 --mo-version=5 + sudo -E bash -x ../pmm-tests/pmm-framework.sh --addclient=modb,1 --mo-version=5 --with-shard --mongomagic + + - name: Run Setup for PSMDB 6 + working-directory: pmm-integration + if: ${{ matrix.db-type == 'modb6' }} + run: | + sudo npx ts-node ./integration-setup.ts --ci --addclient=modb,1 --mo-version=6 + sudo -E bash -x ../pmm-tests/pmm-framework.sh --addclient=modb,1 --mo-version=6 --with-shard --mongomagic + + - name: Run CLI tests for PSMDB + if: ${{ matrix.db-type == 'modb6' || matrix.db-type == 'modb5' || matrix.db-type == 'modb4.4' }} + working-directory: ./pmm-ui-tests/cli + run: | + npx playwright test pmm-ui-tests/cli/tests/mongoDb-psmdb.spec.ts --quiet + +# TODO: Add setup for the official MongoDB and run "npx playwright test pmm-ui-tests/cli/tests/mongoDb.spec.ts" + + - name: Run Client Container Setup + if: ${{ matrix.db-type == 'clientContainer' }} + run: | + sudo -E bash -x ./pmm-tests/pmm-framework.sh --setup-pmm-client-docker --pmm2 + + - name: Run CLI tests for Generic Scenarios + if: ${{ matrix.db-type == 'generic' }} + working-directory: ./pmm-ui-tests/cli + run: npx playwright test generic unregister --quiet + + - name: Run CLI tests for PMM Server Container + if: ${{ matrix.db-type == 'server-container' && !contains(env.PMM_UI_BRANCH, 'pmm-2.') }} + working-directory: ./pmm-ui-tests/cli + run: npx playwright test pmm-server-only --quiet + + - name: Run CLI tests for PMM Client Docker Container + if: ${{ matrix.db-type == 'clientContainer' }} + working-directory: ./pmm-ui-tests/cli + run: npx playwright test pmm-client-docker --quiet + + - name: Run Setup for HAPROXY + if: ${{ matrix.db-type == 'haproxy' }} + run: | + export CLIENT_VERSION=${{ env.CLIENT_VERSION }} + export CLIENT_DOCKER_VERSION=${{ env.CLIENT_DOCKER_VERSION }} + sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=haproxy,1 --pmm2 + + - name: Run CLI tests for Client Container Scenarios + if: ${{ matrix.db-type == 'haproxy' }} + working-directory: ./pmm-ui-tests/cli + run: npx playwright test haproxy --quiet + + - name: Run Setup for ProxySQL + if: ${{ matrix.db-type == 'proxysql' }} + run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=pxc,1 --pmm2 --pxc-version=5.7 + + - name: Run CLI tests for ProxySQL + if: ${{ matrix.db-type == 'proxysql' }} + working-directory: ./pmm-ui-tests/cli + run: npx playwright test proxySql --quiet + + - name: Run Setup for MySQL 8.0 + if: ${{ matrix.db-type == 'ms8.0' }} + run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=ms,1 --pmm2 --ms-version=8.0 + + - name: Run MySQL specific CLI tests + if: ${{ matrix.db-type == 'ms8.0' }} + working-directory: ./pmm-ui-tests/cli + run: npx playwright test pmm-ui-tests/cli/tests/mysql.spec.ts --quiet + + - name: Run CLI tests for MySQL Tests + if: ${{ matrix.db-type == 'ms8.0' }} + working-directory: ./pmm-ui-tests/cli + run: npx playwright test pmm-ui-tests/cli/tests/mysql-conf-file.spec.ts --quiet + + - name: Generate and Attach the report + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: "report-${{ matrix.db-type }}" + path: ./pmm-ui-tests/cli/test-report + + - name: Create status check + if: ${{ always() }} + uses: percona/gh-action-github-status-action@update-node + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ matrix.db-type }} CLI tests" + description: "Test execution ${{ job.status }}" + state: ${{ job.status }} + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} diff --git a/.github/workflows/runner-e2e-tests-codeceptjs.yml b/.github/workflows/runner-e2e-tests-codeceptjs.yml new file mode 100644 index 00000000..97b233c3 --- /dev/null +++ b/.github/workflows/runner-e2e-tests-codeceptjs.yml @@ -0,0 +1,163 @@ +name: _runner-e2e-tests +on: + workflow_call: + inputs: + server_image: + description: "pmm-server docker image, default perconalab/pmm-server:dev-latest" + required: false + type: string + client_version: + description: "pmm2-client version Tarball or Dev-latest, default is dev-latest" + required: false + type: string + client_image: + description: "pmm2-client docker image, default perconalab/pmm-client:dev-latest" + required: false + type: string + pmm_qa_branch: + description: "Branch for PMM-QA to checkout" + required: false + type: string + pmm_ui_branch: + description: "Branch for PMM-UI tests to checkout" + required: false + type: string + sha: + description: "SHA (leave empty if running manually, default - 'null')" + required: false + type: string + client_flags: + description: "example: --addclient=ps,1 --ps-version=5.7" + required: false + type: string + tags_for_tests: + description: "example: @settings-fb" + required: true + type: string + +jobs: + ui-tests-e2e: + name: "e2e tests: ${{ inputs.tags_for_tests || '@settings-fb' }}" +# runs-on: ubuntu-latest Mongo Replica setup fails in ubuntu-latest for some reason. Additional investigation needed + runs-on: ubuntu-20.04 + timeout-minutes: 60 + env: + SERVER_IMAGE: ${{ inputs.server_image || 'perconalab/pmm-server:dev-latest' }} + CLIENT_IMAGE: ${{ inputs.client_image || 'perconalab/pmm-client:dev-latest' }} + CLIENT_VERSION: ${{ inputs.client_version || 'dev-latest' }} + PMM_CLIENT_VERSION: ${{ inputs.client_version || 'dev-latest' }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ADMIN_PASSWORD: 'admin-password' + PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} + PMM_QA_GIT_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} + PMM_UI_BRANCH: ${{ inputs.pmm_ui_branch || 'main' }} + DOCKER_VERSION: ${{ inputs.server_image || 'perconalab/pmm-server:dev-latest' }} + CLIENT_DOCKER_VERSION: ${{ inputs.client_image || 'perconalab/pmm-client:dev-latest' }} + SHA: ${{ inputs.sha || 'null' }} + CLIENT_FLAGS: ${{ inputs.client_flags || '' }} + TAGS_FOR_TESTS: ${{ inputs.tags_for_tests || '@settings-fb' }} + +# Environment variables for tests + BACKUP_LOCATION_ACCESS_KEY: ${{ secrets.BACKUP_LOCATION_ACCESS_KEY }} + BACKUP_LOCATION_SECRET_KEY: ${{ secrets.BACKUP_LOCATION_SECRET_KEY }} + + + steps: + - name: Create status check + if: ${{ github.event_name != 'pull_request' }} + uses: percona/gh-action-github-status-action@v1 + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.TAGS_FOR_TESTS }} UI tests" + description: "Test execution ${{ job.status }}" + state: "pending" + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + + - name: Checkout PMM UI tests + uses: actions/checkout@v4 + with: + ref: ${{ env.PMM_UI_BRANCH }} + repository: percona/pmm-ui-tests + path: ./pmm-ui-tests + + - name: Setup tools + run: | + npm install -g bats + sudo apt-get install -y apt-transport-https ca-certificates dirmngr ansible libaio1 libaio-dev libnuma-dev libncurses5 socat sysbench + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 + echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \ + /etc/apt/sources.list.d/clickhouse.list + sudo apt-get update + sudo apt-get install -y clickhouse-client + sudo curl -s https://raw.githubusercontent.com/datacharmer/dbdeployer/master/scripts/dbdeployer-install.sh | bash + ls -la + git clone -b ${{ env.PMM_QA_BRANCH }} https://github.com/percona/pmm-qa + ls -la + pushd pmm-qa + wget https://raw.githubusercontent.com/Percona-QA/percona-qa/master/get_download_link.sh + chmod +x get_download_link.sh + popd + + - name: Setup PMM2-Server + working-directory: ./pmm-ui-tests + run: | + PWD=$(pwd) PMM_SERVER_IMAGE=${{ env.DOCKER_VERSION }} docker-compose up -d + sleep 60 + docker exec pmm-server change-admin-password ${{ env.ADMIN_PASSWORD }} + bash -x testdata/db_setup.sh + + - name: Export path to pmm-qa repo + working-directory: ./pmm-qa + run: echo "PATH_TO_PMM_QA=$(pwd)" >> $GITHUB_ENV + + - name: Setup PMM2-Client + working-directory: ./pmm-qa + run: sudo bash -x pmm-tests/pmm2-client-setup.sh --pmm_server_ip 192.168.0.1 --client_version ${{ env.CLIENT_VERSION }} --admin_password ${{ env.ADMIN_PASSWORD }} --use_metrics_mode no + + - name: Run Setup for E2E Tests + working-directory: ./pmm-qa + run: sudo -E bash -x pmm-tests/pmm-framework.sh ${{ env.CLIENT_FLAGS }} --pmm2 + + - name: Setup npm modules for e2e tests + working-directory: ./pmm-ui-tests + run: | + npm ci + envsubst < env.list > env.generated.list + + - name: Execute e2e tests with tags ${{ env.TAGS_FOR_TESTS }} + working-directory: ./pmm-ui-tests + env: + SERVER_IP : "192.168.0.1" + PMM_UI_URL : "http://192.168.0.1/" + PMM_URL : "http://admin:${{ env.ADMIN_PASSWORD }}@${{ env.SERVER_IP }}" + run: | + sed -i 's+http://localhost/+${PMM_UI_URL}/+g' pr.codecept.js + ./node_modules/.bin/codeceptjs run -c pr.codecept.js --grep "${{ env.TAGS_FOR_TESTS }}" + + - uses: actions/github-script@v7 + if: ${{ always() }} + id: artifact_name + with: + script: | + return `artifacts_for_${process.env.TAGS_FOR_TESTS.replaceAll('|', '')}` + result-encoding: string + + - name: Create status check + if: ${{ github.event_name != 'pull_request' && always() }} + uses: percona/gh-action-github-status-action@v1 + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.TAGS_FOR_TESTS }} UI tests" + description: "Test execution ${{ job.status }}" + state: ${{ job.status }} + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + +# - name: Setup tmate session on failure +# if: ${{ failure() }} +# uses: percona-platform/action-tmate@v2 diff --git a/.github/workflows/runner-e2e-tests-playwright.yml b/.github/workflows/runner-e2e-tests-playwright.yml new file mode 100644 index 00000000..a3ceaaa2 --- /dev/null +++ b/.github/workflows/runner-e2e-tests-playwright.yml @@ -0,0 +1,207 @@ +--- +name: runner-e2e-tests-playwright + +on: + workflow_call: + inputs: + pmm_ui_tests_branch: + description: 'Target branch for pmm-ui-tests repository' + type: string + default: 'main' + required: true + pmm_test_flag: + description: 'Flag to run only specific portion of the tests.' + type: string + required: false + pmm_server_version: + description: 'Version of the pmm server used for testing' + type: string + default: 'dev-latest' + required: true + pmm_client_version: + description: 'Version of the pmm client used for testing' + type: string + default: 'dev-latest' + required: true + pmm_clients: + description: 'Clients for pmm-server' + type: string + default: '--addclient=ps,1' + required: true + pmm_qa_branch: + description: 'Branch for the pmm-qa repository.' + type: string + default: 'main' + required: true + + workflow_dispatch: + inputs: + pmm_ui_tests_branch: + description: 'Target branch for pmm-ui-tests repository' + type: string + default: 'main' + required: true + pmm_test_flag: + description: 'Flag to run only specific portion of the tests.' + type: string + required: false + pmm_server_version: + description: 'Version of the pmm server used for testing' + type: string + default: 'dev-latest' + required: true + pmm_client_version: + description: 'Version of the pmm client used for testing' + type: string + default: 'dev-latest' + required: true + pmm_clients: + description: 'Clients for pmm-server' + type: string + default: '--addclient=ps,1' + required: true + pmm_qa_branch: + description: 'Branch for the pmm-qa repository.' + type: string + default: 'main' + required: true + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + timeout-minutes: 60 + env: + SHA: ${{ inputs.sha || 'null' }} + PMM_BASE_URL: https://127.0.0.1 + ADMIN_PASSWORD: admin + + UI_TESTS_BRANCH: ${{ inputs.pmm_ui_tests_branch }} + PMM_CLIENTS: ${{ inputs.pmm_clients }} + PMM_TEST_FLAG: ${{ inputs.pmm_test_flag }} + + PMM_SERVER_VERSION: ${{ inputs.pmm_server_version }} + PMM_CLIENT_VERSION: ${{ inputs.pmm_client_version }} + PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch }} + + OKTA_TOKEN: ${{ secrets.OKTA_TOKEN }} + OAUTH_ISSUER_URL: 'https://id-dev.percona.com/oauth2/aus15pi5rjdtfrcH51d7' + OAUTH_CLIENT_ID: ${{ secrets.OKTA_OAUTH_CLIENT_ID }} + OAUTH_CLIENT_SECRET: ${{ secrets.OKTA_OAUTH_CLIENT_SECRET }} + OAUTH_PMM_CLIENT_ID: ${{ secrets.OKTA_OAUTH_PMM_CLIENT_ID }} + OAUTH_PMM_CLIENT_SECRET: ${{ secrets.OKTA_OAUTH_PMM_CLIENT_SECRET }} + OAUTH_DEV_HOST: ${{ secrets.OAUTH_DEV_HOST }} + OAUTH_SCOPES: percona + + # Variables for E2E tests + MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }} + MAILOSAUR_UI_TESTS_SERVER_ID: ${{ secrets.MAILOSAUR_UI_TESTS_SERVER_ID }} + MAILOSAUR_API_TESTS_SERVER_ID: ${{ secrets.MAILOSAUR_API_TESTS_SERVER_ID }} + + SERVICENOW_LOGIN: percona_platform + SERVICENOW_PASSWORD: ${{ secrets.SERVICENOW_PASSWORD }} + SERVICENOW_DEV_URL: 'https://perconadev.service-now.com/api/x_pellc_percona_pl/platform/settest' + + steps: + - name: PMM server version ${{ inputs.pmm_server_version }} and UI tests for flag "${{ inputs.pmm_test_flag }}" and pmm-ui-tests branch ${{ inputs.pmm_ui_tests_branch }} + if: ${{ env.SHA != 'null' }} + uses: percona/gh-action-github-status-action@v1 + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.PMM_TEST_FLAG }} UI tests" + description: "Test execution ${{ job.status }}" + state: "pending" + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + + - name: 'Checkout UI tests: "${{ inputs.pmm_ui_tests_branch }}"' + uses: actions/checkout@v3 + with: + ref: ${{ inputs.pmm_ui_tests_branch }} + repository: percona/pmm-ui-tests + path: ./pmm-ui-tests + + - name: 'Install playwright' + working-directory: ./pmm-ui-tests/playwright-tests + run: | + npm ci + npx playwright install + + - name: 'Checkout pmm-qa: "${{ inputs.pmm_qa_branch }}"' + uses: actions/checkout@v3 + with: + # token: ${{ secrets.ROBOT_TOKEN }} + repository: percona/pmm-qa + ref: ${{ inputs.pmm_qa_branch }} + path: ./pmm-qa + + - name: 'Setup : "${{ inputs.pmm_server_version }}"' + working-directory: pmm-qa/pmm-integration + run: | + npm install + sudo npx ts-node ./integration-setup.ts --ci --setup-docker-pmm-server --rbac --pmm-server-docker-tag=${{ env.PMM_SERVER_VERSION }} --pmm-client-version=${{ env.PMM_CLIENT_VERSION }} + timeout 100 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/ping)" != "200" ]]; do sleep 5; done' || false + + - name: 'Setup ' + run: | + sudo bash ./pmm-qa/pmm-tests/pmm2-client-setup.sh --pmm_server_ip 127.0.0.1 --client_version ${{ env.PMM_CLIENT_VERSION }} --admin_password admin --use_metrics_mode no + shell: bash + + - name: Setup Databases for the PMM-Server + working-directory: pmm-qa/pmm-integration + run: | + sudo npx ts-node ./integration-setup.ts --ci \ + ${{ env.PMM_CLIENTS }} + sleep 30 + sudo pmm-admin list + shell: bash + + - name: Execute UI tests + if: ${{ inputs.pmm_test_flag == 'null' }} + id: ui-tests-all + working-directory: pmm-ui-tests/playwright-tests + run: | + npx playwright test --project="chromium" --quiet +# env: +# NODE_TLS_REJECT_UNAUTHORIZED: 0 + + - name: 'Run UI tests: ${{ env.PMM_TEST_FLAG }}' + if: ${{ inputs.pmm_test_flag != 'null' }} + id: ui-tests-flagged + working-directory: pmm-ui-tests/playwright-tests + run: | + project="${{ contains(env.PMM_TEST_FLAG, 'portal') && 'Portal' || 'Chromium' }}" + npx playwright test --project=$project --grep ${{ env.PMM_TEST_FLAG }} --pass-with-no-tests +# env: +# NODE_TLS_REJECT_UNAUTHORIZED: 0 + + - name: 'Create report name' + if: failure() + run: | + # TODO: add job id for matrix call + job_tag=$(echo "${{ inputs.pmm_test_flag }}" | sed -e "s/-pre-upgrade//" -e "s/@//") + report_name="$job_tag"-report + echo $report_name + echo "REPORT_NAME=$report_name" >> $GITHUB_ENV + + - name: Generate and Attach the report + if: failure() + uses: actions/upload-artifact@v3 + with: + name: ${{ env.REPORT_NAME }} + path: ./pmm-ui-tests/playwright-tests/playwright-report + + - name: Create status check + uses: percona/gh-action-github-status-action@v1 + if: ${{ env.SHA != 'null' && always() }} + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.PMM_TEST_FLAG }} UI tests" + description: "Test execution ${{ job.status }}" + state: ${{ job.status }} + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} diff --git a/.github/workflows/runner-e2e-tests-podman.yml b/.github/workflows/runner-e2e-tests-podman.yml new file mode 100644 index 00000000..03f08922 --- /dev/null +++ b/.github/workflows/runner-e2e-tests-podman.yml @@ -0,0 +1,239 @@ +name: runner-e2e-tests-podman +on: + workflow_call: + inputs: + server_image: + description: "pmm-server docker image, default perconalab/pmm-server:dev-latest" + required: false + type: string + client_version: + description: "pmm2-client version Tarball or Dev-latest, default is dev-latest" + required: false + type: string + client_image: + description: "pmm2-client docker image, default perconalab/pmm-client:dev-latest" + required: false + type: string + pmm_qa_branch: + description: "Branch for PMM-QA to checkout" + required: false + type: string + pmm_ui_branch: + description: "Branch for PMM-UI tests to checkout" + required: false + type: string + sha: + description: "SHA (leave empty if running manually, default - 'null')" + required: false + type: string + client_flags: + description: "example: --addclient=ps,1 --ps-version=5.7" + required: false + type: string + tags_for_tests: + description: "example: @settings-fb" + required: true + type: string + push: + branches: + - PMM-12359-podman-setup + +jobs: + ui-tests-e2e: + name: "podman e2e tests: ${{ inputs.tags_for_tests || '@settings-fb' }}" +# runs-on: ubuntu-latest Mongo Replica setup fails in ubuntu-latest for some reason. Additional investigation needed + runs-on: ubuntu-20.04 + timeout-minutes: 60 + env: + SERVER_IMAGE: ${{ inputs.server_image || 'perconalab/pmm-server:dev-latest' }} + CLIENT_IMAGE: ${{ inputs.client_image || 'perconalab/pmm-client:dev-latest' }} + CLIENT_VERSION: ${{ inputs.client_version || 'dev-latest' }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ADMIN_PASSWORD: 'admin-password' + PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} + PMM_QA_GIT_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} + PMM_UI_BRANCH: ${{ inputs.pmm_ui_branch || 'main' }} + DOCKER_VERSION: ${{ inputs.server_image || 'perconalab/pmm-server:dev-latest' }} + CLIENT_DOCKER_VERSION: ${{ inputs.client_image || 'perconalab/pmm-client:dev-latest' }} + SHA: ${{ inputs.sha || 'null' }} + CLIENT_FLAGS: ${{ inputs.client_flags || '' }} + TAGS_FOR_TESTS: ${{ inputs.tags_for_tests || '@settings-fb' }} + +# Environment variables for tests + BACKUP_LOCATION_ACCESS_KEY: ${{ secrets.BACKUP_LOCATION_ACCESS_KEY }} + BACKUP_LOCATION_SECRET_KEY: ${{ secrets.BACKUP_LOCATION_SECRET_KEY }} + + + steps: + - name: Create status check + if: ${{ github.event_name != 'pull_request' }} + uses: percona/gh-action-github-status-action@v1 + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.TAGS_FOR_TESTS }} UI tests" + description: "Test execution ${{ job.status }}" + state: "pending" + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + + - name: "Checkout PMM UI tests: ${{ env.PMM_UI_BRANCH }}" + uses: actions/checkout@v4 + with: + ref: ${{ env.PMM_UI_BRANCH }} + repository: percona/pmm-ui-tests + path: ./pmm-ui-tests + + - name: "Checkout PMM QA: ${{ env.PMM_QA_BRANCH }}" + uses: actions/checkout@v4 + with: + ref: ${{ env.PMM_QA_BRANCH }} + repository: percona/pmm-qa + path: ./pmm-qa + + - name: Setup tools + run: | + npm install -g bats + sudo apt-get install -y apt-transport-https ca-certificates dirmngr ansible libaio1 libaio-dev libnuma-dev libncurses5 socat sysbench + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 + echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \ + /etc/apt/sources.list.d/clickhouse.list + . /etc/os-release + echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee \ + /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list + curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add - + sudo apt-get update + sudo apt-get -y upgrade + sudo apt-get install -y + sudo apt-get install -y clickhouse-client podman + sudo curl -s https://raw.githubusercontent.com/datacharmer/dbdeployer/master/scripts/dbdeployer-install.sh | bash + ls -la + pushd ./pmm-qa + wget https://raw.githubusercontent.com/Percona-QA/percona-qa/master/get_download_link.sh + chmod +x get_download_link.sh + popd + sudo sysctl net.ipv4.ip_unprivileged_port_start=80 + + - name: Setup PMM2-Server + working-directory: ./pmm-ui-tests + run: | + mkdir -p ~/.config/systemd/user/ + cat > ~/.config/systemd/user/pmm-server.service < ~/.config/pmm-server/pmm-server.env <> $GITHUB_ENV + + - name: Setup PMM2-Client + working-directory: ./pmm-qa + run: sudo bash -x pmm-tests/pmm2-client-setup.sh --pmm_server_ip 127.0.0.1 --client_version ${{ env.CLIENT_VERSION }} --admin_password ${{ env.ADMIN_PASSWORD }} --use_metrics_mode no + + - name: Run Setup for E2E Tests + working-directory: ./pmm-qa + run: sudo -E bash -x pmm-tests/pmm-framework.sh ${{ env.CLIENT_FLAGS }} --pmm2 + + - name: Setup npm modules for e2e tests + working-directory: ./pmm-ui-tests + run: | + npm ci + envsubst < env.list > env.generated.list + + - name: Execute e2e tests with tags ${{ env.TAGS_FOR_TESTS }} + working-directory: ./pmm-ui-tests + env: + SERVER_IP : "127.0.0.1" + PMM_UI_URL : "http://127.0.0.1/" + PMM_URL : "http://admin:${{ env.ADMIN_PASSWORD }}@${{ env.SERVER_IP }}" + run: | + sed -i 's+http://localhost/+${PMM_UI_URL}/+g' pr.codecept.js + ./node_modules/.bin/codeceptjs run -c pr.codecept.js --grep "${{ env.TAGS_FOR_TESTS }}" + + - uses: actions/github-script@v7 + if: ${{ always() }} + id: artifact_name + with: + script: | + return `artifacts_for_${process.env.TAGS_FOR_TESTS.replaceAll('|', '')}` + result-encoding: string + + - name: Create status check + if: ${{ github.event_name != 'pull_request' && always() }} + uses: percona/gh-action-github-status-action@v1 + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.TAGS_FOR_TESTS }} UI tests" + description: "Test execution ${{ job.status }}" + state: ${{ job.status }} + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + +# - name: Setup tmate session on failure +# if: ${{ failure() }} +# uses: percona-platform/action-tmate@v2 diff --git a/.github/workflows/runner-e2e-upgrade-tests.yml b/.github/workflows/runner-e2e-upgrade-tests.yml new file mode 100644 index 00000000..b0cdc070 --- /dev/null +++ b/.github/workflows/runner-e2e-upgrade-tests.yml @@ -0,0 +1,435 @@ +--- +name: runner-upgrade-tests + +on: + workflow_call: + inputs: + pmm_ui_tests_branch: + description: 'pmm-ui-tests repository branch' + default: 'main' + type: string + required: true + pre_upgrade_tests: + description: 'Tag(s) to run tests before upgrade' + type: string + required: true + post_upgrade_tests: + description: 'Tag(s) to run tests after upgrade' + type: string + required: true + pmm_server_start_version: + description: 'PMM Server version to upgrade (latest|dev-latest|x.xx.x|x.xx.x-rc)' + default: 'latest' + type: string + required: true + pmm_client_start_version: + description: 'PMM Client version to upgrade from (dev-latest|pmm2-latest|pmm2-rc|x.xx.x)' + default: 'pmm2-latest' + type: string + required: true + upgrade_type: + description: 'Upgrade way:' + required: true + default: 'UI way' + type: string + pmm_qa_branch: + description: 'pmm-qa repository branch(for setup)' + default: 'main' + type: string + required: true + services_list: + description: 'Services for pmm-server' + default: '--addclient=ps,1' + type: string + required: true + repository: + description: 'Upgrade to:' + required: true + default: 'dev-latest' + type: string + version_string_from: + description: 'start version string' + type: string + version_string_to: + description: 'finish version string' + type: string + + workflow_dispatch: + inputs: + pmm_ui_tests_branch: + description: 'pmm-ui-tests repository branch' + default: 'main' + required: true + pre_upgrade_tests: + description: 'Tag(s) to run tests before upgrade' + required: true + post_upgrade_tests: + description: 'Tag(s) to run tests after upgrade' + required: true + pmm_server_start_version: + description: 'PMM Server version to upgrade from (latest|dev-latest|x.xx.x|x.xx.x-rc)' + default: 'latest' + required: true + pmm_client_start_version: + description: 'PMM Client version to upgrade from (dev-latest|pmm2-latest|pmm2-rc|x.xx.x)' + default: 'pmm2-latest' + required: true + upgrade_type: + description: 'Upgrade way:' + required: true + default: 'UI way' + type: choice + options: + - 'UI way' + - 'Docker way' + pmm_qa_branch: + description: 'pmm-qa repository branch(for setup)' + default: 'main' + required: true + services_list: + description: 'Services for pmm-server' + default: '--addclient=ps,1' + required: true + repository: + description: 'Upgrade to:' + required: true + default: 'dev-latest' + type: choice + options: + - 'release' + - 'release candidate' + - 'dev-latest' + +jobs: + tests: + name: '${{ inputs.upgrade_type }} "${{ inputs.version_string_from || inputs.pmm_server_start_version }}" -> "${{ inputs.version_string_to || inputs.repository }}"' + runs-on: ubuntu-latest + timeout-minutes: 60 + env: + # TODO: each variable/group must have comment where it is used + SHA: ${{ inputs.sha || 'null' }} + PMM_BASE_URL: https://127.0.0.1 + + ### IP and Pass to use in pipeline + PMM_SERVER_IP: 127.0.0.1 + ADMIN_PASSWORD: admin1 + + OKTA_TOKEN: ${{ secrets.OKTA_TOKEN }} + OAUTH_ISSUER_URL: 'https://id-dev.percona.com/oauth2/aus15pi5rjdtfrcH51d7' + OAUTH_CLIENT_ID: ${{ secrets.OKTA_OAUTH_CLIENT_ID }} + OAUTH_CLIENT_SECRET: ${{ secrets.OKTA_OAUTH_CLIENT_SECRET }} + OAUTH_PMM_CLIENT_ID: ${{ secrets.OKTA_OAUTH_PMM_CLIENT_ID }} + OAUTH_PMM_CLIENT_SECRET: ${{ secrets.OKTA_OAUTH_PMM_CLIENT_SECRET }} + OAUTH_DEV_HOST: ${{ secrets.OAUTH_DEV_HOST }} + OAUTH_SCOPES: percona + + ### inject "upgrade from" version for test conditional + PMM_SERVER_START_VERSION: ${{ inputs.version_string_from || inputs.pmm_server_start_version }} + + # Variables for E2E tests + MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }} + MAILOSAUR_UI_TESTS_SERVER_ID: ${{ secrets.MAILOSAUR_UI_TESTS_SERVER_ID }} + MAILOSAUR_API_TESTS_SERVER_ID: ${{ secrets.MAILOSAUR_API_TESTS_SERVER_ID }} + + SERVICENOW_LOGIN: percona_platform + SERVICENOW_PASSWORD: ${{ secrets.SERVICENOW_PASSWORD }} + SERVICENOW_DEV_URL: 'https://perconadev.service-now.com/api/x_pellc_percona_pl/platform/settest' + + steps: + - name: 'Set job tag' + run: | + job_tag=$(echo "${{ inputs.pre_upgrade_tests }}" | sed -e "s/-pre-upgrade//" -e "s/@//") + echo $job_tag + echo "JOB_TAG=$job_tag" >> $GITHUB_ENV + + - name: 'PMM Server(${{ inputs.pmm_server_start_version }}) and UI tests with tags "${{ inputs.pre_upgrade_tests }}, ${{ inputs.post_upgrade_tests }}" from pmm-ui-tests branch: ${{ inputs.pmm_ui_tests_branch }}' + if: ${{ env.SHA != 'null' }} + uses: percona/gh-action-github-status-action@v1 + with: + context: 'PMM Upgrade Tests ${{ env.REPORT_NAME }}' + description: "Test execution ${{ job.status }}" + state: 'pending' + repository: ${{ inputs.repository }} + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + sha: ${{ env.SHA }} + + - name: 'Convert choice into repo' + uses: actions/github-script@v6 + id: target_repo + with: + script: | + switch ('${{ inputs.repository }}') { + case 'release': + return 'release'; + case 'release candidate': + return 'testing' + case 'dev-latest': + return 'experimental' + } + result-encoding: string + + - name: 'Select from image' + uses: actions/github-script@v6 + id: pmm_server_start_image + with: + script: | + const tag = '${{ inputs.pmm_server_start_version }}'; + let repo = 'percona'; + if (tag.includes('dev-') || tag.includes('-rc')) { + repo = 'perconalab'; + } + console.log(JSON.stringify(context.payload)); + return `${repo}/pmm-server:${tag}` + result-encoding: string + + - name: 'Select to image' + id: pmm_server_to_image + shell: bash + run: | + if [[ "${{ inputs.repository }}" = "dev-latest" ]]; then + echo "IMAGE=perconalab/pmm-server:dev-latest" >> "$GITHUB_OUTPUT" + fi + if [[ "${{ inputs.repository }}" = "release candidate" ]]; then + if [[ -z "${{ inputs.version_string_to }}" ]]; then + rc_latest=$(wget -q "https://registry.hub.docker.com/v2/repositories/perconalab/pmm-client/tags?page_size=25&name=rc" -O - | jq -r .results[].name | grep 2.*.*-rc$ | sort -V | tail -n1) + echo "IMAGE=perconalab/pmm-server:$rc_latest" >> "$GITHUB_OUTPUT" + else + echo "IMAGE=perconalab/pmm-server:${{ inputs.version_string_to }}" >> "$GITHUB_OUTPUT" + fi + fi + if [[ "${{ inputs.repository }}" = "release" ]]; then + if [[ -z "${{ inputs.version_string_to }}" ]]; then + r_latest=$(wget -q https://registry.hub.docker.com/v2/repositories/percona/pmm-client/tags -O - | jq -r .results[].name | grep -v latest | sort -V | tail -n1) + echo "IMAGE=percona/pmm-server:$r_latest" >> "$GITHUB_OUTPUT" + else + echo "IMAGE=percona/pmm-server:${{ inputs.version_string_to }}" >> "$GITHUB_OUTPUT" + fi + fi + + - name: 'Checkout UI tests: "${{ inputs.pmm_ui_tests_branch }}"' + uses: actions/checkout@v3 + with: + ref: ${{ inputs.pmm_ui_tests_branch }} + repository: percona/pmm-ui-tests + path: ./pmm-ui-tests + + - name: 'Install playwright' + working-directory: ./pmm-ui-tests/playwright-tests + run: | + npm install + npx playwright install + + - name: 'Checkout pmm-qa: "${{ inputs.pmm_qa_branch }}"' + uses: actions/checkout@v3 + with: + # token: ${{ secrets.ROBOT_TOKEN }} + repository: percona/pmm-qa + ref: ${{ inputs.pmm_qa_branch }} + path: ./pmm-qa + + - name: 'Install Podman' + if: ${{ inputs.upgrade_type == 'Podman way' }} + working-directory: ./pmm-ui-tests + run: | + . /etc/os-release + echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee \ + /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list + curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add - + sudo apt-get update + sudo apt-get -y upgrade + sudo apt-get install -y podman + sudo sysctl net.ipv4.ip_unprivileged_port_start=80 + + - name: 'Setup Podman : "${{ steps.pmm_server_start_image.outputs.result }}"' + if: ${{ inputs.upgrade_type == 'Podman way' }} + working-directory: ./pmm-ui-tests + run: | + ### create service files + mkdir -p ~/.config/systemd/user/ + cat > ~/.config/systemd/user/pmm-server.service < ~/.config/pmm-server/pmm-server.env <: "${{ steps.pmm_server_start_image.outputs.result }}"' + if: ${{ inputs.upgrade_type != 'Podman way' }} + working-directory: pmm-qa/pmm-integration + run: | + npm install + sudo npx ts-node ./integration-setup.ts --ci --setup-docker-pmm-server --rbac --pmm-server-docker-tag=${{ steps.pmm_server_start_image.outputs.result }} --pmm-client-version=${{ inputs.pmm_client_start_version }} + timeout 100 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/ping)" != "200" ]]; do sleep 5; done' || false + docker exec pmm-integration-server change-admin-password ${{ env.ADMIN_PASSWORD }} + + - name: 'Setup and Services' + run: | + sudo bash ./pmm-qa/pmm-tests/pmm2-client-setup.sh --pmm_server_ip ${{ env.PMM_SERVER_IP }} --client_version ${{ inputs.pmm_client_start_version }} --admin_password ${{ env.ADMIN_PASSWORD }} --use_metrics_mode no + sudo bash ./pmm-qa/pmm-tests/pmm-framework.sh \ + --download \ + ${{ inputs.services_list }} \ + --pmm2 \ + --pmm2-server-ip=${{ env.PMM_SERVER_IP }} + # TODO: change sleep into fluent wait + sleep 30 + sudo pmm-admin list + shell: bash + + - name: 'Tests upgrade' + id: ui-tests-flagged + working-directory: ./pmm-ui-tests/playwright-tests + run: | + project="${{ contains(env.PMM_TEST_FLAG, 'portal') && 'Portal' || 'Chromium' }}" + npx playwright test --project=$project --grep="${{ inputs.pre_upgrade_tests }}" --pass-with-no-tests + env: + NODE_TLS_REJECT_UNAUTHORIZED: 0 + + - name: 'Enable <${{ steps.target_repo.outputs.result }}> repo in pmm-server container' + if: ${{ inputs.upgrade_type == 'UI way' }} + working-directory: ./pmm-ui-tests/playwright-tests + run: | + docker exec pmm-integration-server yum update -y percona-release || true + if [[ "${{ inputs.repository }}" != "release" ]]; then + docker exec pmm-integration-server sed -i'' -e 's^/release/^/${{ steps.target_repo.outputs.result }}/^' /etc/yum.repos.d/pmm2-server.repo + docker exec pmm-integration-server percona-release enable-only original ${{ steps.target_repo.outputs.result }} + fi + docker exec pmm-integration-server yum clean all + + # TODO: could be exchanged to the clicking "refresh" button in tests + sleep 60 + env: + NODE_TLS_REJECT_UNAUTHORIZED: 0 + + - name: 'Upgrade pmm-server: ' + if: ${{ inputs.upgrade_type == 'UI way' }} + working-directory: ./pmm-ui-tests/playwright-tests + run: npx playwright test --project=Chromium --grep="@pmm-upgrade" + env: + NODE_TLS_REJECT_UNAUTHORIZED: 0 + + - name: 'Upgrade pmm-server: ' + if: ${{ inputs.upgrade_type == 'Docker way' }} + working-directory: ./pmm-ui-tests + run: | + # TODO: implement qa-integration docker upgrade + echo "Upgrading to ${{ steps.pmm_server_to_image.outputs.IMAGE }}" + docker stop pmm-integration-server + docker pull ${{ steps.pmm_server_to_image.outputs.IMAGE }} + docker rename pmm-integration-server pmm-integration-server-old + docker run --detach --restart always \ + --network="pmm-integration-network" \ + -e PMM_DEBUG=1 \ + --publish 80:80 --publish 443:443 \ + --volumes-from pmm-integration-server-data \ + --name pmm-integration-server \ + ${{ steps.pmm_server_to_image.outputs.IMAGE }} + timeout 240 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://${{ env.PMM_SERVER_IP }}/v1/readyz)" != "200" ]]; do sleep 2; done' || false + + - name: 'Upgrade pmm-server: ' + if: ${{ inputs.upgrade_type == 'Podman way' }} + working-directory: ./pmm-ui-tests + run: | + echo "Upgrading to ${{ steps.pmm_server_to_image.outputs.IMAGE }}" + mkdir -p ~/.config/pmm-server/ + echo "PMM_SERVER_IMAGE=docker.io/${{ steps.pmm_server_to_image.outputs.IMAGE }}" > ~/.config/pmm-server/env + source ~/.config/pmm-server/env + podman pull docker.io/${{ steps.pmm_server_to_image.outputs.IMAGE }} + systemctl --user restart pmm-server + + timeout 240 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://${{ env.PMM_SERVER_IP }}/v1/readyz)" != "200" ]]; do sleep 2; done' || false + + - name: 'Tests upgrade' + working-directory: ./pmm-ui-tests/playwright-tests + run: | + echo "Hook to inject tests: test are coming soon..." + + - name: 'Upgrade to the latest on "${{ steps.target_repo.outputs.result }}" repo' + if: ${{ inputs.pmm_client_upgrade_version == '' }} + run: | + sudo percona-release enable-only original ${{ steps.target_repo.outputs.result }} + sudo apt-get update -y + sudo apt -y install pmm2-client + + # TODO: add client check after update here + + - name: 'Tests upgrading Client and Server' + working-directory: ./pmm-ui-tests/playwright-tests + run: | + project="${{ contains(env.PMM_TEST_FLAG, 'portal') && 'Portal' || 'Chromium' }}" + npx playwright test --project=$project --grep="${{ inputs.post_upgrade_tests }}" --pass-with-no-tests + env: + NODE_TLS_REJECT_UNAUTHORIZED: 0 + + - name: 'Create report name' + if: failure() + run: | + # TODO: add job id for matrix call + report_name=${{ env.JOB_TAG }}-${{ inputs.version_string_from || inputs.pmm_server_start_version }}-report + echo $report_name + echo "REPORT_NAME=$report_name" >> $GITHUB_ENV + + - name: Generate and Attach the report + if: failure() + uses: actions/upload-artifact@v3 + with: + name: ${{ env.REPORT_NAME }} + path: ./pmm-ui-tests/playwright-tests/playwright-report diff --git a/.github/workflows/runner-package-test.yml b/.github/workflows/runner-package-test.yml new file mode 100644 index 00000000..cc5bd38a --- /dev/null +++ b/.github/workflows/runner-package-test.yml @@ -0,0 +1,307 @@ +--- +name: runner-package-test + +on: + workflow_dispatch: + inputs: + package_testing_branch: + description: "Target branch for package-testing repository" + type: string + default: "master" + required: true + pmm_server_image: + description: "pmm-server docker image(auto detected if empty)" + required: false + type: string + default: "perconalab/pmm-server:dev-latest" + pmm_client_tarball: + description: "PMM Client tarball link or FB-code" + type: string + expected_version: + description: "expected version" + required: false + type: string + # TODO: investigate switch to actual repo name: experimental | testing | main | pmm2-client-main + repository: + description: "Select Repo to install PMM Client:" + required: true + default: "dev-latest" + type: choice + options: + - release + - release candidate + - dev-latest + metrics_mode: + description: "Select the Metrics Mode for PMM Client:" + required: true + default: "auto" + type: choice + options: + - auto + - push + - pull + playbook: + description: "Playbook file to run(without extension)" + type: string + default: "pmm2-client_integration" + required: true + test_name: + description: "Optional pretty test name" + type: string + required: false + os: + description: "Select OS to run test in:" + required: true + default: "jammy" + type: choice + options: + - bullseye + - buster + - bookworm + - focal + - jammy + - centos-7 + - ol-8 + - ol-9 + + workflow_call: + inputs: + package_testing_branch: + type: string + default: "master" + required: true + pmm_server_image: + required: false + type: string + pmm_client_tarball: + required: false + type: string + expected_version: + required: false + type: string + repository: + required: true + default: "dev-latest" + type: string + metrics_mode: + required: true + default: "auto" + type: string + playbook: + type: string + default: "pmm2-client_integration" + required: true + test_name: + type: string + required: false + os: + description: "Select OS to run test in:" + required: true + default: "jammy" + type: string + +jobs: + test: + name: ${{ inputs.test_name || inputs.playbook}} + runs-on: ubuntu-latest + timeout-minutes: 40 + env: + SHA: ${{ inputs.sha || 'null' }} + PACKAGE_TESTING_BRANCH: ${{ inputs.package_testing_branch || 'master' }} + PMM_SERVER_IMAGE: ${{ inputs.pmm_server_image }} + TARBALL: ${{ inputs.pmm_client_tarball || 'null' }} + EXPECTED_VERSION: ${{ inputs.expected_version }} + + REPO: ${{ inputs.repository || 'dev-latest' }} + METRICS_MODE: ${{ inputs.metrics_mode || 'auto' }} + PLAYBOOK: ${{ inputs.playbook }} + VERBOSE: "no" + + steps: + - name: "Create status check" + if: ${{ env.SHA != 'null' }} + uses: percona/gh-action-github-status-action@v1 + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ inputs.test_name }} Package test" + description: "Test execution ${{ job.status }}" + state: "pending" + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + + - name: 'Checkout package-testing: "${{ inputs.package_testing_branch }}"' + uses: actions/checkout@v4 + with: + repository: Percona-QA/package-testing + ref: ${{ inputs.package_testing_branch }} + + - name: 'Convert choices' + run: | + ### pmm-server docker image ### + if [[ -z "${{ env.PMM_SERVER_IMAGE }}" ]]; then + if [[ "${{ inputs.repository }}" = "dev-latest" ]]; then + echo "PMM_SERVER_IMAGE=perconalab/pmm-server:dev-latest" >> $GITHUB_ENV + fi + if [[ "${{ inputs.repository }}" =~ "candidate" ]]; then + rc_latest=$(wget -q "https://registry.hub.docker.com/v2/repositories/perconalab/pmm-client/tags?page_size=25&name=rc" -O - | jq -r .results[].name | grep 2.*.*-rc$ | sort -V | tail -n1) + echo "PMM_SERVER_IMAGE=perconalab/pmm-server:$rc_latest" >> $GITHUB_ENV + fi + if [[ "${{ inputs.repository }}" = "release" ]]; then + r_latest=$(wget -q https://registry.hub.docker.com/v2/repositories/percona/pmm-client/tags -O - | jq -r .results[].name | grep -v latest | sort -V | tail -n1) + echo "PMM_SERVER_IMAGE=percona/pmm-server:$r_latest" >> $GITHUB_ENV + fi + fi + echo "${{ env.PMM_SERVER_IMAGE }}" + + ### pmm2-client repository ### + if [[ "${{ inputs.repository }}" = "dev-latest" ]]; then + echo "REPO=experimental" >> $GITHUB_ENV + fi + if [[ "${{ inputs.repository }}" =~ "candidate" ]]; then + echo "REPO=testing" >> $GITHUB_ENV + echo "EXPECTED_VERSION=$(echo ${{ inputs.expected_version }} | awk -F'-' '{print $1}')" >> $GITHUB_ENV + echo "expected version is ${{ env.EXPECTED_VERSION }}" + fi + echo "repo=${{ env.REPO }}" + + ### vagrant vm ### + if [[ "${{ inputs.os }}" =~ "buster" ]]; then + echo "VM_BOX=generic/debian10" >> $GITHUB_ENV + fi + if [[ "${{ inputs.os }}" =~ "bullseye" ]]; then + echo "VM_BOX=generic/debian11" >> $GITHUB_ENV + fi + if [[ "${{ inputs.os }}" =~ "bookworm" ]]; then + echo "VM_BOX=generic/debian12" >> $GITHUB_ENV + fi + if [[ "${{ inputs.os }}" =~ "bionic" ]]; then + echo "VM_BOX=generic/ubuntu1804" >> $GITHUB_ENV + fi + if [[ "${{ inputs.os }}" =~ "focal" ]]; then + echo "VM_BOX=generic/ubuntu2004" >> $GITHUB_ENV + fi + if [[ "${{ inputs.os }}" =~ "jammy" ]]; then + echo "VM_BOX=generic/ubuntu2204" >> $GITHUB_ENV + fi + if [[ "${{ inputs.os }}" =~ "centos-7" ]]; then + echo "VM_BOX=generic/centos7" >> $GITHUB_ENV + fi + if [[ "${{ inputs.os }}" =~ "ol-8" ]]; then + echo "VM_BOX=generic/oracle8" >> $GITHUB_ENV + fi + if [[ "${{ inputs.os }}" =~ "ol-9" ]]; then + echo "VM_BOX=generic/oracle9" >> $GITHUB_ENV + fi + echo "${{ env.VM_BOX }}" + + ### test name -> playbook map ### + # basic -> pmm2-client.yml + # basic upgrade -> pmm2-client_upgrade.yml + # basic tarball -> pmm2-client_custom_path.yml + + # config password -> pmm2-client_integration_auth_config.yml + # register password -> pmm2-client_integration_auth_register.yml + # tarball setup password -> pmm2-client_integration_auth_setup.yml + # tarball path -> pmm2-client_integration_custom_path.yml + # tarball port -> pmm2-client_integration_custom_port.yml + # integration upgrade port -> pmm2-client_integration_upgrade_custom_port.yml + + ######### Matrix tests + # integration -> pmm2-client_integration.yml + # integration upgrade -> pmm2-client_integration_upgrade.yml + # tarball upgrade path -> pmm2-client_integration_upgrade_custom_path.yml + + + - name: 'Setup "${{ env.PMM_SERVER_IMAGE }}"' + run: | + docker create -v /srv --name pmm-server-data ${{ env.PMM_SERVER_IMAGE }} + docker run -d -p 80:80 -p 443:443 -p 9000:9000 \ + --volumes-from pmm-server-data --name pmm-server --restart always ${{ env.PMM_SERVER_IMAGE }} + + - name: "Setup tools" + run: | + sudo apt-get update + sudo apt-get install -y apt-transport-https ca-certificates ansible virtualbox vagrant + if [[ "${{ inputs.os }}" =~ "buster" ]]; then + vagrant plugin install vagrant-vbguest + fi + + - name: "Wait for PMM Server to be healthy" + run: | + timeout 240 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://127.0.0.1/v1/readyz)" != "200" ]]; do sleep 2; done' || false + + - name: "Create vagrantfile" + working-directory: ./ + run: | + pwd + # mkdir -p ~/test-vm/ + # cat > ~/test-vm/Vagrantfile < Vagrantfile <= 1.7.0" + Vagrant.configure(2) do |config| + config.vm.box = "${{ env.VM_BOX }}" + ${{ contains(env.VM_BOX, 'debian10') && 'config.vbguest.auto_update = true' }} + config.ssh.insert_key = false + config.vm.define :CLIENT_TEST do |t| + end + + config.vm.synced_folder "${{ github.workspace }}/", "/pmm/package-testing/" + config.vm.provision "shell", privileged: true, inline: <<-SHELL + ## Set environment variables... + export PMM_SERVER_IP=10.0.2.2:443 + export METRICS_MODE=${{ env.METRICS_MODE }} + export PMM_VERSION="${{ env.EXPECTED_VERSION }}" + export install_repo=${{ env.REPO }} + if [[ "${{ env.TARBALL }}" != "null" ]]; then + export tarball_link=${{ env.TARBALL }} + fi + + if [[ "${{ env.VM_BOX }}" =~ "centos7" ]]; then + sudo yum install -y epel-release + sudo yum -y update + sudo yum install -y ansible git wget + fi + if [[ "${{ env.VM_BOX }}" =~ "oracle" ]]; then + sudo yum install -y epel-release + sudo yum -y update + sudo yum install -y ansible-core git wget + fi + if [[ "${{ env.VM_BOX }}" =~ "debian" ]]; then + sudo apt-get install -y dirmngr gnupg2 + echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list > /dev/null + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 + sudo apt update -y + sudo apt-get install -y ansible git wget + fi + if [[ "${{ env.VM_BOX }}" =~ "ubuntu" ]]; then + sudo apt update -y + sudo apt install -y software-properties-common + sudo apt-add-repository --yes --update ppa:ansible/ansible + sudo apt-get install -y ansible git wget + fi + cd /pmm/package-testing/playbooks + ###TODO: consider adding "-vv" flag based on input." + ansible-playbook ${{env.VERBOSE == 'yes' && '-vv' || ''}} --connection=local --inventory 127.0.0.1, --limit 127.0.0.1 ${{ env.PLAYBOOK }}.yml + SHELL + end + + EOF + + - name: "Run (${{ contains(env.TARBALL, 'PR-') && 'feature build' || inputs.repository }})${{ inputs.playbook }} test on ${{ inputs.os }}" + working-directory: ./ + run: vagrant up + + - name: "Create status check" + uses: percona/gh-action-github-status-action@v1 + if: ${{ env.SHA != 'null' && always() }} + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ inputs.test_name }} Package test" + description: "Test execution ${{ job.status }}" + state: ${{ job.status }} + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }}