Skip to content

Commit 25f951b

Browse files
mattchendersonAmrutaKawadeHanzhang Zeng (Roger)Hazhzeng
authored
Kubeapp (releases/V1) (#83)
* app-kind changes * updating tests folder * kudu get appsettings altenative for kubeapp * removed typo * Release v1.2.1 * reverted test changes * adding lib * rebuilding Co-authored-by: Amruta Kawade <[email protected]> Co-authored-by: Hanzhang Zeng (Roger) <[email protected]> Co-authored-by: Hanzhang Zeng <[email protected]>
1 parent 90060f5 commit 25f951b

File tree

2,360 files changed

+373984
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,360 files changed

+373984
-92
lines changed

lib/handlers/resourceValidator.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ class ResourceValidator {
7777
const scm = context.scmCredentials;
7878
this._kuduService = new azure_app_kudu_service_1.Kudu(scm.uri, scm.username, scm.password);
7979
this._kuduServiceUtil = new KuduServiceUtility_1.KuduServiceUtility(this._kuduService);
80-
this._appSettings = yield this.getFunctionappSettingsScm(state, this._kuduService);
80+
//Kudu API (GET {publishURL}/api/settings api is not available for kubeapp
81+
this._appSettings = (scm.uri.indexOf("k4apps") === -1) ? yield this.getFunctionappSettingsScm(state, this._kuduService) : null;
8182
this._appUrl = scm.appUrl;
8283
this._isLinux = null;
8384
});
@@ -90,7 +91,7 @@ class ResourceValidator {
9091
}
9192
this._resourceGroupName = appDetails["resourceGroupName"];
9293
this._kind = appDetails["kind"];
93-
this._isLinux = this._kind.indexOf('linux') >= 0;
94+
this._isLinux = this._kind.indexOf('linux') >= 0 || this._kind.indexOf('kubeapp') >= 0;
9495
});
9596
}
9697
getOsTypeFromIsLinux(isLinux) {
@@ -120,7 +121,7 @@ class ResourceValidator {
120121
for (const key in configSettings.properties) {
121122
utils_1.Logger.Debug(`- ${key} = ${configSettings.properties[key]}`);
122123
}
123-
const result = function_sku_1.FunctionSkuUtil.FromString(configSettings.properties.sku);
124+
const result = (!!configSettings.properties.sku) ? function_sku_1.FunctionSkuUtil.FromString(configSettings.properties.sku) : undefined;
124125
utils_1.Logger.Info(`Detected function app sku: ${function_sku_1.FunctionSkuConstant[result]}`);
125126
return result;
126127
});

