Skip to content

Comments

Add live validation#2211

Merged
vladbarosan merged 2 commits intoAzure:masterfrom
vladbarosan:addLiveValidation
Jan 9, 2018
Merged

Add live validation#2211
vladbarosan merged 2 commits intoAzure:masterfrom
vladbarosan:addLiveValidation

Conversation

@vladbarosan
Copy link

  • Add job for live validation of swagger changes.

@vladbarosan
Copy link
Author

vladbarosan commented Jan 4, 2018

@veronicagg the python and ruby builds are failing. For some reason Ruby tries to build specification/compute/resource-manager/Microsoft.Compute/2017-03-30 while Python tries to build cognitiveservices.vision.customvision.prediction which don't exit.

Looking at another build job it also would try there, but it skips since no file is involved in the PR. In this case it seems to build everything ( because no swagger is changed ? ).

Do you know where that list is coming from and can we update it ?

@veronicagg
Copy link
Contributor

@vladbarosan with the latest reorganization of the repo (preview/stable) the specs are not were they used to be anymore, so our https://github.com/Azure/azure-sdk-for-ruby/blob/master/swagger_to_sdk_config.json is out of date for the cases where we point to specific specs (not readme.md files). I'll make a PR against azure-sdk-for-ruby to update the swagger_to_sdk_config.json file with the new paths. Thanks!
For the Python issue, @lmazuel should be able to help.

@lmazuel
Copy link
Member

lmazuel commented Jan 4, 2018

@vladbarosan Python is failing because I already updated swagger-to-sdk to generate the content of this unmerged PR:
#2177

Since Tuesday, SwaggerToSdk is able to configure itself automatically by parsing the Readme looking for a "swagger-to-sdk" section. Once I migrated the content from swagger-to-sdk conf, this kind of problem will no longer happen. In progress, sorry for the disagreement in the meantime.

@vladbarosan
Copy link
Author

vladbarosan commented Jan 5, 2018

@veronicagg Sample output on validation failure https://travis-ci.org/vladbarosan/azure-rest-api-specs/jobs/325251898

At point preferably to have the result and the link to the logs posted to the PR.

Copy link
Contributor

@veronicagg veronicagg left a comment

Choose a reason for hiding this comment

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

Comments inline.

.travis.yml Outdated
- MODE=liveValidation PR_ONLY=true
global:
secure: n7Ptb5x7Zdq/7na2L68JlrRPbl/xWtiFQncO7fsrSVuVGI4Mhjj1LD2k07qWAdFPM1PaZYvCRWc3YwbXr1NTOOn485r6qcLUjpN9TICP0ErGcEA9SzctipfbFP1IV4aCh23WSaopMueBki52KfskaGcZ2ox9pvI2LCysCp7q4WwF/0vArLYf48FeZuscWHVaLsU4z8ZMFPT9yHg+RQoqPeBnaR/ZGtG96NZolT+VAlP445geb0qn8wWAuSl4bR1JQV2eA3MwdWu/iVkepBeKTN7d81l3yjWzTvFtP/JRJClWBNQbOMjAed3/2Tr2lGgyRUM6Uwp4KvfRmbX3Xrlggen1AO/YAb2mJDs+HARPnhZXIOtDjgft/ethVeLTTBUsbNFGUN2lcrJMw9dkFi+ai3XefatENJbULqWx8Xb+wMD1b0TrI6sZZpdC8vYHnM/DoqiEh5+h3okkSmQcjPF4K9js294G790PKf4u2CQdur41qh4Ze4IzbvulVsGMON+O93vA6ZRK1sTHC5VUTs2iMhCnf6LtMN59kBq1T2MJ8ndXRpGlFEn2wDTjJSpSr0k0sjoG5i+bIFhbqVF8xegBb/PH4H9/i1ifIypNNp0FGdz4o2cFsYrcUKFsx1C/kFJ6rC809r0odDt32hGSOkOCziTwFHusbR5Nwf0RjOWSgvc=
secure: >-
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the reason for this change?

Copy link
Author

Choose a reason for hiding this comment

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

Automatic on save


In reply to: 159791961 [](ancestors = 159791961)

- env: MODE=model PR_ONLY=true
- env: MODE=BreakingChange PR_ONLY=true
- env: MODE=azurebot PR_ONLY=true
- env: MODE=liveValidation PR_ONLY=true
Copy link
Contributor

Choose a reason for hiding this comment

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

should we remove "env: MODE=linter PR_ONLY=false" since you're cleaning up the file anyway?

Copy link
Author

Choose a reason for hiding this comment

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

yes if we don't need it


In reply to: 159792088 [](ancestors = 159792088)

.travis.yml Outdated
- python -c "import os; print('\n'.join(v for v in os.environ.keys() if v.startswith('TRAVIS')))" > /tmp/env_file
# Required for installing dotnet 2.0.0 according to https://www.microsoft.com/net/core#linuxubuntu
- curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
- >-
Copy link
Contributor

Choose a reason for hiding this comment

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

does ">-" just allow multiple lines on the script?

Copy link
Author

Choose a reason for hiding this comment

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

yes.


In reply to: 159792157 [](ancestors = 159792157)

before_install:
- docker pull lmazuel/swagger-to-sdk
- python -c "import os; print('\n'.join(v for v in os.environ.keys() if v.startswith('TRAVIS')))" > /tmp/env_file
# Required for installing dotnet 2.0.0 according to https://www.microsoft.com/net/core#linuxubuntu
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we removing this comment?

