Skip to content

[BotService] Fix the issue that didn't pack resources files of bot service. #14221

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

Merged
merged 6 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@

<!-- https://github.com/Microsoft/msbuild/issues/3157#issuecomment-378002971 -->
<!-- https://github.com/xunit/xunit/issues/1154#issuecomment-405366373 -->
<Exec Command="dotnet test $(RepoArtifacts)Azure.PowerShell.sln --filter &quot;AcceptanceType=CheckIn%26RunType!=DesktopOnly&quot; --configuration $(Configuration) --framework $(TestFramework) --logger trx --results-directory &quot;$(TestOutputDirectory)&quot;" Condition="$(TestCsprojListCount) == 0" />
<Exec Command="dotnet test $(RepoArtifacts)Azure.PowerShell.sln --filter &quot;AcceptanceType=CheckIn%26RunType!=DesktopOnly&quot; --configuration $(Configuration) --framework $(TestFramework) --logger trx --results-directory &quot;$(TestOutputDirectory)&quot;" Condition="$(TestCsprojListCount) != 0" />
<Message Importance="high" Text="Finish running tests..." />
<OnError ExecuteTargets="TestFailureErrorMessage" />
</Target>
Expand Down
1 change: 1 addition & 0 deletions src/BotService/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Fixed the issue that didn't pack template files into nupkg.