lib/publishers/zipDeploy.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ class ZipDeploy {
4848
}
4949
static validateApplicationSettings(state, context) {
5050
const appSettings = context.appSettings;
51-
if (appSettings.WEBSITE_RUN_FROM_PACKAGE !== undefined &&
51+
if (!!appSettings && appSettings.WEBSITE_RUN_FROM_PACKAGE !== undefined &&
5252
appSettings.WEBSITE_RUN_FROM_PACKAGE.trim().startsWith('http')) {
5353
throw new exceptions_1.AzureResourceError(state, "zipDepoy", "WEBSITE_RUN_FROM_PACKAGE in your function app is " +
5454
"set to an URL. Please remove WEBSITE_RUN_FROM_PACKAGE app setting from your function app.");
5555
}
56-
if (appSettings.WEBSITE_RUN_FROM_PACKAGE !== undefined &&
56+
if (!!appSettings && appSettings.WEBSITE_RUN_FROM_PACKAGE !== undefined &&
5757
appSettings.WEBSITE_RUN_FROM_PACKAGE.trim() === '1' &&
5858
(context.os === undefined || context.os === runtime_stack_1.RuntimeStackConstant.Linux)) {
5959
utils_1.Logger.Warn("Detected WEBSITE_RUN_FROM_PACKAGE is set to '1'. If you are deploying to a Linux " +
@@ -65,7 +65,7 @@ class ZipDeploy {
6565
return __awaiter(this, void 0, void 0, function* () {
6666
try {
6767
if (context.os === runtime_stack_1.RuntimeStackConstant.Windows &&
68-
context.authenticationType === authentication_type_1.AuthenticationType.Rbac &&
68+
context.authenticationType === authentication_type_1.AuthenticationType.Rbac && !!context.appSettings &&
6969
!utils_1.Parser.IsTrueLike(context.appSettings.WEBSITE_RUN_FROM_PACKAGE)) {
7070
utils_1.Logger.Info('Setting WEBSITE_RUN_FROM_PACKAGE to 1');
7171
yield this._updateApplicationSettings(context, { 'WEBSITE_RUN_FROM_PACKAGE': '1' });
@@ -96,17 +96,17 @@ class ZipDeploy {
9696
try {
9797
if (context.authenticationType === authentication_type_1.AuthenticationType.Scm) {
9898
// Restore previous app settings if they are temporarily changed
99-
if (original.WEBSITE_RUN_FROM_PACKAGE) {
99+
if (!!original && original.WEBSITE_RUN_FROM_PACKAGE) {
100100
yield utils_1.Client.updateAppSettingViaKudu(context.scmCredentials, {
101101
'WEBSITE_RUN_FROM_PACKAGE': original.WEBSITE_RUN_FROM_PACKAGE
102102
}, 3, 3, false);
103103
}
104-
if (original.SCM_DO_BUILD_DURING_DEPLOYMENT) {
104+
if (!!original && original.SCM_DO_BUILD_DURING_DEPLOYMENT) {
105105
yield utils_1.Client.updateAppSettingViaKudu(context.scmCredentials, {
106106
'SCM_DO_BUILD_DURING_DEPLOYMENT': original.SCM_DO_BUILD_DURING_DEPLOYMENT
107107
}, 3, 3, false);
108108
}
109-
if (original.ENABLE_ORYX_BUILD) {
109+
if (!!original && original.ENABLE_ORYX_BUILD) {
110110
yield utils_1.Client.updateAppSettingViaKudu(context.scmCredentials, {
111111
'ENABLE_ORYX_BUILD': original.ENABLE_ORYX_BUILD
112112
}, 3, 3, false);
@@ -123,13 +123,13 @@ class ZipDeploy {
123123
try {
124124
if (context.authenticationType === authentication_type_1.AuthenticationType.Scm) {
125125
// Delete previous app settings if they are temporarily set
126-
if (original.WEBSITE_RUN_FROM_PACKAGE === undefined) {
126+
if (!!original && original.WEBSITE_RUN_FROM_PACKAGE === undefined) {
127127
yield utils_1.Client.deleteAppSettingViaKudu(context.scmCredentials, 'WEBSITE_RUN_FROM_PACKAGE', 3, 3, false);
128128
}
129-
if (original.SCM_DO_BUILD_DURING_DEPLOYMENT === undefined) {
129+
if (!!original && original.SCM_DO_BUILD_DURING_DEPLOYMENT === undefined) {
130130
yield utils_1.Client.deleteAppSettingViaKudu(context.scmCredentials, 'SCM_DO_BUILD_DURING_DEPLOYMENT', 3, 3, false);
131131
}
132-
if (original.ENABLE_ORYX_BUILD === undefined) {
132+
if (!!original && original.ENABLE_ORYX_BUILD === undefined) {
133133
yield utils_1.Client.deleteAppSettingViaKudu(context.scmCredentials, 'ENABLE_ORYX_BUILD', 3, 3, false);
134134
}
135135
}
@@ -147,8 +147,8 @@ class ZipDeploy {
147147
while (retryCount > 0) {
148148
yield utils_1.Sleeper.timeout(retryInterval);
149149
try {
150-
const settings = yield context.kuduService.getAppSettings();
151-
if (settings && settings[key] && settings[key] === expectedValue) {
150+
const settings = yield context.appService.getApplicationSettings();
151+
if (settings && settings.properties[key] && settings.properties[key] === expectedValue) {
152152
isSuccess = true;
153153
break;
154154
}

node_modules/.bin/_mocha

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/_mocha.cmd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/esparse

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/esparse.cmd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/esvalidate

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/esvalidate.cmd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/flat

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/flat.cmd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/he

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/he.cmd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/js-yaml

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/js-yaml.cmd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/jsesc

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/jsesc.cmd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/json5

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/json5.cmd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/mime

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/mime.cmd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/mocha

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/mocha.cmd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/nanoid

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/nanoid.cmd

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/node-which

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)