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

Create Device Models Repository Client #14863

Merged
merged 87 commits into from
May 21, 2021
Merged

Conversation

YoDaMa
Copy link
Contributor

@YoDaMa YoDaMa commented Apr 13, 2021

This includes the untested new code structure for the Device Models Repository Client, following closely to the architecture of the Python Models Repository Client (Azure/azure-sdk-for-python#17180)

It is currently untested, and likely has bugs. In addition the tests for Node.js are not complete and neither is the rollup configuration. Futher testing using karma must be conducted to validate browser compatibility, based on shimming the filesystem calls and other node specific utilities.

@check-enforcer
Copy link

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

What if I am onboarding a new service?

Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment:
/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run js - [service] - ci

@YoDaMa YoDaMa requested review from chradek and xirzec as code owners April 20, 2021 22:46
Copy link
Member

@rido-min rido-min left a comment

Choose a reason for hiding this comment

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

The client should detect when the requested model-id does not match casing.

Eg, the next resolution should fail

const dmr = require("../../dist/index.js")
const dmrClient = new dmr.ModelsRepositoryClient()
main = async () => {
  const models = await dmrClient.getModels('dtmi:com:example:temperatureController;1')
  console.log(JSON.stringify(models, null, 2))
}
main().catch(e=>console.error(e))

Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

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

Good work! I'm happy with where this has landed, thanks for the quick turnaround in handling feedback. I replied to the open threads I saw, let me know if I missed anything.

@@ -0,0 +1,158 @@
<!-- The following YAML bit is needed by the docs system to publish the samples online. Uncomment/Update it when the samples can be published publically -->
Copy link
Member

Choose a reason for hiding this comment

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

/cc @willmtemple for feedback on the samples workflow

}
};

const currentPlatform = isBrowser() ? "browser" : isNode() ? "node" : "undefined";
Copy link
Member

Choose a reason for hiding this comment

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

out of curiosity, what do you do when currentPlatform is "undefined"? Also curious if it should be the actual value undefined instead of the string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right now there is no real use for currentPlatform, which is probably why I let the bug on uncalled functions through. It is used to create a default user agent string, but the service is unmanaged so there's really no user agent string processing right now. This is just a future-proofing step.

Copy link
Member

Choose a reason for hiding this comment

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

UserAgentPolicy can take care of platform detection:

https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/core/core-rest-pipeline/src/policies/userAgentPolicy.ts

It already grabs the platform, bitness, etc

Copy link
Member

Choose a reason for hiding this comment

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

It's part of the default pipeline returned by createPipelineFromOptions:

export function createPipelineFromOptions(options: InternalPipelineOptions): Pipeline {

Or you can make an empty one and add it in if you don't want the other default behaviors

@xirzec xirzec merged commit e86368c into Azure:master May 21, 2021
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this pull request Jun 18, 2021
[resources] delete useless track1 configuration for python (Azure#14863)

* Update readme.python.md

* Update readme.md
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this pull request Jun 18, 2021
[resources] delete useless track1 configuration for python (Azure#14863)

* Update readme.python.md

* Update readme.md
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this pull request Jun 18, 2021
[resources] delete useless track1 configuration for python (Azure#14863)

* Update readme.python.md

* Update readme.md
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this pull request Jun 18, 2021
[resources] delete useless track1 configuration for python (Azure#14863)

* Update readme.python.md

* Update readme.md
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this pull request Jun 18, 2021
[resources] delete useless track1 configuration for python (Azure#14863)

* Update readme.python.md

* Update readme.md
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this pull request Jun 18, 2021
[resources] delete useless track1 configuration for python (Azure#14863)

* Update readme.python.md

* Update readme.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants