Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts #5213

Merged
merged 32 commits into from
Feb 21, 2019
Merged

scripts #5213

Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
bd41805
scripts
sergey-shandar Feb 15, 2019
b1b8b7e
TRAVIS_PULL_REQUEST
sergey-shandar Feb 16, 2019
463938e
another try
sergey-shandar Feb 16, 2019
90cab46
TRAVIS_PULL_REQUEST_SLUG
sergey-shandar Feb 19, 2019
0ec7d8d
TRAVIS_REPO_SLUG
sergey-shandar Feb 19, 2019
910ac03
Swagger to SDK
sergey-shandar Feb 20, 2019
d7ab18f
linter and ruby
sergey-shandar Feb 21, 2019
4a510f8
not really a slug
sergey-shandar Feb 21, 2019
e9d2dc5
pool
sergey-shandar Feb 21, 2019
c740f26
indent
sergey-shandar Feb 21, 2019
7891465
strange
sergey-shandar Feb 21, 2019
464eb55
URI
sergey-shandar Feb 21, 2019
96b348b
env vars
sergey-shandar Feb 21, 2019
b08843b
uri
sergey-shandar Feb 21, 2019
f862c15
env var
sergey-shandar Feb 21, 2019
9feba40
TRAVIS_PULL_REQUEST_SLUG
sergey-shandar Feb 21, 2019
88e4edb
matrix
sergey-shandar Feb 21, 2019
74d6b75
Azure OpenAPI name
sergey-shandar Feb 21, 2019
e3ebb1d
linter: autorest fix
sergey-shandar Feb 21, 2019
d34cff2
Merge branch 'master' into sergey/diff-tool
sergey-shandar Feb 21, 2019
8c4725c
error handling and PR_ONLY = true
sergey-shandar Feb 21, 2019
734aa3e
Merge branch 'sergey/diff-tool' of https://github.com/Azure/azure-res…
sergey-shandar Feb 21, 2019
ca253ba
syntax
sergey-shandar Feb 21, 2019
22f5afe
pipelines.
sergey-shandar Feb 21, 2019
b700e98
job name
sergey-shandar Feb 21, 2019
fa24706
job name
sergey-shandar Feb 21, 2019
b162d5a
Names
sergey-shandar Feb 21, 2019
16a2c71
params, no getStatus.js
sergey-shandar Feb 21, 2019
0c8892b
No CI, only PR validations.
sergey-shandar Feb 21, 2019
d7d1649
displayName
sergey-shandar Feb 21, 2019
24a8b7e
revert back
sergey-shandar Feb 21, 2019
2cb0605
no need to show vars
sergey-shandar Feb 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 87 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,89 @@
pool:
vmImage: 'Ubuntu 16.04'
name: "Azure OpenAPI"

steps:
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)
PR_ONLY: 'true'

- task: Npm@1
displayName: 'npm install'
inputs:
verbose: false
jobs:

- job: "Syntax"
pool:
vmImage: 'Ubuntu 16.04'
steps:
- task: Npm@1
displayName: 'npm install'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More descriptive display names here would be helpful.

inputs:
verbose: false
- script: 'npm test -- test/syntax.js'

- job: "Semantic"
pool:
vmImage: 'Ubuntu 16.04'
steps:
- task: Npm@1
displayName: 'npm install'
inputs:
verbose: false
- script: 'node scripts/semanticValidation.js'

- job: "ModelValidation"
pool:
vmImage: 'Ubuntu 16.04'
steps:
- task: Npm@1
displayName: 'npm install'
inputs:
verbose: false
- script: 'node scripts/modelValidation.js'

- job: "BreakingChange"
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:
- 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:
verbose: false
- script: 'scripts/install-dotnet.sh'
- script: 'node scripts/momentOfTruth.js && node scripts/momentOfTruthPostProcessing.js'

- 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
AZURE_SDK_PARAMS: '-o latest'
Copy link
Contributor Author

@sergey-shandar sergey-shandar Feb 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhendrixMSFT could you make sure that this is what we want for go?

pool:
vmImage: 'Ubuntu 16.04'
steps:
- script: "scripts/swagger-to-sdk.sh Azure/$(AZURE_SDK_REPO) -v $(AZURE_SDK_PARAMS)"
135 changes: 0 additions & 135 deletions scripts/getStatus.js

This file was deleted.

14 changes: 9 additions & 5 deletions scripts/momentOfTruth.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const exec = require('child_process').exec,

let configsToProcess = utils.getConfigFilesChangedInPR();
let pullRequestNumber = utils.getPullRequestNumber();
let linterCmd = `npx autorest@2.0.4302 --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 = {};
Expand Down Expand Up @@ -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{") + "]";
Expand All @@ -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)
Expand Down