@gradientedge/cdk-utils 9.64.0 → 9.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CommonAzureConstruct = void 0;
|
|
4
4
|
const provider_1 = require("@cdktf/provider-azurerm/lib/provider");
|
|
5
5
|
const provider_2 = require("../.gen/providers/azapi/provider");
|
|
6
|
+
const cdktf_local_exec_1 = require("cdktf-local-exec");
|
|
6
7
|
const data_azurerm_client_config_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-client-config");
|
|
7
8
|
const cdktf_1 = require("cdktf");
|
|
8
9
|
const common_1 = require("../../common");
|
|
@@ -52,6 +53,7 @@ class CommonAzureConstruct extends cdktf_1.TerraformStack {
|
|
|
52
53
|
this.determineTenantId();
|
|
53
54
|
new provider_2.AzapiProvider(this, `${this.id}-azapi-provider`, this.props);
|
|
54
55
|
new provider_1.AzurermProvider(this, `${this.id}-provider`, this.props);
|
|
56
|
+
new cdktf_local_exec_1.Provider(this, `${this.id}-local-exec-provider`);
|
|
55
57
|
}
|
|
56
58
|
/**
|
|
57
59
|
* @summary Determine the fully qualified domain name based on domainName & subDomain
|
|
@@ -5,7 +5,6 @@ const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-
|
|
|
5
5
|
const linux_function_app_1 = require("@cdktf/provider-azurerm/lib/linux-function-app");
|
|
6
6
|
const function_app_function_1 = require("@cdktf/provider-azurerm/lib/function-app-function");
|
|
7
7
|
const function_app_flex_consumption_1 = require("@cdktf/provider-azurerm/lib/function-app-flex-consumption");
|
|
8
|
-
const cdktf_local_exec_1 = require("cdktf-local-exec");
|
|
9
8
|
const utils_1 = require("../../utils");
|
|
10
9
|
/**
|
|
11
10
|
* @classdesc Provides operations on Azure Functions
|
|
@@ -113,29 +112,6 @@ class AzureFunctionManager {
|
|
|
113
112
|
environment: scope.props.stage,
|
|
114
113
|
},
|
|
115
114
|
});
|
|
116
|
-
new cdktf_local_exec_1.Provider(scope, `${id}-local-exec-provider`);
|
|
117
|
-
// Deploy function app zip package with up to 3 retry attempts.
|
|
118
|
-
// This handles transient issues like HTTP 503s returned from the Azure Kudu deployment endpoint.
|
|
119
|
-
new cdktf_local_exec_1.LocalExec(scope, `${id}-function-app-deploy`, {
|
|
120
|
-
triggers: {
|
|
121
|
-
hash: props.sourceCodeHash,
|
|
122
|
-
},
|
|
123
|
-
command: `
|
|
124
|
-
set -e
|
|
125
|
-
MAX_RETRIES=3
|
|
126
|
-
RETRY_COUNT=0
|
|
127
|
-
until az functionapp deployment source config-zip --resource-group "${resourceGroup.name}" --name "${functionApp.name}" --src "${props.deploySource}"; do
|
|
128
|
-
RETRY_COUNT=$((RETRY_COUNT+1))
|
|
129
|
-
echo "Deployment attempt $RETRY_COUNT failed. Retrying in 10 seconds..."
|
|
130
|
-
if [ "$RETRY_COUNT" -ge "$MAX_RETRIES" ]; then
|
|
131
|
-
echo "Deployment failed after $MAX_RETRIES attempts."
|
|
132
|
-
exit 1
|
|
133
|
-
fi
|
|
134
|
-
sleep 10
|
|
135
|
-
done
|
|
136
|
-
echo "Deployment succeeded."
|
|
137
|
-
`,
|
|
138
|
-
});
|
|
139
115
|
return functionApp;
|
|
140
116
|
}
|
|
141
117
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AzurermProvider } from '@cdktf/provider-azurerm/lib/provider'
|
|
2
2
|
import { AzapiProvider } from '../.gen/providers/azapi/provider'
|
|
3
|
+
import { Provider } from 'cdktf-local-exec'
|
|
3
4
|
import { DataAzurermClientConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-client-config'
|
|
4
5
|
import { AzurermBackend, TerraformStack } from 'cdktf'
|
|
5
6
|
import { Construct } from 'constructs'
|
|
@@ -72,6 +73,7 @@ export class CommonAzureConstruct extends TerraformStack {
|
|
|
72
73
|
|
|
73
74
|
new AzapiProvider(this, `${this.id}-azapi-provider`, this.props)
|
|
74
75
|
new AzurermProvider(this, `${this.id}-provider`, this.props)
|
|
76
|
+
new Provider(this, `${this.id}-local-exec-provider`)
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
/**
|
|
@@ -2,7 +2,6 @@ import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azure
|
|
|
2
2
|
import { LinuxFunctionApp } from '@cdktf/provider-azurerm/lib/linux-function-app'
|
|
3
3
|
import { FunctionAppFunction } from '@cdktf/provider-azurerm/lib/function-app-function'
|
|
4
4
|
import { FunctionAppFlexConsumption } from '@cdktf/provider-azurerm/lib/function-app-flex-consumption'
|
|
5
|
-
import { LocalExec, Provider } from 'cdktf-local-exec'
|
|
6
5
|
import { CommonAzureConstruct } from '../../common'
|
|
7
6
|
import { createAzureTfOutput } from '../../utils'
|
|
8
7
|
import { FunctionAppProps, FunctionProps, FunctionAppFlexConsumptionProps } from './types'
|
|
@@ -126,30 +125,6 @@ export class AzureFunctionManager {
|
|
|
126
125
|
},
|
|
127
126
|
})
|
|
128
127
|
|
|
129
|
-
new Provider(scope, `${id}-local-exec-provider`)
|
|
130
|
-
// Deploy function app zip package with up to 3 retry attempts.
|
|
131
|
-
// This handles transient issues like HTTP 503s returned from the Azure Kudu deployment endpoint.
|
|
132
|
-
new LocalExec(scope, `${id}-function-app-deploy`, {
|
|
133
|
-
triggers: {
|
|
134
|
-
hash: props.sourceCodeHash,
|
|
135
|
-
},
|
|
136
|
-
command: `
|
|
137
|
-
set -e
|
|
138
|
-
MAX_RETRIES=3
|
|
139
|
-
RETRY_COUNT=0
|
|
140
|
-
until az functionapp deployment source config-zip --resource-group "${resourceGroup.name}" --name "${functionApp.name}" --src "${props.deploySource}"; do
|
|
141
|
-
RETRY_COUNT=$((RETRY_COUNT+1))
|
|
142
|
-
echo "Deployment attempt $RETRY_COUNT failed. Retrying in 10 seconds..."
|
|
143
|
-
if [ "$RETRY_COUNT" -ge "$MAX_RETRIES" ]; then
|
|
144
|
-
echo "Deployment failed after $MAX_RETRIES attempts."
|
|
145
|
-
exit 1
|
|
146
|
-
fi
|
|
147
|
-
sleep 10
|
|
148
|
-
done
|
|
149
|
-
echo "Deployment succeeded."
|
|
150
|
-
`,
|
|
151
|
-
})
|
|
152
|
-
|
|
153
128
|
return functionApp
|
|
154
129
|
}
|
|
155
130
|
}
|