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

feat: add js version deployment script #2463

Merged
merged 12 commits into from
Apr 14, 2020
Merged

feat: add js version deployment script #2463

merged 12 commits into from
Apr 14, 2020

Conversation

zidaneymar
Copy link
Contributor

@zidaneymar zidaneymar commented Apr 1, 2020

Description

add js version deploy script, same as the powershell one.
closes #2461

Task Item

closes #2461

part of the azure deploy plugin

Screenshots

@github-actions
Copy link

github-actions bot commented Apr 1, 2020

Coverage Status

Coverage remained the same at 39.557% when pulling 10dfa9d on qika/jsdeploy into dc8be58 on master.

Copy link
Member

@cwhitten cwhitten left a comment

Choose a reason for hiding this comment

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

@zidaneymar we should move this module into the /Composer application directory. This program will not be executed as a CLI command. It will be imported into the Composer application runtime and used in the web-app.

Because of this, Dong's comments around console.log are appropriate. The module needs an interface that communicates status and error state to the caller, but how this status is communicated to the user is not a concern of this module. Does this make sense?

I'm tagging @carlosscastro to also look at the implementation for additional suggestions, as he has experiencing building workflow against these apis.

@zidaneymar please update the description of the pull request to describe the api and intended use, so reviewers can better understand the structure and motivations.

@carlosscastro
Copy link
Member

P0 to remove console.logs and have well defined error conditions that are bubbled to library callers

@carlosscastro
Copy link
Member

The Azure library usage looks good, great that you are using ARM client libraries.


private async dotnetPublish(publishFolder: string, projFolder: string, botPath?: string) {
const projectPath = path.join(projFolder, 'BotProject.csproj')
await exec(`dotnet publish ${projectPath} -c release -o ${publishFolder} -v q`)
Copy link
Member

Choose a reason for hiding this comment

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

To be consistent, you could consider using ARM to deploy rather than dotnet publish. The nice thing is that web app zip deploy through ARM will be useful the day we have other, non-dotnet languages, since it just requires a zip file.

Here more info: https://docs.microsoft.com/en-us/azure/app-service/deploy-zip

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be consistent, you could consider using ARM to deploy rather than dotnet publish. The nice thing is that web app zip deploy through ARM will be useful the day we have other, non-dotnet languages, since it just requires a zip file.

Here more info: https://docs.microsoft.com/en-us/azure/app-service/deploy-zip

hi carloss, I use dotnet publish to produce an executable dotnet project, and then use the zip deploy you mentioned to publish that folder

await fs.writeJson(deploymentSettingsPath, settings)
const token = await this.creds.getToken()

const getAccountUri = `${luisEndpoint}/luis/api/v2.0/azureaccounts`
Copy link
Member

Choose a reason for hiding this comment

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

Is there a luis client that we could use for this instead of crafting urls and requests manually? So that if the luis API changes, the client does the changes for us :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a luis client that we could use for this instead of crafting urls and requests manually? So that if the luis API changes, the client does the changes for us :)

yes, I should use that client, and indeed there is an azure luis client inside the @azure-js-sdk, but it also have some issues, I have tried to use that client for luis accounts authoring but failed, so I turned to use the straight forward http request way..

@cwhitten
Copy link
Member

cwhitten commented Apr 9, 2020

@zidaneymar can you please address conflicts?

@zidaneymar
Copy link
Contributor Author

@zidaneymar can you please address conflicts?

resolved

private remoteBotPath: string;
private logger: (string) => any;

private readonly tenantId = '72f988bf-86f1-41af-91ab-2d7cd011db47';
Copy link
Member

Choose a reason for hiding this comment

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

whose tenant id is this? It's used globally across all instances of this library?

Copy link
Contributor Author

@zidaneymar zidaneymar Apr 13, 2020

Choose a reason for hiding this comment

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

@cwhitten
it belongs to microsoft organization, and we need this tenant id to initialize a ms graph client to create an app registration based on the password provided by user.

    const graphClient = new GraphRbacManagementClient(credsForGraph, this.tenantId, {
      baseUri: 'https://graph.windows.net',
    });

for app registration, azure js sdk also provide an options for whether this application is available to other tenants,

  /**
   * Whether the application is available to other tenants.
   */
  availableToOtherTenants?: boolean;

https://github.com/Azure/azure-sdk-for-node/blob/master/Documentation/Authentication.md#for-azure-graph-sdk

} from '@azure/arm-resources/esm/models';
import { GraphRbacManagementClient } from '@azure/graph';
import * as msRestNodeAuth from '@azure/ms-rest-nodeauth';
import * as fs from 'fs-extra';
Copy link
Member

@cwhitten cwhitten Apr 10, 2020

Choose a reason for hiding this comment

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

I'm concerned about this library being bound to being used on the filesystem. We should hook into the storage layer of Composer to reuse the serialization configurations when writing .dialog, .lu, .lg, so when someone has CosmosDB as its storage layer, this library can still service their Azure deployment needs.

@benbrown @carlosscastro Looking for your suggestions on priority. Do we P0 or P1 this? The work to pull this out is non-trivial and could take awhile. Perhaps we land Publishing & Runtime E2E and revisit.

Copy link
Contributor

Choose a reason for hiding this comment

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

i need to get deeper into how all of this works, but as it is, we pull stuff out of storage and onto disk before doing the deploy -- so in that sense, it doesn't really matter.

Composer/packages/lib/bot-deploy/src/botProjectDeploy.ts Outdated Show resolved Hide resolved
@cwhitten cwhitten merged commit c0d6997 into master Apr 14, 2020
@cwhitten cwhitten deleted the qika/jsdeploy branch April 14, 2020 02:02
lei9444 pushed a commit to lei9444/BotFramework-Composer-1 that referenced this pull request Jun 15, 2021
* js deployment init

* add empty lu models check

* rename

* fix comments, change directory under Composer, make script configurable

* fix yarn.lock

* add logger status

Co-authored-by: Qi Kang <qika@microsoft.com>
Co-authored-by: Lu Han <32191031+luhan2017@users.noreply.github.com>
Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
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