## Version 0.1.0
* First preview release for module Az.BotService
3 changes: 3 additions & 0 deletions src/BotService/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,7 @@ directive:
set:
parameter-name: Name
alias: BotName
- from: Az.BotService.nuspec
where: $
transform: $ = $.replace('</files>', ' <file src="resources\**\*.*" target="resources" />\n </files>');
```
61 changes: 61 additions & 0 deletions src/BotService/resources/typescript.web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This configuration file is required if iisnode is used to run a TypeScript Node.js processes behind
IIS or IIS Express. For more information, visit:
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->

<configuration>
<system.webServer>
<!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support -->
<webSocket enabled="false" />
<handlers>
<!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
<add name="iisnode" path="lib/index.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<!-- Do not interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^lib/index.js\/debug[\/]?" />
</rule>

<!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>

<!-- All other URLs are mapped to the node.js site entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="lib/index.js"/>
</rule>
</rules>
</rewrite>

<!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>

<!-- Make sure error responses are left untouched -->
<httpErrors existingResponse="PassThrough" />

<!--
You can control how Node is hosted within IIS using the following options:
* watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
* node_env: will be propagated to node as NODE_ENV environment variable
* debuggingEnabled - controls whether the built-in debugger is enabled
See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
-->
<!--<iisnode watchedFiles="web.config;*.js"/>-->
</system.webServer>
</configuration>
61 changes: 61 additions & 0 deletions src/BotService/resources/web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This configuration file is required if iisnode is used to run node processes behind
IIS or IIS Express. For more information, visit:
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->

<configuration>
<system.webServer>
<!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support -->
<webSocket enabled="false" />
<handlers>
<!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
<add name="iisnode" path="index.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<!-- Do not interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^index.js\/debug[\/]?" />
</rule>

<!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>

<!-- All other URLs are mapped to the node.js site entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="index.js"/>
</rule>
</rules>
</rewrite>

<!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>

<!-- Make sure error responses are left untouched -->
<httpErrors existingResponse="PassThrough" />

<!--
You can control how Node is hosted within IIS using the following options:
* watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
* node_env: will be propagated to node as NODE_ENV environment variable
* debuggingEnabled - controls whether the built-in debugger is enabled
See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
-->
<!--<iisnode watchedFiles="web.config;*.js"/>-->
</system.webServer>
</configuration>
183 changes: 183 additions & 0 deletions src/BotService/resources/webappv4.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"botEnv": {
"type": "string",
"defaultValue": "prod"
},
"botId": {
"type": "string"
},
"description": {
"type": "string",
"defaultValue": ""
},
"location": {
"type": "string"
},
"sku": {
"type": "string"
},
"kind": {
"type": "string"
},
"siteName": {
"type": "string"
},
"appId": {
"type": "string",
"defaultValue": "1234"
},
"appSecret": {
"type": "string",
"defaultValue": "blank"
},
"zipUrl": {
"type": "string",
"defaultValue": ""
},
"serverFarmId": {
"type": "string"
},
"createServerFarm": {
"type": "bool"
},
"serverFarmLocation": {
"type": "string",
"defaultValue": ""
},
"serverFarmSku": {
"type": "object",
"defaultValue": {
"name": "S1",
"tier": "Standard",
"size": "S1",
"family": "S",
"capacity": 1
}
},
"endpoint": {
"type": "string",
"defaultValue": ""
},
"botFileEncryptionKey": {
"type": "string",
"defaultValue": ""
}
},
"variables": {
"serverFarmName": "[last(split(parameters('serverFarmId'), '/'))]",
"botAppKinds": {
"sdk": "app",
"bot": ""
},
"botAppKind": "[variables('botAppKinds')[parameters('kind')]]",
"siteHost": "[concat(parameters('siteName'), '.azurewebsites.net')]",
"botEndpointConfig": {
"bot": "[parameters('endpoint')]",
"sdk": "[concat('https://', variables('siteHost'), '/api/messages')]"
},
"botEndpoint": "[variables('botEndpointConfig')[parameters('kind')]]"
},
"resources": [
{
"type": "Microsoft.Web/serverfarms",
"condition": "[parameters('createServerFarm')]",
"name": "[variables('serverFarmName')]",
"apiVersion": "2016-09-01",
"location": "[parameters('serverFarmLocation')]",
"sku": "[parameters('serverFarmSku')]",
"properties": {
"name": "[variables('serverFarmName')]"
}
},
{
"name": "[parameters('siteName')]",
"type": "Microsoft.Web/sites",
"apiVersion": "2015-08-01",
"location": "[parameters('location')]",
"kind": "[variables('botAppKind')]",
"dependsOn": [
"[parameters('serverFarmId')]"
],
"properties": {
"name": "[parameters('siteName')]",
"serverFarmId": "[parameters('serverFarmId')]",
"siteConfig": {
"appSettings": [
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "10.14.1"
},
{
"name": "MicrosoftAppId",
"value": "[parameters('appId')]"
},
{
"name": "MicrosoftAppPassword",
"value": "[parameters('appSecret')]"
}
],
"cors": {
"allowedOrigins": [
"https://botservice.hosting.portal.azure.net",
"https://hosting.onecloud.azure-test.net/"
]
}
}
},
"resources": [
{
"name": "MSDeploy",
"type": "Extensions",
"apiVersion": "2015-02-01",
"condition": "[not(equals(parameters('zipUrl'), ''))]",
"dependsOn": [
"[concat('Microsoft.Web/Sites/', parameters('siteName'))]"
],
"properties": {
"packageUri": "[parameters('zipUrl')]",
"dbType": "None",
"connectionString": "",
"setParameters": {
"IIS Web Application Name": "[parameters('siteName')]"
}
}
}
]
},
{
"apiVersion": "2017-12-01",
"type": "Microsoft.BotService/botServices",
"name": "[parameters('botId')]",
"location": "global",
"kind": "[parameters('kind')]",
"sku": {
"name": "[parameters('sku')]"
},
"properties": {
"name": "[parameters('botId')]",
"displayName": "[parameters('botId')]",
"endpoint": "[variables('botEndpoint')]",
"msaAppId": "[parameters('appId')]",
"publishingCredentials": "[list(concat(resourceId('Microsoft.Web/Sites', parameters('siteName')), '/config/publishingcredentials'), '2018-02-01')]",
"allSettings": {
"WEBSITE_NODE_DEFAULT_VERSION": "10.14.1",
"SCM_DO_BUILD_DURING_DEPLOYMENT": "true",
"BotId": "[parameters('botId')]",
"MicrosoftAppId": "[parameters('appId')]",
"MicrosoftAppPassword": "[parameters('appSecret')]",
"botFilePath": "[concat('./', parameters('botId'), '.bot')]",
"botFileSecret": "[parameters('botFileEncryptionKey')]",
"description": "[parameters('description')]"
}
},
"dependsOn": [
"[parameters('serverFarmId')]",
"[resourceId('Microsoft.Web/sites/', parameters('siteName'))]",
"MSDeploy"
]
}
]
}