From a00287c8f08b30e530778daef9b95cc30ca291b3 Mon Sep 17 00:00:00 2001 From: "Hanzhang Zeng (Roger)" Date: Sun, 31 Mar 2019 02:43:20 -0700 Subject: [PATCH 1/4] Fixed: resolve VstsServiceError reference --- azure_functions_devops_build/release/release_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure_functions_devops_build/release/release_manager.py b/azure_functions_devops_build/release/release_manager.py index 22c672f..88a7122 100644 --- a/azure_functions_devops_build/release/release_manager.py +++ b/azure_functions_devops_build/release/release_manager.py @@ -6,6 +6,7 @@ import logging import vsts.release.v4_1.models as models +from vsts.exceptions import VstsServiceError from ..base.base_manager import BaseManager from ..pool.pool_manager import PoolManager from ..constants import (LINUX_CONSUMPTION, LINUX_DEDICATED, WINDOWS) @@ -74,7 +75,6 @@ class ReleaseManager(BaseManager): conditions=[condition] ) - release_definition = models.release_definition.ReleaseDefinition( name=release_definition_name, environments=[release_definition_environment], From 2b81a137a424c2794ab833ed2019afbdfb971d0f Mon Sep 17 00:00:00 2001 From: "Hanzhang Zeng (Roger)" Date: Sun, 31 Mar 2019 02:46:21 -0700 Subject: [PATCH 2/4] Removed: unsupported langauge yaml generation --- azure_functions_devops_build/yaml/yaml_manager.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/azure_functions_devops_build/yaml/yaml_manager.py b/azure_functions_devops_build/yaml/yaml_manager.py index cbfbfce..8759739 100644 --- a/azure_functions_devops_build/yaml/yaml_manager.py +++ b/azure_functions_devops_build/yaml/yaml_manager.py @@ -128,13 +128,3 @@ class YamlManager(object): dependencies.append(" modifyOutputPath: true") dependencies.append(" zipAfterPublish: false") return dependencies - - def _java_dependencies(self): - """Helper to create the standard java dependencies""" - dependencies = ['- script: |', ' dotnet restore', ' dotnet build', ' mvn clean deploy'] - logging.critical("java dependencies are currently not implemented") - return dependencies - - def _powershell_dependencies(self): - # TODO - exit(1) From c0363349047e01b4261bb6f5998e6629fed56065 Mon Sep 17 00:00:00 2001 From: "Hanzhang Zeng (Roger)" Date: Sun, 31 Mar 2019 03:11:35 -0700 Subject: [PATCH 3/4] Recover: pylint --- pylintrc => .pylintrc | 0 .../release/release_manager.py | 36 +++++++++++-------- .../yaml/yaml_manager.py | 2 +- 3 files changed, 22 insertions(+), 16 deletions(-) rename pylintrc => .pylintrc (100%) diff --git a/pylintrc b/.pylintrc similarity index 100% rename from pylintrc rename to .pylintrc diff --git a/azure_functions_devops_build/release/release_manager.py b/azure_functions_devops_build/release/release_manager.py index 88a7122..3881f99 100644 --- a/azure_functions_devops_build/release/release_manager.py +++ b/azure_functions_devops_build/release/release_manager.py @@ -49,7 +49,8 @@ class ReleaseManager(BaseManager): elif app_type == WINDOWS: workflowtasks.append(self._app_service_deploy_task_windows(service_endpoint.id, functionapp_name)) else: - logging.error("Invalid app type provided. Correct types are: Linux Consumption: %s, Linux Dedicated: %s, Windows: %s", + logging.error("Invalid app type provided. Correct types are: " + "Linux Consumption: %s, Linux Dedicated: %s, Windows: %s", LINUX_CONSUMPTION, LINUX_DEDICATED, WINDOWS) if settings is not None: @@ -58,7 +59,9 @@ class ReleaseManager(BaseManager): settings_str += (setting[0] + "='" + setting[1] + "'") # Check that settings were actually set otherwise we don't want to use the task if settings_str != "": - workflowtasks.append(self._app_settings_task_customized(service_endpoint.id, functionapp_name, resource_name, settings_str)) + workflowtasks.append(self._app_settings_task_customized( + service_endpoint.id, functionapp_name, resource_name, settings_str + )) deploy_phases = self._get_deploy_phases(deployment_input, workflowtasks, phase_inputs) @@ -110,7 +113,8 @@ class ReleaseManager(BaseManager): def _get_service_endpoint_by_name(self, project, service_endpoint_name): service_endpoints = self._service_endpoint_client.get_service_endpoints(project.id) - return next((service_endpoint for service_endpoint in service_endpoints if service_endpoint.name == service_endpoint_name), None) + return next((service_endpoint for service_endpoint in service_endpoints + if service_endpoint.name == service_endpoint_name), None) def _get_pool_by_name(self, pool_name): """Helper function to get the pool object from its name""" @@ -142,7 +146,7 @@ class ReleaseManager(BaseManager): def _get_deployment_input(self, pool_id): deployment_input = {} - deployment_input["parallelExecution"] = { "parallelExecutionType": 0 } + deployment_input["parallelExecution"] = {"parallelExecutionType": 0} deployment_input["queueId"] = pool_id return deployment_input @@ -176,8 +180,8 @@ class ReleaseManager(BaseManager): def _get_retention_policy(self): return models.environment_retention_policy.EnvironmentRetentionPolicy( - days_to_keep=300, releases_to_keep=3, retain_build=True - ) + days_to_keep=300, releases_to_keep=3, retain_build=True + ) def _get_artifact(self, build, project, artifact_name): artifacts = self._build_client.get_artifacts(build.id, project.id) @@ -198,17 +202,17 @@ class ReleaseManager(BaseManager): def _get_pre_post_approvals(self): pre_approval = models.release_definition_approval_step.ReleaseDefinitionApprovalStep( - id = 0, - rank = 1, - is_automated = True, - is_notification_on = False + id=0, + rank=1, + is_automated=True, + is_notification_on=False ) post_approval = models.release_definition_approval_step.ReleaseDefinitionApprovalStep( - id = 0, - rank = 1, - is_automated = True, - is_notification_on = False + id=0, + rank=1, + is_automated=True, + is_notification_on=False ) @@ -270,7 +274,9 @@ class ReleaseManager(BaseManager): appsetttingstask_inputs["ConnectedServiceName"] = connectedServiceNameARM appsetttingstask_inputs["WebAppName"] = functionapp_name appsetttingstask_inputs["ResourceGroupName"] = resource_name - appsetttingstask_inputs["AppSettings"] = "WEBSITE_RUN_FROM_PACKAGE='$(storageUri)/build$(Build.BuildId).zip$(storageToken)'" + appsetttingstask_inputs["AppSettings"] = ( + "WEBSITE_RUN_FROM_PACKAGE='$(storageUri)/build$(Build.BuildId).zip$(storageToken)'" + ) appsetttingstask["inputs"] = appsetttingstask_inputs return appsetttingstask diff --git a/azure_functions_devops_build/yaml/yaml_manager.py b/azure_functions_devops_build/yaml/yaml_manager.py index 8759739..626207f 100644 --- a/azure_functions_devops_build/yaml/yaml_manager.py +++ b/azure_functions_devops_build/yaml/yaml_manager.py @@ -6,7 +6,7 @@ import os.path as path import logging from jinja2 import Environment, PackageLoader, select_autoescape -from ..constants import (WINDOWS, PYTHON, NODE, DOTNET, JAVA) +from ..constants import (WINDOWS, PYTHON, NODE, DOTNET) from ..exceptions import LanguageNotSupportException class YamlManager(object): From 68dae312880cd1384c74df3a9b12ac5a5fbb27cb Mon Sep 17 00:00:00 2001 From: "Hanzhang Zeng (Roger)" Date: Sun, 31 Mar 2019 02:44:26 -0700 Subject: [PATCH 4/4] Bump version to 0.0.14 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 578fbdd..39a33b7 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ from setuptools import setup, find_packages NAME = "azure-functions-devops-build" -VERSION = "0.0.13" +VERSION = "0.0.14" # To install the library, run the following #