From 7385986cf53fce9d355b8e7e05871fd832d4d149 Mon Sep 17 00:00:00 2001 From: John Gardner Date: Fri, 21 Jun 2024 17:16:30 -0700 Subject: [PATCH 01/11] try to run analyzer on PR as well? --- .github/workflows/template-validation.yaml | 2 +- .github/workflows/template-warnings.yaml | 35 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/template-warnings.yaml diff --git a/.github/workflows/template-validation.yaml b/.github/workflows/template-validation.yaml index a2e601c17b..4d1ef6d296 100644 --- a/.github/workflows/template-validation.yaml +++ b/.github/workflows/template-validation.yaml @@ -15,7 +15,7 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [20.x] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/template-warnings.yaml b/.github/workflows/template-warnings.yaml new file mode 100644 index 0000000000..a74c47ebe4 --- /dev/null +++ b/.github/workflows/template-warnings.yaml @@ -0,0 +1,35 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Template Validation + +on: + pull_request: + push: + branches: master + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v4 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v44 + # To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g + with: + since_last_remote_commit: true + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + working-directory: ./scripts + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm run analyze ${{ steps.changed-files.outputs.all_changed_files }} \ No newline at end of file From fc60e891c891621cce528654af4d306ea19673dc Mon Sep 17 00:00:00 2001 From: John Gardner Date: Fri, 21 Jun 2024 17:18:34 -0700 Subject: [PATCH 02/11] spacing in yaml? --- .github/workflows/template-warnings.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/template-warnings.yaml b/.github/workflows/template-warnings.yaml index a74c47ebe4..ee73a35b0b 100644 --- a/.github/workflows/template-warnings.yaml +++ b/.github/workflows/template-warnings.yaml @@ -21,11 +21,11 @@ jobs: - uses: actions/checkout@v4 - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v44 - # To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g - with: - since_last_remote_commit: true + id: changed-files + uses: tj-actions/changed-files@v44 + # To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g + with: + since_last_remote_commit: true - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: From 7f511b2cda6e8cf2b1ef5a36bc74ca02a615b601 Mon Sep 17 00:00:00 2001 From: John Gardner Date: Fri, 21 Jun 2024 17:18:53 -0700 Subject: [PATCH 03/11] yaml spacing? --- .github/workflows/template-warnings.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/template-warnings.yaml b/.github/workflows/template-warnings.yaml index ee73a35b0b..8fa8ec8f99 100644 --- a/.github/workflows/template-warnings.yaml +++ b/.github/workflows/template-warnings.yaml @@ -1,7 +1,7 @@ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: Template Validation +name: Template Warnings on: pull_request: From 7934a147ec0dec357fcb8230eabc9a0e03f66f52 Mon Sep 17 00:00:00 2001 From: John Gardner Date: Fri, 21 Jun 2024 17:31:55 -0700 Subject: [PATCH 04/11] revert change to node 20 only run if changed workbook files --- .github/workflows/template-validation.yaml | 4 ++-- .github/workflows/template-warnings.yaml | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/template-validation.yaml b/.github/workflows/template-validation.yaml index 4d1ef6d296..a52d26950c 100644 --- a/.github/workflows/template-validation.yaml +++ b/.github/workflows/template-validation.yaml @@ -15,10 +15,10 @@ jobs: strategy: matrix: - node-version: [20.x] + node-version: [12.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: diff --git a/.github/workflows/template-warnings.yaml b/.github/workflows/template-warnings.yaml index 8fa8ec8f99..98ad1cc464 100644 --- a/.github/workflows/template-warnings.yaml +++ b/.github/workflows/template-warnings.yaml @@ -15,21 +15,24 @@ jobs: strategy: matrix: - node-version: [20.x] + node-version: [12.x] steps: - uses: actions/checkout@v4 - name: Get changed files - id: changed-files + id: changed-workbook-files uses: tj-actions/changed-files@v44 # To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g with: since_last_remote_commit: true + files: | + **.workbook - name: Use Node.js ${{ matrix.node-version }} + if: steps.changed-workbook-files.outputs.any_changed == 'true' uses: actions/setup-node@v1 + working-directory: ./scripts with: - working-directory: ./scripts node-version: ${{ matrix.node-version }} - run: npm install - - run: npm run analyze ${{ steps.changed-files.outputs.all_changed_files }} \ No newline at end of file + - run: npm run analyze ${{ steps.changed-workbook-files.outputs.all_changed_files }} \ No newline at end of file From dfd48047b057ba0a9b6b6d301bba8582e577496c Mon Sep 17 00:00:00 2001 From: John Gardner Date: Fri, 21 Jun 2024 17:37:10 -0700 Subject: [PATCH 05/11] add a template that generates a warning --- .../Say Cheese/Say Cheese.workbook | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Workbooks/Azure Monitor - Getting Started/Say Cheese/Say Cheese.workbook diff --git a/Workbooks/Azure Monitor - Getting Started/Say Cheese/Say Cheese.workbook b/Workbooks/Azure Monitor - Getting Started/Say Cheese/Say Cheese.workbook new file mode 100644 index 0000000000..3010ffbf42 --- /dev/null +++ b/Workbooks/Azure Monitor - Getting Started/Say Cheese/Say Cheese.workbook @@ -0,0 +1,26 @@ +{ + "version": "Notebook/1.0", + "items": [ + { + "id": "84cd454f-b852-4bbb-ae4f-6080b3801855", + "type": 1, + "name": "text - 0", + "content": { + "json": "# say cheese!\r\n\r\n🧀" + } + }, + { + "id": "9c56155c-9a7e-41db-ac56-40cabb7d7ddf", + "version": "KqlParameterItem/1.0", + "name": "TopN", + "type": 1, + "isRequired": true, + "query": "print 5", + "crossComponentResources": [ + "{Subscriptions}" + ], + "queryType": 0, + "resourceType": "microsoft.resources/subscriptions" + } + ] + } \ No newline at end of file From 00410e44658b3c73865aa6cd27b2531252e3d876 Mon Sep 17 00:00:00 2001 From: John Gardner Date: Fri, 21 Jun 2024 17:41:12 -0700 Subject: [PATCH 06/11] working-directory on the job itself? --- .github/workflows/template-warnings.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/template-warnings.yaml b/.github/workflows/template-warnings.yaml index 98ad1cc464..82cc8aff61 100644 --- a/.github/workflows/template-warnings.yaml +++ b/.github/workflows/template-warnings.yaml @@ -9,9 +9,12 @@ on: branches: master jobs: - build: - + validate: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./scripts strategy: matrix: @@ -31,7 +34,6 @@ jobs: - name: Use Node.js ${{ matrix.node-version }} if: steps.changed-workbook-files.outputs.any_changed == 'true' uses: actions/setup-node@v1 - working-directory: ./scripts with: node-version: ${{ matrix.node-version }} - run: npm install From ddef65ce461aff3634e4cdf1c271a53271035d68 Mon Sep 17 00:00:00 2001 From: John Gardner Date: Fri, 21 Jun 2024 17:44:38 -0700 Subject: [PATCH 07/11] remove scripts\.npmrc --- scripts/.npmrc | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 scripts/.npmrc diff --git a/scripts/.npmrc b/scripts/.npmrc deleted file mode 100644 index 4dd2be6ca1..0000000000 --- a/scripts/.npmrc +++ /dev/null @@ -1,3 +0,0 @@ -registry=https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/ -always-auth=true -custom-host-suffix='pkgs.visualstudio.com' \ No newline at end of file From b38255a7cde8b3f051578d8b660b306efb4a08c4 Mon Sep 17 00:00:00 2001 From: John Gardner Date: Fri, 21 Jun 2024 17:47:56 -0700 Subject: [PATCH 08/11] remove package lock referencing msazure --- scripts/package-lock.json | 149 -------------------------------------- 1 file changed, 149 deletions(-) delete mode 100644 scripts/package-lock.json diff --git a/scripts/package-lock.json b/scripts/package-lock.json deleted file mode 100644 index b1ee068a06..0000000000 --- a/scripts/package-lock.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "name": "azure_monitor_workbook_templates", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@types/node": { - "version": "12.0.0", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/@types/node/-/node-12.0.0.tgz", - "integrity": "sha1-0RgTucD/iqyinwTLwSgX9MfWVuU=", - "dev": true - }, - "deep-is": { - "version": "0.1.4", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha1-pvLc5hL63S7x9Rm3NVHxfoUZmDE=", - "dev": true - }, - "escodegen": { - "version": "1.14.3", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/escodegen/-/escodegen-1.14.3.tgz", - "integrity": "sha1-TnuB+6YVgdyXWC7XjKt/Do1j9QM=", - "dev": true, - "requires": { - "esprima": "^4.0.1", - "estraverse": "^4.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "esprima": { - "version": "4.0.1", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=", - "dev": true - } - } - }, - "esprima": { - "version": "1.2.2", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/esprima/-/esprima-1.2.2.tgz", - "integrity": "sha1-dqD9Zvz+FU/SkmZ9wmQBl1CxZXs=", - "dev": true - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0=", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q=", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "jsonpath": { - "version": "1.1.1", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/jsonpath/-/jsonpath-1.1.1.tgz", - "integrity": "sha1-DKHtj7ZbszCSSMydVGbRLVsLmQE=", - "dev": true, - "requires": { - "esprima": "1.2.2", - "static-eval": "2.0.2", - "underscore": "1.12.1" - } - }, - "levn": { - "version": "0.3.0", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "optionator": { - "version": "0.8.3", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/optionator/-/optionator-0.8.3.tgz", - "integrity": "sha1-hPodA2/p08fiHZmIS2ARZ+yPtJU=", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - } - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=", - "dev": true, - "optional": true - }, - "static-eval": { - "version": "2.0.2", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/static-eval/-/static-eval-2.0.2.tgz", - "integrity": "sha1-LRdZMGsb76aIk4RUxUa3hx+AakI=", - "dev": true, - "requires": { - "escodegen": "^1.8.1" - } - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "typescript": { - "version": "4.8.4", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha1-xGSryhWWaVl75flriUNQCyOOYOY=", - "dev": true - }, - "underscore": { - "version": "1.12.1", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/underscore/-/underscore-1.12.1.tgz", - "integrity": "sha1-e7jMmz05fiAc+FUzNtJiVE6tgp4=", - "dev": true - }, - "word-wrap": { - "version": "1.2.3", - "resolved": "https://msazure.pkgs.visualstudio.com/_packaging/ApplicationInsights-Team/npm/registry/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha1-YQY29rH3A4kb00dxzLF/uTtHB5w=", - "dev": true - } - } -} From 23af93d7f25f5b976546d2de53240d78279d0546 Mon Sep 17 00:00:00 2001 From: John Gardner Date: Fri, 21 Jun 2024 17:52:36 -0700 Subject: [PATCH 09/11] set changed files to env? --- .github/workflows/template-warnings.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/template-warnings.yaml b/.github/workflows/template-warnings.yaml index 82cc8aff61..541ce752a2 100644 --- a/.github/workflows/template-warnings.yaml +++ b/.github/workflows/template-warnings.yaml @@ -33,8 +33,10 @@ jobs: **.workbook - name: Use Node.js ${{ matrix.node-version }} if: steps.changed-workbook-files.outputs.any_changed == 'true' + env: + CHANGED_WORKBOOK_FILES: ${{ steps.changed-workbook-files.outputs.all_changed_files }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - run: npm install - - run: npm run analyze ${{ steps.changed-workbook-files.outputs.all_changed_files }} \ No newline at end of file + - run: npm run analyze $CHANGED_WORKBOOK_FILES \ No newline at end of file From 73071e6aa8910738cb94e82593fca2bf4ebc96c3 Mon Sep 17 00:00:00 2001 From: John Gardner Date: Fri, 21 Jun 2024 17:55:09 -0700 Subject: [PATCH 10/11] not just most recent commit --- .github/workflows/template-warnings.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/template-warnings.yaml b/.github/workflows/template-warnings.yaml index 541ce752a2..5ae3936caf 100644 --- a/.github/workflows/template-warnings.yaml +++ b/.github/workflows/template-warnings.yaml @@ -28,15 +28,13 @@ jobs: uses: tj-actions/changed-files@v44 # To compare changes between the current commit and the last pushed remote commit set `since_last_remote_commit: true`. e.g with: - since_last_remote_commit: true + # since_last_remote_commit: true files: | **.workbook - name: Use Node.js ${{ matrix.node-version }} if: steps.changed-workbook-files.outputs.any_changed == 'true' - env: - CHANGED_WORKBOOK_FILES: ${{ steps.changed-workbook-files.outputs.all_changed_files }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - run: npm install - - run: npm run analyze $CHANGED_WORKBOOK_FILES \ No newline at end of file + - run: npm run analyze ${{ steps.changed-workbook-files.outputs.all_changed_files }} \ No newline at end of file From 55a581ccd06309ecaf17a09976f9cf6d4753e73c Mon Sep 17 00:00:00 2001 From: John Gardner Date: Fri, 21 Jun 2024 18:03:44 -0700 Subject: [PATCH 11/11] figuring out quoting paths --- .github/workflows/template-warnings.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/template-warnings.yaml b/.github/workflows/template-warnings.yaml index 5ae3936caf..3a1de13782 100644 --- a/.github/workflows/template-warnings.yaml +++ b/.github/workflows/template-warnings.yaml @@ -37,4 +37,4 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: npm install - - run: npm run analyze ${{ steps.changed-workbook-files.outputs.all_changed_files }} \ No newline at end of file + - run: npm run analyze '${{ steps.changed-workbook-files.outputs.all_changed_files }}' \ No newline at end of file