Class DeployMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- com.microsoft.azure.maven.AbstractAzureMojo
-
- com.microsoft.azure.maven.AbstractAppServiceMojo
-
- com.microsoft.azure.maven.function.AbstractFunctionMojo
-
- com.microsoft.azure.maven.function.DeployMojo
-
- All Implemented Interfaces:
com.microsoft.azure.maven.auth.AuthConfiguration,com.microsoft.azure.maven.telemetry.TelemetryConfiguration,org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="deploy", defaultPhase=DEPLOY) public class DeployMojo extends AbstractFunctionMojoDeploy artifacts to target Azure Functions in Azure. If target Azure Functions doesn't exist, it will be created.
-
-
Field Summary
-
Fields inherited from class com.microsoft.azure.maven.function.AbstractFunctionMojo
appInsightsInstance, appInsightsKey, disableAppInsights, finalName, outputDirectory, pricingTier, region, runtime, skip, TRIGGER_TYPE
-
Fields inherited from class com.microsoft.azure.maven.AbstractAppServiceMojo
appName, appServicePlanName, appServicePlanResourceGroup, appSettings, deploymentSlotSetting, deploymentType, MAVEN_PLUGIN_POSTFIX, PORTAL_URL_PATTERN, resourceGroup
-
Fields inherited from class com.microsoft.azure.maven.AbstractAzureMojo
allowTelemetry, auth, authentication, authType, buildDirectory, DEPLOY, failsOnError, httpProxyHost, httpProxyPort, INSTALLATION_ID_KEY, mavenResourcesFiltering, plugin, PLUGIN_NAME_KEY, PLUGIN_VERSION_KEY, project, session, SESSION_ID_KEY, settings, settingsDecrypter, SUBSCRIPTION_ID_KEY, SUBSCRIPTION_NOT_FOUND, SUBSCRIPTION_NOT_SPECIFIED, SUBSCRIPTION_TEMPLATE, subscriptionId, USING_AZURE_ENVIRONMENT
-
-
Constructor Summary
Constructors Constructor Description DeployMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidbindApplicationInsights(Map appSettings, boolean isCreation)Binding Function App with Application Insights Will follow the below sequence appInsightsKey -> appInsightsInstance -> Create New AI Instance (Function creation only)protected voidcheckArtifactCompileVersion()protected voidconfigureAppSettings(java.util.function.Consumer<Map> withAppSettings, Map appSettings)private com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponentcreateApplicationInsights(com.microsoft.azure.common.applicationinsights.ApplicationInsightsManager applicationInsightsManager, String name)protected com.microsoft.azure.management.appservice.FunctionDeploymentSlotcreateDeploymentSlot(com.microsoft.azure.management.appservice.FunctionApp functionApp, com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler)protected com.microsoft.azure.management.appservice.FunctionAppcreateFunctionApp(com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler)protected com.microsoft.azure.management.appservice.WebAppBasecreateOrUpdateResource()private voiddeployArtifact(com.microsoft.azure.common.deploytarget.DeployTarget deployTarget)protected voiddoExecute()private com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponentgetApplicationInsights(com.microsoft.azure.common.applicationinsights.ApplicationInsightsManager applicationInsightsManager, String appInsightsInstance)protected com.microsoft.azure.common.handlers.ArtifactHandlergetArtifactHandler()private FilegetArtifactToDeploy()com.microsoft.azure.common.appservice.DeploymentTypegetDeploymentType()protected com.microsoft.azure.common.appservice.DeploymentTypegetDeploymentTypeByRuntime()com.microsoft.azure.common.function.configurations.FunctionExtensionVersiongetFunctionExtensionVersion()protected com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandlergetFunctionRuntimeHandler()private com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponentgetOrCreateApplicationInsights(boolean enableCreation)protected com.microsoft.azure.common.appservice.OperatingSystemEnumgetOsEnum()protected booleanisDedicatedPricingTier()private booleanisDeployToSlot()private List<com.microsoft.azure.common.function.model.FunctionResource>listFunctions()Sync triggers and return function list of deployed function app Will retry when get empty result, the max retry times is LIST_TRIGGERS_MAX_RETRYprotected voidlistHTTPTriggerUrls()List anonymous HTTP Triggers url after deploymentprotected voidparseConfiguration()voidprocessAppSettingsWithDefaultValue()private voidsetDefaultAppSetting(Map result, String settingName, String settingIsEmptyMessage, String settingValue)private voidsetDefaultAppSetting(Map result, String settingName, String settingIsEmptyMessage, String defaultValue, String warningMessage)protected com.microsoft.azure.management.appservice.FunctionDeploymentSlotupdateDeploymentSlot(com.microsoft.azure.management.appservice.FunctionDeploymentSlot deploymentSlot, com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler)protected com.microsoft.azure.management.appservice.FunctionAppupdateFunctionApp(com.microsoft.azure.management.appservice.FunctionApp app, com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler)private com.microsoft.azure.management.appservice.WebAppBase.UpdateupdateFunctionAppSettings(com.microsoft.azure.management.appservice.WebAppBase.Update update)private voidvalidateApplicationInsightsConfiguration()private voidvalidateServicePlanRuntime(com.microsoft.azure.common.appservice.OperatingSystemEnum os)-
Methods inherited from class com.microsoft.azure.maven.function.AbstractFunctionMojo
getAppInsightsInstance, getAppInsightsKey, getFinalName, getFunctionApp, getPricingTier, getRegion, getRuntime, getTelemetryProperties, isDisableAppInsights, isSkipMojo, validateAppName
-
Methods inherited from class com.microsoft.azure.maven.AbstractAppServiceMojo
getAppName, getAppServicePlanName, getAppServicePlanResourceGroup, getAppSettings, getDeploymentSlotSetting, getDeploymentStagingDirectoryPath, getPortalUrl, getResourceGroup, getResourcePortalUrl, getResources, setDeploymentSlot
-
Methods inherited from class com.microsoft.azure.maven.AbstractAzureMojo
checkSubscription, execute, executeWithTimeRecorder, getActualAuthType, getAuthenticationSetting, getAuthType, getAzureAccount, getAzureClient, getBuildDirectoryAbsolutePath, getHttpProxyHost, getHttpProxyPort, getInstallationId, getMavenResourcesFiltering, getOrCreateAzureClient, getPluginName, getPluginVersion, getProject, getSession, getSessionId, getSettings, getSubscriptionId, getTargetSubscriptionId, getTelemetryProxy, getUserAgent, handleException, highlightDefaultValue, infoWithMultipleLines, initTelemetry, isFailingOnError, isTelemetryAllowed, printCurrentSubscription, selectSubscription, trackMojoFailure, trackMojoSkip, trackMojoStart, trackMojoSuccess
-
-
-
-
Field Detail
-
LIST_TRIGGERS_MAX_RETRY
private static final int LIST_TRIGGERS_MAX_RETRY
- See Also:
- Constant Field Values
-
LIST_TRIGGERS_RETRY_PERIOD_IN_SECONDS
private static final int LIST_TRIGGERS_RETRY_PERIOD_IN_SECONDS
- See Also:
- Constant Field Values
-
DEPLOY_START
private static final String DEPLOY_START
- See Also:
- Constant Field Values
-
DEPLOY_FINISH
private static final String DEPLOY_FINISH
- See Also:
- Constant Field Values
-
FUNCTION_APP_CREATE_START
private static final String FUNCTION_APP_CREATE_START
- See Also:
- Constant Field Values
-
FUNCTION_APP_CREATED
private static final String FUNCTION_APP_CREATED
- See Also:
- Constant Field Values
-
FUNCTION_SLOT_CREATE_START
private static final String FUNCTION_SLOT_CREATE_START
- See Also:
- Constant Field Values
-
FUNCTION_SLOT_CREATED
private static final String FUNCTION_SLOT_CREATED
- See Also:
- Constant Field Values
-
FUNCTION_APP_UPDATE
private static final String FUNCTION_APP_UPDATE
- See Also:
- Constant Field Values
-
FUNCTION_APP_UPDATE_DONE
private static final String FUNCTION_APP_UPDATE_DONE
- See Also:
- Constant Field Values
-
FUNCTION_SLOT_UPDATE
private static final String FUNCTION_SLOT_UPDATE
- See Also:
- Constant Field Values
-
FUNCTION_SLOT_UPDATE_DONE
private static final String FUNCTION_SLOT_UPDATE_DONE
- See Also:
- Constant Field Values
-
DEPLOYMENT_TYPE_KEY
private static final String DEPLOYMENT_TYPE_KEY
- See Also:
- Constant Field Values
-
UNKNOWN_DEPLOYMENT_TYPE
private static final String UNKNOWN_DEPLOYMENT_TYPE
- See Also:
- Constant Field Values
-
APPINSIGHTS_INSTRUMENTATION_KEY
private static final String APPINSIGHTS_INSTRUMENTATION_KEY
- See Also:
- Constant Field Values
-
APPLICATION_INSIGHTS_NOT_SUPPORTED
private static final String APPLICATION_INSIGHTS_NOT_SUPPORTED
- See Also:
- Constant Field Values
-
APPLICATION_INSIGHTS_CONFIGURATION_CONFLICT
private static final String APPLICATION_INSIGHTS_CONFIGURATION_CONFLICT
- See Also:
- Constant Field Values
-
FAILED_TO_GET_APPLICATION_INSIGHTS
private static final String FAILED_TO_GET_APPLICATION_INSIGHTS
- See Also:
- Constant Field Values
-
SKIP_CREATING_APPLICATION_INSIGHTS
private static final String SKIP_CREATING_APPLICATION_INSIGHTS
- See Also:
- Constant Field Values
-
APPLICATION_INSIGHTS_CREATE_START
private static final String APPLICATION_INSIGHTS_CREATE_START
- See Also:
- Constant Field Values
-
APPLICATION_INSIGHTS_CREATED
private static final String APPLICATION_INSIGHTS_CREATED
- See Also:
- Constant Field Values
-
APPLICATION_INSIGHTS_CREATE_FAILED
private static final String APPLICATION_INSIGHTS_CREATE_FAILED
- See Also:
- Constant Field Values
-
INSTRUMENTATION_KEY_IS_NOT_VALID
private static final String INSTRUMENTATION_KEY_IS_NOT_VALID
- See Also:
- Constant Field Values
-
FAILED_TO_GET_FUNCTION_APP_PRICING_TIER
private static final String FAILED_TO_GET_FUNCTION_APP_PRICING_TIER
- See Also:
- Constant Field Values
-
FAILED_TO_LIST_TRIGGERS
private static final String FAILED_TO_LIST_TRIGGERS
- See Also:
- Constant Field Values
-
UNABLE_TO_LIST_NONE_ANONYMOUS_HTTP_TRIGGERS
private static final String UNABLE_TO_LIST_NONE_ANONYMOUS_HTTP_TRIGGERS
- See Also:
- Constant Field Values
-
HTTP_TRIGGER_URLS
private static final String HTTP_TRIGGER_URLS
- See Also:
- Constant Field Values
-
NO_ANONYMOUS_HTTP_TRIGGER
private static final String NO_ANONYMOUS_HTTP_TRIGGER
- See Also:
- Constant Field Values
-
AUTH_LEVEL
private static final String AUTH_LEVEL
- See Also:
- Constant Field Values
-
HTTP_TRIGGER
private static final String HTTP_TRIGGER
- See Also:
- Constant Field Values
-
NO_TRIGGERS_FOUNDED
private static final String NO_TRIGGERS_FOUNDED
- See Also:
- Constant Field Values
-
SYNCING_TRIGGERS_AND_FETCH_FUNCTION_INFORMATION
private static final String SYNCING_TRIGGERS_AND_FETCH_FUNCTION_INFORMATION
- See Also:
- Constant Field Values
-
ARTIFACT_INCOMPATIBLE
private static final String ARTIFACT_INCOMPATIBLE
- See Also:
- Constant Field Values
-
FUNCTION_APP_NOT_EXISTS
private static final String FUNCTION_APP_NOT_EXISTS
- See Also:
- Constant Field Values
-
FUNCTIONS_WORKER_RUNTIME_NAME
private static final String FUNCTIONS_WORKER_RUNTIME_NAME
- See Also:
- Constant Field Values
-
FUNCTIONS_WORKER_RUNTIME_VALUE
private static final String FUNCTIONS_WORKER_RUNTIME_VALUE
- See Also:
- Constant Field Values
-
SET_FUNCTIONS_WORKER_RUNTIME
private static final String SET_FUNCTIONS_WORKER_RUNTIME
- See Also:
- Constant Field Values
-
CUSTOMIZED_FUNCTIONS_WORKER_RUNTIME_WARNING
private static final String CUSTOMIZED_FUNCTIONS_WORKER_RUNTIME_WARNING
- See Also:
- Constant Field Values
-
FUNCTIONS_EXTENSION_VERSION_NAME
private static final String FUNCTIONS_EXTENSION_VERSION_NAME
- See Also:
- Constant Field Values
-
FUNCTIONS_EXTENSION_VERSION_VALUE
private static final String FUNCTIONS_EXTENSION_VERSION_VALUE
- See Also:
- Constant Field Values
-
SET_FUNCTIONS_EXTENSION_VERSION
private static final String SET_FUNCTIONS_EXTENSION_VERSION
- See Also:
- Constant Field Values
-
CREATE_NEW_FUNCTION_APP
private static final String CREATE_NEW_FUNCTION_APP
- See Also:
- Constant Field Values
-
RUNNING
private static final String RUNNING
- See Also:
- Constant Field Values
-
parsedJavaVersion
private com.microsoft.azure.management.appservice.JavaVersion parsedJavaVersion
-
-
Method Detail
-
getDeploymentType
public com.microsoft.azure.common.appservice.DeploymentType getDeploymentType() throws com.microsoft.azure.common.exceptions.AzureExecutionException- Overrides:
getDeploymentTypein classcom.microsoft.azure.maven.AbstractAppServiceMojo- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException
-
doExecute
protected void doExecute() throws com.microsoft.azure.common.exceptions.AzureExecutionException- Specified by:
doExecutein classcom.microsoft.azure.maven.AbstractAzureMojo- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException
-
deployArtifact
private void deployArtifact(com.microsoft.azure.common.deploytarget.DeployTarget deployTarget) throws com.microsoft.azure.common.exceptions.AzureExecutionException, com.microsoft.azure.maven.auth.AzureAuthFailureException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionExceptioncom.microsoft.azure.maven.auth.AzureAuthFailureException
-
createOrUpdateResource
protected com.microsoft.azure.management.appservice.WebAppBase createOrUpdateResource() throws com.microsoft.azure.common.exceptions.AzureExecutionException, com.microsoft.azure.maven.auth.AzureAuthFailureException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionExceptioncom.microsoft.azure.maven.auth.AzureAuthFailureException
-
createFunctionApp
protected com.microsoft.azure.management.appservice.FunctionApp createFunctionApp(com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler) throws com.microsoft.azure.maven.auth.AzureAuthFailureException, com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.maven.auth.AzureAuthFailureExceptioncom.microsoft.azure.common.exceptions.AzureExecutionException
-
updateFunctionApp
protected com.microsoft.azure.management.appservice.FunctionApp updateFunctionApp(com.microsoft.azure.management.appservice.FunctionApp app, com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler) throws com.microsoft.azure.maven.auth.AzureAuthFailureException, com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.maven.auth.AzureAuthFailureExceptioncom.microsoft.azure.common.exceptions.AzureExecutionException
-
createDeploymentSlot
protected com.microsoft.azure.management.appservice.FunctionDeploymentSlot createDeploymentSlot(com.microsoft.azure.management.appservice.FunctionApp functionApp, com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler) throws com.microsoft.azure.common.exceptions.AzureExecutionException, com.microsoft.azure.maven.auth.AzureAuthFailureException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionExceptioncom.microsoft.azure.maven.auth.AzureAuthFailureException
-
updateDeploymentSlot
protected com.microsoft.azure.management.appservice.FunctionDeploymentSlot updateDeploymentSlot(com.microsoft.azure.management.appservice.FunctionDeploymentSlot deploymentSlot, com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler runtimeHandler) throws com.microsoft.azure.maven.auth.AzureAuthFailureException, com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.maven.auth.AzureAuthFailureExceptioncom.microsoft.azure.common.exceptions.AzureExecutionException
-
listHTTPTriggerUrls
protected void listHTTPTriggerUrls()
List anonymous HTTP Triggers url after deployment
-
getFunctionRuntimeHandler
protected com.microsoft.azure.common.function.handlers.runtime.FunctionRuntimeHandler getFunctionRuntimeHandler() throws com.microsoft.azure.maven.auth.AzureAuthFailureException, com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.maven.auth.AzureAuthFailureExceptioncom.microsoft.azure.common.exceptions.AzureExecutionException
-
validateServicePlanRuntime
private void validateServicePlanRuntime(com.microsoft.azure.common.appservice.OperatingSystemEnum os) throws com.microsoft.azure.common.exceptions.AzureExecutionException, com.microsoft.azure.maven.auth.AzureAuthFailureException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionExceptioncom.microsoft.azure.maven.auth.AzureAuthFailureException
-
getOsEnum
protected com.microsoft.azure.common.appservice.OperatingSystemEnum getOsEnum() throws com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException
-
getArtifactHandler
protected com.microsoft.azure.common.handlers.ArtifactHandler getArtifactHandler() throws com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException
-
getDeploymentTypeByRuntime
protected com.microsoft.azure.common.appservice.DeploymentType getDeploymentTypeByRuntime() throws com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException
-
isDedicatedPricingTier
protected boolean isDedicatedPricingTier() throws com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException
-
checkArtifactCompileVersion
protected void checkArtifactCompileVersion() throws com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException
-
parseConfiguration
protected void parseConfiguration()
-
processAppSettingsWithDefaultValue
public void processAppSettingsWithDefaultValue()
-
setDefaultAppSetting
private void setDefaultAppSetting(Map result, String settingName, String settingIsEmptyMessage, String settingValue)
-
setDefaultAppSetting
private void setDefaultAppSetting(Map result, String settingName, String settingIsEmptyMessage, String defaultValue, String warningMessage)
-
getFunctionExtensionVersion
public com.microsoft.azure.common.function.configurations.FunctionExtensionVersion getFunctionExtensionVersion() throws com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException
-
configureAppSettings
protected void configureAppSettings(java.util.function.Consumer<Map> withAppSettings, Map appSettings)
-
updateFunctionAppSettings
private com.microsoft.azure.management.appservice.WebAppBase.Update updateFunctionAppSettings(com.microsoft.azure.management.appservice.WebAppBase.Update update) throws com.microsoft.azure.common.exceptions.AzureExecutionException, com.microsoft.azure.maven.auth.AzureAuthFailureException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionExceptioncom.microsoft.azure.maven.auth.AzureAuthFailureException
-
getArtifactToDeploy
private File getArtifactToDeploy() throws com.microsoft.azure.common.exceptions.AzureExecutionException
- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException
-
listFunctions
private List<com.microsoft.azure.common.function.model.FunctionResource> listFunctions() throws com.microsoft.azure.common.exceptions.AzureExecutionException, com.microsoft.azure.maven.auth.AzureAuthFailureException, InterruptedException
Sync triggers and return function list of deployed function app Will retry when get empty result, the max retry times is LIST_TRIGGERS_MAX_RETRY- Returns:
- List of functions in deployed function app
- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException- Throw if get empty result after LIST_TRIGGERS_MAX_RETRY times retrycom.microsoft.azure.maven.auth.AzureAuthFailureException- Throw if meet Authentication exception while getting Azure client or Function appInterruptedException- Throw when thread was interrupted while sleeping between retry
-
bindApplicationInsights
private void bindApplicationInsights(Map appSettings, boolean isCreation) throws com.microsoft.azure.common.exceptions.AzureExecutionException, com.microsoft.azure.maven.auth.AzureAuthFailureException
Binding Function App with Application Insights Will follow the below sequence appInsightsKey -> appInsightsInstance -> Create New AI Instance (Function creation only)- Parameters:
appSettings- App settings mapisCreation- Define the stage of function app, as we only create ai instance by default when create new function apps- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException- When there are conflicts in configuration or meet errors while finding/creating application insights instancecom.microsoft.azure.maven.auth.AzureAuthFailureException
-
validateApplicationInsightsConfiguration
private void validateApplicationInsightsConfiguration() throws com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.common.exceptions.AzureExecutionException
-
isDeployToSlot
private boolean isDeployToSlot()
-
getOrCreateApplicationInsights
private com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponent getOrCreateApplicationInsights(boolean enableCreation) throws com.microsoft.azure.maven.auth.AzureAuthFailureException, com.microsoft.azure.common.exceptions.AzureExecutionException- Throws:
com.microsoft.azure.maven.auth.AzureAuthFailureExceptioncom.microsoft.azure.common.exceptions.AzureExecutionException
-
getApplicationInsights
private com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponent getApplicationInsights(com.microsoft.azure.common.applicationinsights.ApplicationInsightsManager applicationInsightsManager, String appInsightsInstance)
-
createApplicationInsights
private com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponent createApplicationInsights(com.microsoft.azure.common.applicationinsights.ApplicationInsightsManager applicationInsightsManager, String name)
-
-