From 52f6243a2fead312be417a2de9d32df3dd804e44 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:02:12 +0530 Subject: [PATCH 01/18] test --test --- .github/workflows/full-integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/full-integration-test.yml b/.github/workflows/full-integration-test.yml index 7d454285..8d562a11 100644 --- a/.github/workflows/full-integration-test.yml +++ b/.github/workflows/full-integration-test.yml @@ -62,7 +62,7 @@ jobs: run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check - name: Run integration test - run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage + run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage --test alert_contact_point working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - name: Cooling Period From 56683162a55e9ec4c750bedb4ab590690dde4ead Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:03:21 +0530 Subject: [PATCH 02/18] update ci-tests.yml --- .github/workflows/ci-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index c5c1267c..f4540d0a 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -86,5 +86,5 @@ jobs: run: pip install requests - name: Run integration test - run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker --test alert_contact_point working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} From 502f729406f01299192570da46c28a4cd247bcdd Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:07:05 +0530 Subject: [PATCH 03/18] try --inlcude --- .github/workflows/ci-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index f4540d0a..99d0569c 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -86,5 +86,5 @@ jobs: run: pip install requests - name: Run integration test - run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker --test alert_contact_point + run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker --include alert_contact_point working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} From 09c119279dc6fc467e0c82bd7c9ec71a04a1494c Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:08:38 +0530 Subject: [PATCH 04/18] test neutral --- .github/workflows/ci-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 99d0569c..2a3975bf 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -86,5 +86,5 @@ jobs: run: pip install requests - name: Run integration test - run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker --include alert_contact_point + run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker alert_contact_point working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} From 266a46cd57001175c2785cca8c93341add3bf777 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:15:14 +0530 Subject: [PATCH 05/18] --target --- .github/workflows/ci-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 2a3975bf..ef97fbe8 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -86,5 +86,5 @@ jobs: run: pip install requests - name: Run integration test - run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker alert_contact_point + run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker --target alert_contact_point working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} From 01a32cf4c32c050592c7dc089e8b968b828330aa Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:16:38 +0530 Subject: [PATCH 06/18] rephrase --- .github/workflows/ci-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index ef97fbe8..c3eb9da6 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -86,5 +86,5 @@ jobs: run: pip install requests - name: Run integration test - run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker --target alert_contact_point + run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} From 87d8125623124c39456e1a116611e98978915e94 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:25:12 +0530 Subject: [PATCH 07/18] update tests --- .github/workflows/full-integration-test.yml | 32 ++++- .github/workflows/modules-test.yml | 118 ++++++++++++++++++ .github/workflows/release.yml | 32 ++++- .../workflows/{ci-test.yml => roles-test.yml} | 8 +- 4 files changed, 182 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/modules-test.yml rename .github/workflows/{ci-test.yml => roles-test.yml} (89%) diff --git a/.github/workflows/full-integration-test.yml b/.github/workflows/full-integration-test.yml index 8d562a11..bbe31722 100644 --- a/.github/workflows/full-integration-test.yml +++ b/.github/workflows/full-integration-test.yml @@ -61,8 +61,36 @@ jobs: - name: Install ansible-base (${{ matrix.ansible }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check - - name: Run integration test - run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage --test alert_contact_point + - name: Test module alert_contact_point + run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module alert_notification_policy + run: ansible-test integration -v alert_notification_policy --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module cloud_api_key + run: ansible-test integration -v cloud_api_key --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module cloud_plugin + run: ansible-test integration -v cloud_plugin --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module cloud_stack + run: ansible-test integration -v cloud_stack --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module dashboard + run: ansible-test integration -v dashboard --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module datasource + run: ansible-test integration -v datasource --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module folder + run: ansible-test integration -v folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - name: Cooling Period diff --git a/.github/workflows/modules-test.yml b/.github/workflows/modules-test.yml new file mode 100644 index 00000000..a644fd39 --- /dev/null +++ b/.github/workflows/modules-test.yml @@ -0,0 +1,118 @@ +--- +name: Modules Test + +# yamllint disable-line rule:truthy +on: + push: + branches: + - "main" + pull_request: + schedule: + - cron: '0 6 * * *' +env: + NAMESPACE: grafana + COLLECTION_NAME: grafana + +jobs: + + sanity: + name: Sanity (Ⓐ${{ matrix.ansible }}) + strategy: + matrix: + ansible: + - stable-2.12 + - stable-2.13 + - stable-2.14 + - devel + runs-on: ubuntu-20.04 + steps: + + - name: Check out code + uses: actions/checkout@v3 + with: + path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.10' + + - name: Install ansible-base (${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check + + - name: Run sanity tests + run: ansible-test sanity -v --docker --color --coverage + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + integration: + runs-on: ubuntu-20.04 + name: Integration (Ⓐ${{ matrix.ansible }}-py${{ matrix.python }}) + strategy: + fail-fast: true + max-parallel: 1 + matrix: + ansible: + - stable-2.13 + python: + - '3.10' + + steps: + - name: Check out code + uses: actions/checkout@v2 + with: + path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: create integration_config + working-directory: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/tests/integration + run: | + cat < integration_config.yml + stack_name: ${{ secrets.ANSIBLE_TEST_STACK_NAME }} + org_name: ${{ secrets.ANSIBLE_TEST_ORG_NAME }} + grafana_cloud_api_key: ${{ secrets.ANSIBLE_TEST_CLOUD_API_KEY }} + grafana_api_key: ${{ secrets.ANSIBLE_TEST_GRAFANA_API_KEY }} + grafana_url: ${{ secrets.ANSIBLE_GRAFANA_URL }} + test_stack_name: ${{ secrets.ANSIBLE_TEST_CI_STACK }} + EOF + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + + - name: Install ansible-base (${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check + + - name: Install Requests + run: pip install requests + + - name: Test module alert_contact_point + run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module alert_notification_policy + run: ansible-test integration -v alert_notification_policy --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module cloud_api_key + run: ansible-test integration -v cloud_api_key --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module cloud_plugin + run: ansible-test integration -v cloud_plugin --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module cloud_stack + run: ansible-test integration -v cloud_stack --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module dashboard + run: ansible-test integration -v dashboard --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module datasource + run: ansible-test integration -v datasource --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module folder + run: ansible-test integration -v folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9109ac09..2829ccb2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,8 +79,36 @@ jobs: - name: Install ansible-base (${{ matrix.ansible }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check - - name: Run integration test - run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage + - name: Test module alert_contact_point + run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module alert_notification_policy + run: ansible-test integration -v alert_notification_policy --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module cloud_api_key + run: ansible-test integration -v cloud_api_key --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module cloud_plugin + run: ansible-test integration -v cloud_plugin --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module cloud_stack + run: ansible-test integration -v cloud_stack --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module dashboard + run: ansible-test integration -v dashboard --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module datasource + run: ansible-test integration -v datasource --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + + - name: Test module folder + run: ansible-test integration -v folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} release: diff --git a/.github/workflows/ci-test.yml b/.github/workflows/roles-test.yml similarity index 89% rename from .github/workflows/ci-test.yml rename to .github/workflows/roles-test.yml index c3eb9da6..39a9d4c1 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/roles-test.yml @@ -1,5 +1,5 @@ --- -name: CI Tests +name: Role Test # yamllint disable-line rule:truthy on: @@ -85,6 +85,6 @@ jobs: - name: Install Requests run: pip install requests - - name: Run integration test - run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} + - name: Test role alert_contact_point + run: ansible-test integration -v molecule-grafana-alternative molecule-grafana-default --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} \ No newline at end of file From c9e44dd79f1e4dc2118e848269ed346a6b8db9f3 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:27:30 +0530 Subject: [PATCH 08/18] try 2 in 1 --- .github/workflows/modules-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/modules-test.yml b/.github/workflows/modules-test.yml index a644fd39..82e7f90b 100644 --- a/.github/workflows/modules-test.yml +++ b/.github/workflows/modules-test.yml @@ -86,7 +86,7 @@ jobs: run: pip install requests - name: Test module alert_contact_point - run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + run: ansible-test integration -v alert_contact_point alert_notification_policy --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - name: Test module alert_notification_policy From f070a604220a65ae7d64f35872b7a3d761033cb2 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:33:50 +0530 Subject: [PATCH 09/18] lint --- .github/workflows/modules-test.yml | 42 +++++++++--------------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/.github/workflows/modules-test.yml b/.github/workflows/modules-test.yml index 82e7f90b..070aa02c 100644 --- a/.github/workflows/modules-test.yml +++ b/.github/workflows/modules-test.yml @@ -85,34 +85,16 @@ jobs: - name: Install Requests run: pip install requests - - name: Test module alert_contact_point - run: ansible-test integration -v alert_contact_point alert_notification_policy --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module alert_notification_policy - run: ansible-test integration -v alert_notification_policy --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module cloud_api_key - run: ansible-test integration -v cloud_api_key --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module cloud_plugin - run: ansible-test integration -v cloud_plugin --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module cloud_stack - run: ansible-test integration -v cloud_stack --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module dashboard - run: ansible-test integration -v dashboard --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module datasource - run: ansible-test integration -v datasource --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module folder - run: ansible-test integration -v folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + - name: Test Modules + run: | + ansible-test integration -v \ + alert_contact_point \ + alert_notification_policy \ + cloud_api_key \ + cloud_plugin \ + cloud_stack \ + dashboard \ + datasource \ + folder \ + --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} From c7a2bda718541e3a65de514939438cb6c8c42eaf Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:39:16 +0530 Subject: [PATCH 10/18] one liner --- .github/workflows/modules-test.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/modules-test.yml b/.github/workflows/modules-test.yml index 070aa02c..bb89a0d8 100644 --- a/.github/workflows/modules-test.yml +++ b/.github/workflows/modules-test.yml @@ -86,15 +86,5 @@ jobs: run: pip install requests - name: Test Modules - run: | - ansible-test integration -v \ - alert_contact_point \ - alert_notification_policy \ - cloud_api_key \ - cloud_plugin \ - cloud_stack \ - dashboard \ - datasource \ - folder \ - --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + run: ansible-test integration -v alert_contact_point alert_notification_policy cloud_api_key cloud_plugin cloud_stack dashboard datasource folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} From 066e5060714216496823dd7691f87c35a86c65c6 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:43:45 +0530 Subject: [PATCH 11/18] use one -liners --- .github/workflows/full-integration-test.yml | 32 ++------------------- .github/workflows/release.yml | 32 ++------------------- 2 files changed, 4 insertions(+), 60 deletions(-) diff --git a/.github/workflows/full-integration-test.yml b/.github/workflows/full-integration-test.yml index bbe31722..a7fd9c48 100644 --- a/.github/workflows/full-integration-test.yml +++ b/.github/workflows/full-integration-test.yml @@ -61,36 +61,8 @@ jobs: - name: Install ansible-base (${{ matrix.ansible }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check - - name: Test module alert_contact_point - run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module alert_notification_policy - run: ansible-test integration -v alert_notification_policy --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module cloud_api_key - run: ansible-test integration -v cloud_api_key --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module cloud_plugin - run: ansible-test integration -v cloud_plugin --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module cloud_stack - run: ansible-test integration -v cloud_stack --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module dashboard - run: ansible-test integration -v dashboard --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module datasource - run: ansible-test integration -v datasource --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module folder - run: ansible-test integration -v folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + - name: Test Modules + run: ansible-test integration -v alert_contact_point alert_notification_policy cloud_api_key cloud_plugin cloud_stack dashboard datasource folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - name: Cooling Period diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2829ccb2..ee23c887 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,36 +79,8 @@ jobs: - name: Install ansible-base (${{ matrix.ansible }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check - - name: Test module alert_contact_point - run: ansible-test integration -v alert_contact_point --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module alert_notification_policy - run: ansible-test integration -v alert_notification_policy --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module cloud_api_key - run: ansible-test integration -v cloud_api_key --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module cloud_plugin - run: ansible-test integration -v cloud_plugin --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module cloud_stack - run: ansible-test integration -v cloud_stack --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module dashboard - run: ansible-test integration -v dashboard --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module datasource - run: ansible-test integration -v datasource --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} - - - name: Test module folder - run: ansible-test integration -v folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker + - name: Test Modules + run: ansible-test integration -v alert_contact_point alert_notification_policy cloud_api_key cloud_plugin cloud_stack dashboard datasource folder --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} release: From a36c0ff5cacd833421d3be06d262e813d3b4b614 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:44:18 +0530 Subject: [PATCH 12/18] update roles-test --- .github/workflows/roles-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/roles-test.yml b/.github/workflows/roles-test.yml index 39a9d4c1..47773da0 100644 --- a/.github/workflows/roles-test.yml +++ b/.github/workflows/roles-test.yml @@ -85,6 +85,6 @@ jobs: - name: Install Requests run: pip install requests - - name: Test role alert_contact_point + - name: Test Roles run: ansible-test integration -v molecule-grafana-alternative molecule-grafana-default --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} \ No newline at end of file From 8bfb004b77a219f8beb6c1976ae476ac902214d8 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 14:44:29 +0530 Subject: [PATCH 13/18] name fix --- .github/workflows/roles-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/roles-test.yml b/.github/workflows/roles-test.yml index 47773da0..16bf3b37 100644 --- a/.github/workflows/roles-test.yml +++ b/.github/workflows/roles-test.yml @@ -1,5 +1,5 @@ --- -name: Role Test +name: Roles Test # yamllint disable-line rule:truthy on: From 2d4ee20f3f4bc95b1398df4545fd4d40af92bcc1 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 15:02:38 +0530 Subject: [PATCH 14/18] Lint updates --- roles/grafana_agent/tasks/configure.yaml | 6 +++--- roles/grafana_agent/tasks/ga-started.yaml | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/roles/grafana_agent/tasks/configure.yaml b/roles/grafana_agent/tasks/configure.yaml index 123c922a..6e2bdf7f 100644 --- a/roles/grafana_agent/tasks/configure.yaml +++ b/roles/grafana_agent/tasks/configure.yaml @@ -18,7 +18,7 @@ owner: root group: root mode: 0644 - notify: "restart grafana-agent" + notify: "restart grafana-agent" - name: Create the Service Environment file ansible.builtin.template: @@ -37,7 +37,7 @@ owner: root group: "{{ grafana_agent_user_group }}" mode: 0640 - notify: "restart grafana-agent" + notify: "restart grafana-agent" when: grafana_agent_provisioned_config_file | length == 0 - name: Copy Grafana Agent config @@ -47,5 +47,5 @@ owner: root group: "{{ grafana_agent_user_group }}" mode: 0640 - notify: "restart grafana-agent" + notify: "restart grafana-agent" when: grafana_agent_provisioned_config_file | length > 0 diff --git a/roles/grafana_agent/tasks/ga-started.yaml b/roles/grafana_agent/tasks/ga-started.yaml index 01106f42..8870eed5 100644 --- a/roles/grafana_agent/tasks/ga-started.yaml +++ b/roles/grafana_agent/tasks/ga-started.yaml @@ -7,22 +7,22 @@ register: _result failed_when: false until: _result.status == 200 - retries: 3 + retries: 3 delay: 5 changed_when: false - name: Check system logs if Grafana Agent is not started - when: _result.status != 200 + when: _result.status != 200 block: - name: Run journalctl ansible.builtin.shell: - cmd: "journalctl -u grafana-agent -b -n20 --no-pager" + cmd: "journalctl -u grafana-agent -b -n20 --no-pager" register: journal_ret changed_when: false - name: Output Grafana agent logs ansible.builtin.debug: - var: journal_ret.stdout_lines - - name: Rise alerts + var: journal_ret.stdout_lines + - name: Rise alerts ansible.builtin.assert: that: false - fail_msg: "Service grafana-agent hasn't started." + fail_msg: "Service grafana-agent hasn't started." From 2530300aa0772402cc85685799d8f0719d13eac2 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 15:04:17 +0530 Subject: [PATCH 15/18] remove stack name --- .github/workflows/modules-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/modules-test.yml b/.github/workflows/modules-test.yml index bb89a0d8..9f0477f2 100644 --- a/.github/workflows/modules-test.yml +++ b/.github/workflows/modules-test.yml @@ -66,7 +66,6 @@ jobs: working-directory: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/tests/integration run: | cat < integration_config.yml - stack_name: ${{ secrets.ANSIBLE_TEST_STACK_NAME }} org_name: ${{ secrets.ANSIBLE_TEST_ORG_NAME }} grafana_cloud_api_key: ${{ secrets.ANSIBLE_TEST_CLOUD_API_KEY }} grafana_api_key: ${{ secrets.ANSIBLE_TEST_GRAFANA_API_KEY }} From 98b47f7d99a7eeac1459a70b2d3d82b0d9386135 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 15:04:54 +0530 Subject: [PATCH 16/18] newline --- .github/workflows/roles-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/roles-test.yml b/.github/workflows/roles-test.yml index 16bf3b37..95955054 100644 --- a/.github/workflows/roles-test.yml +++ b/.github/workflows/roles-test.yml @@ -87,4 +87,4 @@ jobs: - name: Test Roles run: ansible-test integration -v molecule-grafana-alternative molecule-grafana-default --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --coverage --docker - working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} \ No newline at end of file + working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} From ea8e836351af2f86fcffa8d4af87e1fcbac16213 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 15:11:04 +0530 Subject: [PATCH 17/18] unhold role tests --- .../molecule-grafana-alternative/{runme.sh.hold => runme.sh} | 0 .../targets/molecule-grafana-default/{runme.sh.hold => runme.sh} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/integration/targets/molecule-grafana-alternative/{runme.sh.hold => runme.sh} (100%) rename tests/integration/targets/molecule-grafana-default/{runme.sh.hold => runme.sh} (100%) diff --git a/tests/integration/targets/molecule-grafana-alternative/runme.sh.hold b/tests/integration/targets/molecule-grafana-alternative/runme.sh similarity index 100% rename from tests/integration/targets/molecule-grafana-alternative/runme.sh.hold rename to tests/integration/targets/molecule-grafana-alternative/runme.sh diff --git a/tests/integration/targets/molecule-grafana-default/runme.sh.hold b/tests/integration/targets/molecule-grafana-default/runme.sh similarity index 100% rename from tests/integration/targets/molecule-grafana-default/runme.sh.hold rename to tests/integration/targets/molecule-grafana-default/runme.sh From fc124a6f6824924b0fdf6b9ef62087485c925018 Mon Sep 17 00:00:00 2001 From: ishanjainn Date: Mon, 18 Sep 2023 15:16:37 +0530 Subject: [PATCH 18/18] Update README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ae8aac59..b79c5c47 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ [![GitHub Contributors](https://img.shields.io/github/contributors/grafana/grafana-ansible-collection)](https://github.com/grafana/grafana-ansible-collection/tags) [![Lint](https://github.com/grafana/grafana-ansible-collection/actions/workflows/lint.yaml/badge.svg)](https://github.com/grafana/grafana-ansible-collection/actions/workflows/lint.yaml) -[![CI Tests](https://github.com/grafana/grafana-ansible-collection/actions/workflows/ci-test.yml/badge.svg?branch=main)](https://github.com/grafana/grafana-ansible-collection/actions/workflows/ci-test.yml) +[![Modules Test](https://github.com/grafana/grafana-ansible-collection/actions/workflows/modules-test.yml/badge.svg?branch=main)](https://github.com/grafana/grafana-ansible-collection/actions/workflows/modules-test.yml) +[![Roles Test](https://github.com/grafana/grafana-ansible-collection/actions/workflows/roles-test.yml/badge.svg?branch=main)](https://github.com/grafana/grafana-ansible-collection/actions/workflows/roles-test.yml) [![Full Integration Test](https://github.com/grafana/grafana-ansible-collection/actions/workflows/full-integration-test.yml/badge.svg?branch=main)](https://github.com/grafana/grafana-ansible-collection/actions/workflows/full-integration-test.yml) This collection (`grafana.grafana`) contains modules and plugins to assist in automating managing of resources in **Grafana** with Ansible.