Copy link
Author

@vladbarosan vladbarosan Jan 5, 2018

Choose a reason for hiding this comment

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

I have the format on save, which did most of these changes :)


In reply to: 159792221 [](ancestors = 159792221)

.travis.yml Outdated
- >-
if [[ $MODE == 'ruby' ]]; then $DOCKER_CMD AutorestCI/azure-sdk-for-ruby
--pr-repo-id Azure/azure-sdk-for-ruby -o master -v; fi
- 'if [[ $MODE == ''syntax'' ]]; then npm test -- test/syntax.js; fi'
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need quotes around these lines? and double quotes for the MODE values?

package.json Outdated
"@microsoft.azure/async-io": "^1.0.21",
"@microsoft.azure/literate": "^1.0.21",
"@microsoft.azure/polyfill": "^1.0.17",
"azure-storage": "^2.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

what do you need azure-storage dependency for?

Copy link
Author

Choose a reason for hiding this comment

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

it was already here, just sorted in alphabetic order. not sure who has dependency on it, searching in the repo there is no reference, I can remove it


In reply to: 159792564 [](ancestors = 159792564)

validationService = "https://app.azure-devex-tools.com/api/validations",
branch = utils.getSourceBranch(),
processingDelay = 20,
isRunningInTraviCI = process.env.MODE === 'liveValidation' && process.env.PR_ONLY === 'true',
Copy link
Contributor

Choose a reason for hiding this comment

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

typo in name, "Travi" -> "Travis"

return;
}

let resourceProvider = validationModels.keys().next().value;
Copy link
Contributor

Choose a reason for hiding this comment

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

could this fail? is there always a keys().next().value?

Copy link
Contributor

Choose a reason for hiding this comment

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

are you only expecting 1 resourceProvider?

Copy link
Author

Choose a reason for hiding this comment

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

same as for api version


In reply to: 159793672 [](ancestors = 159793672)

Copy link
Author

Choose a reason for hiding this comment

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

here it won't fail since we just return before that if the validationModels is empty (i.e. there is no swagger in the change)

}

let resourceProvider = validationModels.keys().next().value;
let apiVersion = validationModels.get(resourceProvider).values().next().value;
Copy link
Contributor

Choose a reason for hiding this comment

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

similar question to the one above for this

Copy link
Contributor

Choose a reason for hiding this comment

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

are you only expecting 1 api version, what if there are multiple involved in the changed files?

Copy link
Author

@vladbarosan vladbarosan Jan 5, 2018

Choose a reason for hiding this comment

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

yes currently only 1 api version supported so getting only first 1. Will actually put a message in case tehre are multiple to inform that only the first match gets used


In reply to: 159793778 [](ancestors = 159793778)

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, regarding multiple resource providers or multiple api-versions. It's good if there's a clear message about that. You may want to log an issue in your tool repo about this, so you can refer to it when it occurs in a PR, I'm sure it'll be occurring and you can collect feedback and number of instances by referring to it.

let validationId = JSON.parse(response).validationId;

let validationResultUrl = `${validationService}/${validationId}`;
console.log(`Request done, results will be available at ${validationResultUrl} in ${durationInSeconds} seconds...`);
Copy link
Contributor

Choose a reason for hiding this comment

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

looking at the sample output, not sure that the link in this line is that helpful, it does contain the result, but not easily readable, so you may want to include this link in a "log" line that doesn't lead the user to use it. The way it's included here, seems like the first thing I'd check.

Copy link
Author

Choose a reason for hiding this comment

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

That is there just for reference, after the result is returned it displays the results. Take a look at https://travis-ci.org/vladbarosan/azure-rest-api-specs/jobs/325251898 for a sample

Copy link
Author

@vladbarosan vladbarosan Jan 5, 2018

Choose a reason for hiding this comment

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

You might be right to hide it though as it might distract, will update.

.travis.yml Outdated
Copy link
Contributor

@veronicagg veronicagg Jan 9, 2018

Choose a reason for hiding this comment

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

This is just coming back as commented out, as it had been removed in the previous commit. thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

minor typo: upper case "S" isRunningInTraviSCI

Copy link
Contributor

Choose a reason for hiding this comment

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

"will be ready in" ?
I think it's good to remove it from here, if the output is useful for debugging (particularly for you or reviewers) feel free to write out the link, just somewhere else maybe in parenthesis or something - like "Note: raw results at "

Copy link
Author

Choose a reason for hiding this comment

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

well actually I print later everything that comes from there, but maybe ill add it as you mentioned "with raw results at"

}

let resourceProvider = validationModels.keys().next().value;
let apiVersion = validationModels.get(resourceProvider).values().next().value;
Copy link
Contributor

Choose a reason for hiding this comment

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

ok, regarding multiple resource providers or multiple api-versions. It's good if there's a clear message about that. You may want to log an issue in your tool repo about this, so you can refer to it when it occurs in a PR, I'm sure it'll be occurring and you can collect feedback and number of instances by referring to it.

Copy link
Contributor

@veronicagg veronicagg left a comment

Choose a reason for hiding this comment

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

few minor comments, approving PR, thanks!

@vladbarosan vladbarosan merged commit 7f2c040 into Azure:master Jan 9, 2018
@AutorestCI
Copy link

No modification for AutorestCI/azure-sdk-for-python

@AutorestCI
Copy link

No modification for AutorestCI/azure-sdk-for-ruby

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants