From bd4180505d73b169e88a82c66acccaa285719961 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Fri, 15 Feb 2019 15:54:03 -0800 Subject: [PATCH 01/30] scripts --- azure-pipelines.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9e84bab3830b..81312ebb59af 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,3 +7,6 @@ steps: displayName: 'npm install' inputs: verbose: false + +- script: 'scripts/install-dotnet.sh' +- script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' From b1b8b7e92d32854efb3222a9b66b8f618f401ff5 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Fri, 15 Feb 2019 16:28:24 -0800 Subject: [PATCH 02/30] TRAVIS_PULL_REQUEST --- azure-pipelines.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 81312ebb59af..e31244ac78e0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,9 @@ pool: vmImage: 'Ubuntu 16.04' +variables: + 'Travis.Pull.Request': $(System.PullRequest.PullRequestId) + steps: - task: Npm@1 From 463938eee4a8a79cf82084ccb16d8857c68e1bfa Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Fri, 15 Feb 2019 16:48:47 -0800 Subject: [PATCH 03/30] another try --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e31244ac78e0..fe618fdbc27b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,7 +2,7 @@ pool: vmImage: 'Ubuntu 16.04' variables: - 'Travis.Pull.Request': $(System.PullRequest.PullRequestId) + TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) steps: From 90cab465406be315d5eb436b96183175b2c462c3 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Tue, 19 Feb 2019 10:42:06 -0800 Subject: [PATCH 04/30] TRAVIS_PULL_REQUEST_SLUG --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fe618fdbc27b..facab27f391b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,6 +3,7 @@ pool: variables: TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) + TRAVIS_PULL_REQUEST_SLUG: $(Build.SourceBranchName) steps: From 0ec7d8d878f857b7110fd8ba8e9c1a99dfa820e0 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Tue, 19 Feb 2019 11:40:08 -0800 Subject: [PATCH 05/30] TRAVIS_REPO_SLUG --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index facab27f391b..f1687727bc2c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,7 +3,7 @@ pool: variables: TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) - TRAVIS_PULL_REQUEST_SLUG: $(Build.SourceBranchName) + TRAVIS_REPO_SLUG: $(Build.SourceBranchName) steps: From 910ac03be276dd886d4dcd82c7a068438379b237 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 15:25:22 -0800 Subject: [PATCH 06/30] Swagger to SDK --- azure-pipelines.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f1687727bc2c..848a9adf7a06 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,10 +7,11 @@ variables: steps: -- task: Npm@1 - displayName: 'npm install' - inputs: - verbose: false +#- task: Npm@1 +# displayName: 'npm install' +# inputs: +# verbose: false +#- script: 'scripts/install-dotnet.sh' +#- script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' -- script: 'scripts/install-dotnet.sh' -- script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' +- script: "scripts/swagger-to-sdk.sh Azure/azure-sdk-for-ruby -v" From d7ab18f11fd957e4954fe0910f459657bc589dd4 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 16:01:16 -0800 Subject: [PATCH 07/30] linter and ruby --- azure-pipelines.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 848a9adf7a06..8d61912d018a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,15 +3,17 @@ pool: variables: TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) - TRAVIS_REPO_SLUG: $(Build.SourceBranchName) +# TRAVIS_REPO_SLUG: $(Build.SourceBranchName) -steps: - -#- task: Npm@1 -# displayName: 'npm install' -# inputs: -# verbose: false -#- script: 'scripts/install-dotnet.sh' -#- script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' - -- script: "scripts/swagger-to-sdk.sh Azure/azure-sdk-for-ruby -v" +jobs: +- job: "linter" + steps: + - task: Npm@1 + displayName: 'npm install' + inputs: + verbose: false + - script: 'scripts/install-dotnet.sh' + - script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' +- job: "ruby" + steps: + - script: "scripts/swagger-to-sdk.sh Azure/azure-sdk-for-ruby -v" From 4a510f88922f0883a029a0c162ab8f8e20f94073 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 16:02:38 -0800 Subject: [PATCH 08/30] not really a slug --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8d61912d018a..1c21c16b3ee8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,7 +3,7 @@ pool: variables: TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) -# TRAVIS_REPO_SLUG: $(Build.SourceBranchName) + TRAVIS_REPO_SLUG: $(Build.SourceBranchName) jobs: - job: "linter" From e9d2dc5cc483974d775cbc6da8753c0ef7d5b78f Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 16:05:32 -0800 Subject: [PATCH 09/30] pool --- azure-pipelines.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1c21c16b3ee8..a7dd984fb83a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,12 +1,11 @@ -pool: - vmImage: 'Ubuntu 16.04' - variables: TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) TRAVIS_REPO_SLUG: $(Build.SourceBranchName) jobs: - job: "linter" + pool: + vmImage: 'Ubuntu 16.04' steps: - task: Npm@1 displayName: 'npm install' @@ -15,5 +14,7 @@ jobs: - script: 'scripts/install-dotnet.sh' - script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' - job: "ruby" + pool: + vmImage: 'Ubuntu 16.04' steps: - script: "scripts/swagger-to-sdk.sh Azure/azure-sdk-for-ruby -v" From c740f2663ce03da5a44f128cadf3f5fe39d50639 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 16:07:16 -0800 Subject: [PATCH 10/30] indent --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a7dd984fb83a..55813f59d573 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,9 +8,9 @@ jobs: vmImage: 'Ubuntu 16.04' steps: - task: Npm@1 - displayName: 'npm install' - inputs: - verbose: false + displayName: 'npm install' + inputs: + verbose: false - script: 'scripts/install-dotnet.sh' - script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' - job: "ruby" From 7891465b45e87b6626f4522eb0ce5b4cdcd54d35 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 16:09:37 -0800 Subject: [PATCH 11/30] strange --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 55813f59d573..14e35ee994c1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,8 +8,8 @@ jobs: vmImage: 'Ubuntu 16.04' steps: - task: Npm@1 - displayName: 'npm install' - inputs: + displayName: 'npm install' + inputs: verbose: false - script: 'scripts/install-dotnet.sh' - script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' From 464eb55ddade26463e09876a9285fca104079fae Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 16:22:03 -0800 Subject: [PATCH 12/30] URI --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 14e35ee994c1..c3c100be836f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,6 @@ variables: TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) - TRAVIS_REPO_SLUG: $(Build.SourceBranchName) + TRAVIS_REPO_SLUG: $(Build.Repository.Uri) jobs: - job: "linter" From 96b348b346d238d5f141c79302552d9cd09dbc09 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 16:43:36 -0800 Subject: [PATCH 13/30] env vars --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c3c100be836f..7c92f40dc17a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,6 +7,8 @@ jobs: pool: vmImage: 'Ubuntu 16.04' steps: + - script: | + echo Build.Repository.Name: $(Build.Repository.Name) - task: Npm@1 displayName: 'npm install' inputs: From b08843be7117b593b7ee9333db94c58f2147d851 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 16:45:57 -0800 Subject: [PATCH 14/30] uri --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7c92f40dc17a..b0474358f9a1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,6 @@ variables: TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) - TRAVIS_REPO_SLUG: $(Build.Repository.Uri) + TRAVIS_REPO_SLUG: $(Build.Repository.Name) jobs: - job: "linter" @@ -9,6 +9,7 @@ jobs: steps: - script: | echo Build.Repository.Name: $(Build.Repository.Name) + echo Build.Repository.Uri: $(Build.Repository.Uri) - task: Npm@1 displayName: 'npm install' inputs: From f862c15f1c96749711d608b58ccc465f852895e7 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 16:56:08 -0800 Subject: [PATCH 15/30] env var --- azure-pipelines.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b0474358f9a1..bc052ac10527 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,8 @@ variables: + TRAVIS: 'true' TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) TRAVIS_REPO_SLUG: $(Build.Repository.Name) + TRAVIS_PULL_REQUEST_SHA: $(Build.SourceVersion) jobs: - job: "linter" @@ -8,8 +10,10 @@ jobs: vmImage: 'Ubuntu 16.04' steps: - script: | + echo System.PullRequest.PullRequestId: $(System.PullRequest.PullRequestId) echo Build.Repository.Name: $(Build.Repository.Name) echo Build.Repository.Uri: $(Build.Repository.Uri) + echo Build.SourceVersion: $(Build.SourceVersion) - task: Npm@1 displayName: 'npm install' inputs: From 9feba40562deb3debb3426b5b1381c7ef693b275 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 16:59:57 -0800 Subject: [PATCH 16/30] TRAVIS_PULL_REQUEST_SLUG --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bc052ac10527..61e52d6dbc7a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,6 +2,7 @@ variables: TRAVIS: 'true' TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) TRAVIS_REPO_SLUG: $(Build.Repository.Name) + TRAVIS_PULL_REQUEST_SLUG: $(Build.Repository.Name) TRAVIS_PULL_REQUEST_SHA: $(Build.SourceVersion) jobs: From 88e4edbd5bde8d09fadb7891ed0fbb562428f497 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 17:28:44 -0800 Subject: [PATCH 17/30] matrix --- azure-pipelines.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 61e52d6dbc7a..64abef3b3894 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,8 +21,22 @@ jobs: verbose: false - script: 'scripts/install-dotnet.sh' - script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' -- job: "ruby" +- job: "SDK" + strategy: + matrix: + ruby: + AZURE_SDK_REPO: azure-sdk-for-ruby + java: + AZURE_SDK_REPO: azure-sdk-for-java + javascript: + AZURE_SDK_REPO: azure-sdk-for-js + node: + AZURE_SDK_REPO: azure-sdk-for-node + python: + AZURE_SDK_REPO: azure-sdk-for-python + go: + AZURE_SDK_REPO: azure-sdk-for-go pool: vmImage: 'Ubuntu 16.04' steps: - - script: "scripts/swagger-to-sdk.sh Azure/azure-sdk-for-ruby -v" + - script: "scripts/swagger-to-sdk.sh Azure/$(AZURE_SDK_REPO) -v" From 74d6b75d8023100484845243b26157c3d4e75007 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Wed, 20 Feb 2019 17:56:40 -0800 Subject: [PATCH 18/30] Azure OpenAPI name --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 64abef3b3894..f17ba84f0c5f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,3 +1,5 @@ +name: "Azure OpenAPI" + variables: TRAVIS: 'true' TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) From e3ebb1d8fed574e07f033a8116c2e24301f9dca5 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 10:30:01 -0800 Subject: [PATCH 19/30] linter: autorest fix --- scripts/momentOfTruth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/momentOfTruth.js b/scripts/momentOfTruth.js index 9eb086c3f9c1..e07f7442aea0 100644 --- a/scripts/momentOfTruth.js +++ b/scripts/momentOfTruth.js @@ -10,7 +10,7 @@ const exec = require('child_process').exec, let configsToProcess = utils.getConfigFilesChangedInPR(); let pullRequestNumber = utils.getPullRequestNumber(); -let linterCmd = `npx autorest@2.0.4152 --validation --azure-validator --message-format=json `; +let linterCmd = `npx autorest --validation --azure-validator --message-format=json `; var filename = `${pullRequestNumber}.json`; var logFilepath = path.join(getLogDir(), filename); var finalResult = {}; From 8c4725c7f214d8c22cbcf14f4d444a99ba322a1b Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 11:25:45 -0800 Subject: [PATCH 20/30] error handling and PR_ONLY = true --- azure-pipelines.yml | 1 + scripts/momentOfTruth.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f17ba84f0c5f..793bcf46054f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,6 +6,7 @@ variables: TRAVIS_REPO_SLUG: $(Build.Repository.Name) TRAVIS_PULL_REQUEST_SLUG: $(Build.Repository.Name) TRAVIS_PULL_REQUEST_SHA: $(Build.SourceVersion) + PR_ONLY: 'true' jobs: - job: "linter" diff --git a/scripts/momentOfTruth.js b/scripts/momentOfTruth.js index e07f7442aea0..3d0c36bdf071 100644 --- a/scripts/momentOfTruth.js +++ b/scripts/momentOfTruth.js @@ -59,12 +59,16 @@ async function getLinterResult(swaggerPath) { (err, stdout, stderr) => res({ err: err, stdout: stdout, stderr: stderr }))); if (err && stderr.indexOf("Process() cancelled due to exception") !== -1) { - console.log(`AutoRest exited with code ${err.code}`); - console.log(stderr); + console.error(`AutoRest exited with code ${err.code}`); + console.error(stderr); throw new Error("AutoRest failed"); } - let resultString = stdout + stderr; + if (stderr !== "") { + console.error(`Error: ${stderr}`) + process.exit(1) + } + let resultString = stdout; if (resultString.indexOf('{') !== -1) { resultString = resultString.replace(/Processing batch task - {.*} \.\n/g, ""); resultString = "[" + resultString.substring(resultString.indexOf('{')).trim().replace(/\}\n\{/g, "},\n{") + "]"; @@ -76,7 +80,7 @@ async function getLinterResult(swaggerPath) { //console.dir(resultObject, {depth: null, colors: true}); return jsonResult; } catch (e) { - console.log(`An error occurred while executing JSON.parse() on the linter output for ${swaggerPath}:`); + console.error(`An error occurred while executing JSON.parse() on the linter output for ${swaggerPath}:`); console.dir(resultString); console.dir(e, { depth: null, colors: true }); process.exit(1) From ca253ba972585589f50ea0aa93e580f18c44c1bb Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 13:16:02 -0800 Subject: [PATCH 21/30] syntax --- azure-pipelines.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 793bcf46054f..36603612d215 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,6 +9,17 @@ variables: PR_ONLY: 'true' jobs: + +- job: "syntax" + pool: + vmImage: 'Ubuntu 16.04' + steps: + - task: Npm@1 + displayName: 'npm install' + inputs: + verbose: false + - script: 'npm test -- test/syntax.js' + - job: "linter" pool: vmImage: 'Ubuntu 16.04' @@ -24,6 +35,7 @@ jobs: verbose: false - script: 'scripts/install-dotnet.sh' - script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' + - job: "SDK" strategy: matrix: From 22f5afebff2f7a922581678938c0c9fe41d0773e Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 13:21:42 -0800 Subject: [PATCH 22/30] pipelines. --- azure-pipelines.yml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 36603612d215..c987d7e919b5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,7 +20,38 @@ jobs: verbose: false - script: 'npm test -- test/syntax.js' -- job: "linter" +- job: "semantic" + pool: + vmImage: 'Ubuntu 16.04' + steps: + - task: Npm@1 + displayName: 'npm install' + inputs: + verbose: false + - script: 'node scripts/semanticValidation.js' + +- job: "model" + pool: + vmImage: 'Ubuntu 16.04' + steps: + - task: Npm@1 + displayName: 'npm install' + inputs: + verbose: false + - script: 'node scripts/modelValidation.js' + +- job: "Breaking Changes" + pool: + vmImage: 'Ubuntu 16.04' + steps: + - script: 'scripts/install-dotnet.sh' + - task: Npm@1 + displayName: 'npm install' + inputs: + verbose: false + - script: 'node scripts/breaking-change.js' + +- job: "lintdiff" pool: vmImage: 'Ubuntu 16.04' steps: From b700e98d66911aa1e04e29de9e032b950e519cd9 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 13:23:05 -0800 Subject: [PATCH 23/30] job name --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c987d7e919b5..9bea7ffc3583 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -40,7 +40,7 @@ jobs: verbose: false - script: 'node scripts/modelValidation.js' -- job: "Breaking Changes" +- job: "breaking-change" pool: vmImage: 'Ubuntu 16.04' steps: From fa24706e108de4ba814e6ad67fb1e3b5a1ebb389 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 13:23:58 -0800 Subject: [PATCH 24/30] job name --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9bea7ffc3583..52ab74bce060 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -40,7 +40,7 @@ jobs: verbose: false - script: 'node scripts/modelValidation.js' -- job: "breaking-change" +- job: "breaking_change" pool: vmImage: 'Ubuntu 16.04' steps: From b162d5a54e423280318889edc9bac1f07bc29739 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 13:39:36 -0800 Subject: [PATCH 25/30] Names --- azure-pipelines.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 52ab74bce060..f677802320b3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,7 +10,7 @@ variables: jobs: -- job: "syntax" +- job: "Syntax" pool: vmImage: 'Ubuntu 16.04' steps: @@ -20,7 +20,7 @@ jobs: verbose: false - script: 'npm test -- test/syntax.js' -- job: "semantic" +- job: "Semantic" pool: vmImage: 'Ubuntu 16.04' steps: @@ -30,7 +30,7 @@ jobs: verbose: false - script: 'node scripts/semanticValidation.js' -- job: "model" +- job: "ModelValidation" pool: vmImage: 'Ubuntu 16.04' steps: @@ -40,7 +40,7 @@ jobs: verbose: false - script: 'node scripts/modelValidation.js' -- job: "breaking_change" +- job: "BreakingChange" pool: vmImage: 'Ubuntu 16.04' steps: @@ -51,7 +51,7 @@ jobs: verbose: false - script: 'node scripts/breaking-change.js' -- job: "lintdiff" +- job: "LintDiff" pool: vmImage: 'Ubuntu 16.04' steps: From 16a2c7179fac17071da8e9c06e073705c0a02e4f Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 14:05:28 -0800 Subject: [PATCH 26/30] params, no getStatus.js --- azure-pipelines.yml | 3 +- scripts/getStatus.js | 135 ------------------------------------------- 2 files changed, 2 insertions(+), 136 deletions(-) delete mode 100644 scripts/getStatus.js diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f677802320b3..a622621cab14 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -82,7 +82,8 @@ jobs: AZURE_SDK_REPO: azure-sdk-for-python go: AZURE_SDK_REPO: azure-sdk-for-go + AZURE_SDK_PARAMS: '-o latest' pool: vmImage: 'Ubuntu 16.04' steps: - - script: "scripts/swagger-to-sdk.sh Azure/$(AZURE_SDK_REPO) -v" + - script: "scripts/swagger-to-sdk.sh Azure/$(AZURE_SDK_REPO) -v $(AZURE_SDK_PARAMS)" diff --git a/scripts/getStatus.js b/scripts/getStatus.js deleted file mode 100644 index ba5d9212aedb..000000000000 --- a/scripts/getStatus.js +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License in the project root for license information. - -'use strict'; -var exec = require('child_process').exec, - path = require('path'), - fs = require('fs'), - glob = require('glob'), - oav = require('oav'), - utils = require("../test/util/utils"); - -var swaggersToProcess = utils.swaggers; -var readmesToProcess = utils.readmes; -var finalResult = {}; -var filename = `log_${utils.getTimeStamp()}.log`; -var logFilepath = path.join(getLogDir(), filename); - -function updateResult(spec, errors, updateLog) { - if (!finalResult[spec]) { - finalResult[spec] = errors; - } else { - finalResult[spec] = finalResult[spec].concat(errors); - } - if (updateLog) { - writeContent(JSON.stringify(finalResult, null, 2)); - } -} - -function getLogDir() { - let logDir = path.join(__dirname, '../', 'output'); - if (!fs.existsSync(logDir)) { - try { - fs.mkdirSync(logDir); - } catch (e) { - if (e.code !== 'EEXIST') throw e; - } - } - return logDir; -} - -//creates the log file if it has not been created -function createLogFile() { - if (!fs.existsSync(logFilepath)) { - fs.writeFileSync(logFilepath, ''); - } -} - -//appends the content to the log file -function writeContent(content) { - fs.writeFileSync(logFilepath, content); -} - -//runs the command on a given swagger spec. -async function runCmd(cmd) { - console.log(cmd); - const {err, stdout, stderr } = await new Promise(res => exec(cmd, { encoding: 'utf8', maxBuffer: 1024 * 1024 * 64 }, - (err, stdout, stderr) => res({ err: err, stdout: stdout, stderr: stderr }))); - let resultObject = []; - let resultString = stdout + stderr; - //console.log('>>>> Actual result...'); - //console.log(resultString); - if (resultString.indexOf('{') !== -1) { - resultString = "[" + resultString.substring(resultString.indexOf('{')).trim().replace(/\}\n\{/g, "},\n{") + "]"; - //console.log('>>>>>> Trimmed Result...'); - //console.log(resultString); - try { - resultObject = JSON.parse(resultString); - //console.log('>>>>>> Parsed Result...'); - //console.dir(resultObject, {depth: null, colors: true}); - } catch (e) { - console.log(`An error occurred while executing JSON.parse() on the output for ${cmd}:`); - console.dir(resultString); - console.dir(e, { depth: null, colors: true }); - } - } - return resultObject; -} - -//runs the semantic validator on a given swagger spec. -function runSemanticValidator(swagger) { - return oav.validateSpec(swagger, {consoleLogLevel: 'off'}).then(function (validationResult) { - //console.dir(validationResult, { depth: null, colors: true }); - return validationResult.validateSpec.errors; - }).catch(function (err) { - console.dir(err, { depth: null, colors: true }); - }); -} - -//main function -async function runScript() { - // Useful when debugging a test for a particular swagger. - // Just update the regex. That will return an array of filtered items. - // swaggersToProcess = swaggersToProcess.filter(function (item) { - // return (item.match(/.*Microsoft.network/ig) !== null); - // }); - // readmesToProcess = readmesToProcess.filter(function (item) { - // return (item.match(/.*.network/ig) !== null); - // }); - createLogFile(); - console.log(`The results will be logged here: "${logFilepath}".`); - - console.log('\t- Running Semantic Validator.') - for (let swagger of swaggersToProcess) { - const validationErrors = await runSemanticValidator(swagger); - swagger = swagger.split(/\/Microsoft\./gi)[0] + "/readme.md"; - console.log(`File Name: "${swagger}"`); - if (validationErrors != null) - { - updateResult(swagger, validationErrors, true); - } - } - - console.log(`\t- Running Linter.`); - for (let readme of readmesToProcess) { - console.log(`Linter Validation on configuration file: "${readme}"`); - let linterCmd = 'autorest ' + readme + ' --azure-validator=true --validation --message-format=json'; - const linterErrors = await runCmd(linterCmd); - updateResult(readme, linterErrors, true); - } - - console.log(`\t- Running Model Validator.`); - //model validator run - for (let readme of readmesToProcess) { - console.log(`Model Validation on configuration file: "${readme}"`); - let modelValCmd = 'autorest --version=2.0.4174 --model-validator --message-format=json ' + readme; - const modelValErrors = await runCmd(modelValCmd); - updateResult(readme, modelValErrors, true); - } - - //console.dir(finalResult, { depth: null, colors: true }); - return finalResult; -} - -//magic starts here -runScript(); From 0c8892bfcf11abf190d52f00c3158b8952f4a150 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 14:30:02 -0800 Subject: [PATCH 27/30] No CI, only PR validations. --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a622621cab14..4638d1ef43e8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,5 +1,7 @@ name: "Azure OpenAPI" +trigger: none + variables: TRAVIS: 'true' TRAVIS_PULL_REQUEST: $(System.PullRequest.PullRequestId) From d7d1649e8e5c225de988178d26e1c8f22068eb4b Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 14:34:11 -0800 Subject: [PATCH 28/30] displayName --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4638d1ef43e8..6639b92c590d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -70,6 +70,7 @@ jobs: - script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' - job: "SDK" + displayName: "Azure SDK for" strategy: matrix: ruby: From 24a8b7e87450521f106eeacb7ff1917f0a7b489f Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 14:35:38 -0800 Subject: [PATCH 29/30] revert back --- azure-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6639b92c590d..4638d1ef43e8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -70,7 +70,6 @@ jobs: - script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js' - job: "SDK" - displayName: "Azure SDK for" strategy: matrix: ruby: From 2cb0605fd2ee1822a91e75b5eebff3a31ca8a502 Mon Sep 17 00:00:00 2001 From: Sergey Shandar Date: Thu, 21 Feb 2019 14:47:50 -0800 Subject: [PATCH 30/30] no need to show vars --- azure-pipelines.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4638d1ef43e8..46b60b8f4d23 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -57,11 +57,6 @@ jobs: pool: vmImage: 'Ubuntu 16.04' steps: - - script: | - echo System.PullRequest.PullRequestId: $(System.PullRequest.PullRequestId) - echo Build.Repository.Name: $(Build.Repository.Name) - echo Build.Repository.Uri: $(Build.Repository.Uri) - echo Build.SourceVersion: $(Build.SourceVersion) - task: Npm@1 displayName: 'npm install' inputs: