Коммит
9c4b59b375
14
README.md
14
README.md
|
@ -1,7 +1,7 @@
|
|||
# Azure Devops Build Manager For Azure Functions
|
||||
# Azure Devops Build Manager For Azure Functions (Under Development)
|
||||
|
||||
This project provides the class AzureDevopsBuildManager and supporting classes. This manager class allows
|
||||
the caller to manage Azure Devops pipelines that are maintained within an Azure Devops account. This project was created to be able to support command line tooling for the AZ Cli.
|
||||
the caller to manage Azure Devops pipelines that are maintained within an Azure Devops account.
|
||||
|
||||
## Install
|
||||
```
|
||||
|
@ -13,7 +13,7 @@ To use the API, you need to first establish a connection to azure by loging into
|
|||
```python
|
||||
from azure.cli.core import get_default_cli
|
||||
from azure.cli.core._profile import Profile
|
||||
from azure_devops_build_manager.organization.organization_manager import OrganizationManager
|
||||
from azure_functions_devops_build.organization.organization_manager import OrganizationManager
|
||||
import pprint
|
||||
|
||||
# Get your token from the az login cache
|
||||
|
@ -21,11 +21,15 @@ cli_ctx = get_default_cli()
|
|||
profile = Profile(cli_ctx=cli_ctx)
|
||||
creds, _, _ = profile.get_login_credentials(subscription_id=None)
|
||||
|
||||
# Create an organization manager using your credentials
|
||||
# Create an organization manager and user manager using your credentials
|
||||
organization_manager = OrganizationManager(creds=creds)
|
||||
user_manager = UserManager(creds=creds)
|
||||
|
||||
# Get your user id
|
||||
userid = user_manager.get_user_id()
|
||||
|
||||
# Get the list of organizations for your user
|
||||
organizations = organization_manager.list_organizations()
|
||||
organizations = organization_manager.get_organizations(userid.id)
|
||||
|
||||
# Show details about each organization in the console
|
||||
for organization in organizations:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
from azure_devops_build_manager.base.base_manager import BaseManager
|
||||
from ..base.base_manager import BaseManager
|
||||
|
||||
class ArtifactManager(BaseManager):
|
||||
""" Manage DevOps Artifacts
|
|
@ -4,10 +4,8 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
import vsts.build.v4_1.models as build_models
|
||||
import time
|
||||
|
||||
from azure_devops_build_manager.base.base_manager import BaseManager
|
||||
from azure_devops_build_manager.pool.pool_manager import PoolManager
|
||||
from ..base.base_manager import BaseManager
|
||||
from ..pool.pool_manager import PoolManager
|
||||
|
||||
|
||||
class BuilderManager(BaseManager):
|
|
@ -3,7 +3,7 @@
|
|||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
from azure_devops_build_manager.base.base_manager import BaseManager
|
||||
from ..base.base_manager import BaseManager
|
||||
|
||||
class ExtensionManager(BaseManager):
|
||||
""" Manage DevOps Extensions
|
|
@ -9,7 +9,7 @@ from msrest.service_client import ServiceClient
|
|||
from msrest import Configuration, Deserializer
|
||||
from msrest.exceptions import HttpOperationError
|
||||
|
||||
from azure_devops_build_manager.user.user_manager import UserManager
|
||||
from ..user.user_manager import UserManager
|
||||
from . import models
|
||||
|
||||
|
|
@ -8,10 +8,9 @@ from msrest.service_client import ServiceClient
|
|||
from msrest import Configuration, Deserializer
|
||||
from msrest.exceptions import HttpOperationError
|
||||
|
||||
from azure_devops_build_manager.base.base_manager import BaseManager
|
||||
from ..base.base_manager import BaseManager
|
||||
from . import models
|
||||
|
||||
|
||||
class PoolManager(BaseManager):
|
||||
""" Manage DevOps Pools
|
||||
|
|
@ -10,7 +10,7 @@ from msrest import Configuration, Deserializer
|
|||
from msrest.exceptions import HttpOperationError
|
||||
from vsts.exceptions import VstsServiceError
|
||||
import vsts.core.v4_1.models.team_project as team_project
|
||||
from azure_devops_build_manager.base.base_manager import BaseManager
|
||||
from ..base.base_manager import BaseManager
|
||||
from . import models
|
||||
|
||||
|
||||
|
@ -26,7 +26,8 @@ class ProjectManager(BaseManager):
|
|||
Otherwise see BaseManager
|
||||
"""
|
||||
|
||||
def __init__(self, base_url='https://{}.visualstudio.com', organization_name="", creds=None, create_project_url='https://dev.azure.com'):
|
||||
def __init__(self, base_url='https://{}.visualstudio.com', organization_name="", creds=None,
|
||||
create_project_url='https://dev.azure.com'):
|
||||
"""Inits Project as per BaseManager and adds relevant other needed fields"""
|
||||
super(ProjectManager, self).__init__(creds, organization_name=organization_name)
|
||||
base_url = base_url.format(organization_name)
|
||||
|
@ -87,7 +88,7 @@ class ProjectManager(BaseManager):
|
|||
def _poll_project(self, project_id):
|
||||
"""Helper function to poll the project"""
|
||||
project_created = False
|
||||
while (not project_created):
|
||||
while not project_created:
|
||||
time.sleep(1)
|
||||
res = self._is_project_created(project_id)
|
||||
logging.info('project creation is: %s', res.status)
|
||||
|
@ -101,7 +102,7 @@ class ProjectManager(BaseManager):
|
|||
|
||||
header_paramters = {}
|
||||
header_paramters['Accept'] = 'application/json'
|
||||
|
||||
|
||||
request = self._create_project_client.get(url, params=query_paramters)
|
||||
response = self._create_project_client.send(request, headers=header_paramters)
|
||||
|
|
@ -6,9 +6,9 @@
|
|||
import logging
|
||||
|
||||
import vsts.release.v4_1.models as models
|
||||
from azure_devops_build_manager.base.base_manager import BaseManager
|
||||
from azure_devops_build_manager.pool.pool_manager import PoolManager
|
||||
from azure_devops_build_manager.constants import (LINUX_CONSUMPTION, LINUX_DEDICATED, WINDOWS)
|
||||
from ..base.base_manager import BaseManager
|
||||
from ..pool.pool_manager import PoolManager
|
||||
from ..constants import (LINUX_CONSUMPTION, LINUX_DEDICATED, WINDOWS)
|
||||
|
||||
|
||||
class ReleaseManager(BaseManager):
|
||||
|
@ -21,7 +21,8 @@ class ReleaseManager(BaseManager):
|
|||
super(ReleaseManager, self).__init__(creds, organization_name=organization_name, project_name=project_name)
|
||||
|
||||
def create_release_definition(self, build_name, artifact_name, pool_name, service_endpoint_name,
|
||||
release_definition_name, app_type, functionapp_name, storage_name, resource_name, settings=[]):
|
||||
release_definition_name, app_type, functionapp_name, storage_name,
|
||||
resource_name, settings=None):
|
||||
pool = self._get_pool_by_name(pool_name)
|
||||
project = self._get_project_by_name(self._project_name)
|
||||
print(build_name, artifact_name, pool_name, service_endpoint_name,
|
||||
|
@ -52,7 +53,7 @@ class ReleaseManager(BaseManager):
|
|||
logging.error("Invalid app type provided. Correct types are: Linux Consumption: %s, Linux Dedicated: %s, Windows: %s",
|
||||
LINUX_CONSUMPTION, LINUX_DEDICATED, WINDOWS)
|
||||
|
||||
if settings:
|
||||
if settings is not None:
|
||||
settings_str = ""
|
||||
for setting in settings:
|
||||
settings_str += (setting[0] + "='" + setting[1] + "'")
|
|
@ -3,7 +3,7 @@
|
|||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
from subprocess import DEVNULL, STDOUT, check_call
|
||||
from subprocess import DEVNULL, STDOUT, check_call, check_output, CalledProcessError
|
||||
import os
|
||||
|
||||
from msrest.service_client import ServiceClient
|
||||
|
@ -11,7 +11,7 @@ from msrest import Configuration, Deserializer
|
|||
from msrest.exceptions import HttpOperationError
|
||||
import vsts.git.v4_1.models.git_repository_create_options as git_repository_create_options
|
||||
|
||||
from azure_devops_build_manager.base.base_manager import BaseManager
|
||||
from ..base.base_manager import BaseManager
|
||||
from . import models
|
||||
|
||||
|
||||
|
@ -46,6 +46,25 @@ class RepositoryManager(BaseManager):
|
|||
repository = self._get_repository_by_name(project, repository_name)
|
||||
return self._git_client.get_commits(repository.id, None, project=project.id)
|
||||
|
||||
def setup_remote(self, repository_name, remote_name):
|
||||
"""This command sets up a remote. It is normally used if a user already has a repository locally that they don't wish to get rid of"""
|
||||
if self._remote_exists(remote_name):
|
||||
message = """There is already an remote with this name."""
|
||||
succeeded = False
|
||||
else:
|
||||
origin_command = ["git", "remote", "add", remote_name, "https://" + self._organization_name + \
|
||||
".visualstudio.com/" + self._project_name + "/_git/" + repository_name]
|
||||
check_call(origin_command, stdout=DEVNULL, stderr=STDOUT)
|
||||
check_call('git add -A'.split(), stdout=DEVNULL, stderr=STDOUT)
|
||||
try:
|
||||
check_call(["git", "commit", "-a", "-m", "\"creating functions app\""], stdout=DEVNULL, stderr=STDOUT)
|
||||
except CalledProcessError:
|
||||
print("no need to commit anything")
|
||||
check_call(('git push ' + remote_name + ' --all').split(), stdout=DEVNULL, stderr=STDOUT)
|
||||
message = "succeeded"
|
||||
succeeded = True
|
||||
return models.repository_response.RepositoryResponse(message, succeeded)
|
||||
|
||||
def setup_repository(self, repository_name):
|
||||
"""This command sets up the repository locally - it initialises the git file and creates the initial push ect"""
|
||||
if self._repository_exists():
|
||||
|
@ -67,6 +86,13 @@ class RepositoryManager(BaseManager):
|
|||
"""Helper to see if gitfile exists"""
|
||||
return bool(os.path.exists('.git'))
|
||||
|
||||
def _remote_exists(self, remote_name):
|
||||
lines = (check_output('git remote show'.split())).decode('utf-8').split('\n')
|
||||
for line in lines:
|
||||
if line == remote_name:
|
||||
return True
|
||||
return False
|
||||
|
||||
def list_github_repositories(self):
|
||||
"""List github repositories if there are any from the current connection"""
|
||||
project = self._get_project_by_name(self._project_name)
|
||||
|
@ -76,34 +102,3 @@ class RepositoryManager(BaseManager):
|
|||
return []
|
||||
else:
|
||||
return self._build_client.list_repositories(project.id, 'github', github_endpoint.id)
|
||||
|
||||
def create_github_connection(self):
|
||||
"""Create a github connection endpoint that the user must go authenticate with"""
|
||||
project = self._get_project_by_name(self._project_name)
|
||||
|
||||
url = '/' + self._organization_name + '/' + str(project.id) + \
|
||||
'/_apis/connectedService/providers/github/authRequests'
|
||||
|
||||
query_paramters = {}
|
||||
query_paramters['configurationId'] = '00000000-0000-0000-0000-000000000000'
|
||||
query_paramters['scope'] = 'repo,read:user,user:email,admin:repo_hook'
|
||||
|
||||
#construct header parameters
|
||||
header_paramters = {}
|
||||
header_paramters['Accept'] = 'application/json;api-version=5.0;excludeUrls=true;' + \
|
||||
'enumsAsNumbers=true;msDateFormat=true;noArrayWrap=true'
|
||||
|
||||
request = self._client.post(url, params=query_paramters)
|
||||
response = self._client.send(request, headers=header_paramters)
|
||||
|
||||
# Handle Response
|
||||
deserialized = None
|
||||
if response.status_code not in [200]:
|
||||
print("GET %s", request.url)
|
||||
print("response: %s", response.status_code)
|
||||
print(response.text)
|
||||
raise HttpOperationError(self._deserialize, response)
|
||||
else:
|
||||
deserialized = self._deserialize('GithubConnection', response)
|
||||
|
||||
return deserialized
|
|
@ -6,7 +6,7 @@
|
|||
import json
|
||||
import subprocess
|
||||
import vsts.service_endpoint.v4_1.models as models
|
||||
from azure_devops_build_manager.base.base_manager import BaseManager
|
||||
from ..base.base_manager import BaseManager
|
||||
|
||||
class ServiceEndpointManager(BaseManager):
|
||||
""" Manage DevOps service endpoints within projects
|
||||
|
@ -14,12 +14,36 @@ class ServiceEndpointManager(BaseManager):
|
|||
Attributes:
|
||||
See BaseManager
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, organization_name="", project_name="", creds=None):
|
||||
"""Inits ServiceEndpointManager as per BaseManager"""
|
||||
super(ServiceEndpointManager, self).__init__(creds, organization_name=organization_name,
|
||||
project_name=project_name)
|
||||
|
||||
def create_github_service_endpoint(self, githubname, access_token):
|
||||
""" Create a github access token connection """
|
||||
project = self._get_project_by_name(self._project_name)
|
||||
|
||||
data = {}
|
||||
|
||||
auth = models.endpoint_authorization.EndpointAuthorization(
|
||||
parameters={
|
||||
"AccessToken": access_token
|
||||
},
|
||||
scheme="OAuth"
|
||||
)
|
||||
|
||||
service_endpoint = models.service_endpoint.ServiceEndpoint(
|
||||
administrators_group=None,
|
||||
authorization=auth,
|
||||
data=data,
|
||||
name=githubname,
|
||||
type="github",
|
||||
url="http://github.com"
|
||||
)
|
||||
|
||||
return self._service_endpoint_client.create_service_endpoint(service_endpoint, project.id)
|
||||
|
||||
def create_service_endpoint(self, servicePrincipalName):
|
||||
"""Create a new service endpoint within a project with an associated service principal"""
|
||||
project = self._get_project_by_name(self._project_name)
|
|
@ -3,7 +3,6 @@
|
|||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
from __future__ import print_function
|
||||
import logging
|
||||
from msrest.service_client import ServiceClient
|
||||
from msrest import Configuration, Deserializer
|
|
@ -5,9 +5,8 @@
|
|||
|
||||
import os.path as path
|
||||
import logging
|
||||
import json
|
||||
from jinja2 import Environment, PackageLoader, select_autoescape
|
||||
from azure_devops_build_manager.constants import (LINUX_CONSUMPTION, LINUX_DEDICATED, WINDOWS, PYTHON, NODE, DOTNET, JAVA)
|
||||
from ..constants import (WINDOWS, PYTHON, NODE, DOTNET, JAVA)
|
||||
|
||||
class YamlManager(object):
|
||||
""" Generate yaml files for devops
|
||||
|
@ -53,11 +52,12 @@ class YamlManager(object):
|
|||
|
||||
def _generate_yaml(self, dependencies, vmImage, language_str, platform_str):
|
||||
env = Environment(
|
||||
loader=PackageLoader('azure_devops_build_manager.yaml', 'templates'),
|
||||
loader=PackageLoader('azure_functions_devops_build.yaml', 'templates'),
|
||||
autoescape=select_autoescape(['html', 'xml', 'jinja'])
|
||||
)
|
||||
template = env.get_template('build.jinja')
|
||||
outputText = template.render(dependencies=dependencies, vmImage=vmImage, language=language_str, platform=platform_str)
|
||||
outputText = template.render(dependencies=dependencies, vmImage=vmImage,
|
||||
language=language_str, platform=platform_str)
|
||||
return outputText
|
||||
|
||||
def _requires_extensions(self):
|
|
@ -0,0 +1,70 @@
|
|||
# Configure the details of the functionapp
|
||||
variables:
|
||||
azureSubscription: '{ARM ACCESS TOKEN NAME}'
|
||||
storageName: '{STORAGE NAME OF FUNCTIONAPP}'
|
||||
functionappName: '{NAME OF FUNCTIONAPP}'
|
||||
resourceGroupName: '{RESOURCE GROUP NAME OF FUNCTIONAPP}'
|
||||
|
||||
jobs:
|
||||
# Build the python packages in a virtual env
|
||||
- job: Build
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
displayName: "Setting python version to 3.6 as required by functions"
|
||||
inputs:
|
||||
versionSpec: '3.6'
|
||||
architecture: 'x64'
|
||||
- script: |
|
||||
dotnet restore # COMMENT OUT IF NOT USING FUNCTION EXTENSIONS
|
||||
dotnet build --runtime ubuntu.16.04-x64 --output './bin/' # COMMENT OUT IF NOT USING FUNCTION EXTENSIONS
|
||||
python3.6 -m venv worker_venv
|
||||
source worker_venv/bin/activate
|
||||
pip3.6 install setuptools
|
||||
pip3.6 install -r requirements.txt
|
||||
- task: ArchiveFiles@2
|
||||
displayName: "Archive files"
|
||||
inputs:
|
||||
rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
|
||||
includeRootFolder: false
|
||||
archiveFile: "$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip"
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip'
|
||||
name: 'drop'
|
||||
# Download the build artifacts from
|
||||
- job: Deploy
|
||||
pool:
|
||||
vmImage: 'VS2017-Win2016'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
inputs:
|
||||
buildType: 'current'
|
||||
downloadType: 'single'
|
||||
artifactName: 'drop'
|
||||
downloadPath: '$(System.DefaultWorkingDirectory)'
|
||||
- task: AzureFileCopy@2
|
||||
inputs:
|
||||
sourcePath: "drop/build$(Build.BuildId).zip"
|
||||
azureConnectionType: 'ConnectedServiceNameARM'
|
||||
azureSubscription: "$(azureSubscription)"
|
||||
destination: azureBlob
|
||||
storage: "$(storageName)"
|
||||
containerName: 'azure-build'
|
||||
- task: createsastoken@1
|
||||
inputs:
|
||||
ConnectedServiceName: "$(azureSubscription)"
|
||||
StorageAccountRM: "$(storageName)"
|
||||
SasTokenTimeOutInHours: 10000
|
||||
Permission: 'r'
|
||||
StorageContainerName: 'azure-build'
|
||||
- task: AzureAppServiceSetAppSettings@2
|
||||
inputs:
|
||||
ConnectedServiceName: "$(azureSubscription)"
|
||||
WebAppName: "$(functionappName)"
|
||||
ResourceGroupName: "$(resourceGroupName)"
|
||||
AppSettings: "WEBSITE_RUN_FROM_PACKAGE='$(storageUri)/build$(Build.BuildId).zip$(storageToken)'"
|
||||
|
||||
dependsOn: Build
|
||||
condition: succeeded()
|
|
@ -0,0 +1,35 @@
|
|||
variables:
|
||||
azureSubscription: '{ARM ACCESS TOKEN NAME}'
|
||||
functionappName: '{NAME OF FUNCTIONAPP}'
|
||||
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
displayName: "Setting python version to 3.6 as required by functions"
|
||||
inputs:
|
||||
versionSpec: '3.6'
|
||||
architecture: 'x64'
|
||||
- script: |
|
||||
dotnet restore # COMMENT OUT IF NOT USING FUNCTION EXTENSIONS
|
||||
dotnet build --runtime ubuntu.16.04-x64 --output './bin/' # COMMENT OUT IF NOT USING FUNCTION EXTENSIONS
|
||||
python3.6 -m venv worker_venv
|
||||
source worker_venv/bin/activate
|
||||
pip3.6 install setuptools
|
||||
pip3.6 install -r requirements.txt
|
||||
- task: ArchiveFiles@2
|
||||
displayName: "Archive files"
|
||||
inputs:
|
||||
rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
|
||||
includeRootFolder: false
|
||||
archiveFile: "$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip"
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip'
|
||||
name: 'drop'
|
||||
- task: AzureRmWebAppDeployment@4
|
||||
inputs:
|
||||
connectionType: 'AzureRM'
|
||||
azureSubscription: "$(azureSubscription)"
|
||||
appType: 'functionAppLinux'
|
||||
webAppName: "$(functionappName)"
|
|
@ -0,0 +1,28 @@
|
|||
# Starter template for Azure functions build for {{language}} {{appType}}
|
||||
variables:
|
||||
azureSubscription: '{ARM ACCESS TOKEN NAME}'
|
||||
functionappName: '{NAME OF FUNCTIONAPP}'
|
||||
|
||||
pool:
|
||||
vmImage: 'VS2017-Win2016'
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
dotnet restore
|
||||
dotnet build --output \'./bin/\'
|
||||
- task: ArchiveFiles@2
|
||||
displayName: "Archive files"
|
||||
inputs:
|
||||
rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
|
||||
includeRootFolder: false
|
||||
archiveFile: "$(System.DefaultWorkingDirectory)/$(Build.BuildId).zip"
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
PathtoPublish: '$(System.DefaultWorkingDirectory)/$(Build.BuildId).zip'
|
||||
name: 'drop'
|
||||
- task: AzureRmWebAppDeployment@4
|
||||
inputs:
|
||||
connectionType: 'AzureRM'
|
||||
azureSubscription: "$(azureSubscription)"
|
||||
appType: 'functionApp'
|
||||
webAppName: "$(functionappName)"
|
|
@ -0,0 +1,30 @@
|
|||
# Starter template for Azure functions build for {{language}} {{appType}}
|
||||
variables:
|
||||
azureSubscription: '{ARM ACCESS TOKEN NAME}'
|
||||
functionappName: '{NAME OF FUNCTIONAPP}'
|
||||
|
||||
pool:
|
||||
vmImage: 'VS2017-Win2016'
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
dotnet restore # comment out if not using extensions
|
||||
dotnet build --output \'./bin/\' # comment out if not using extensions
|
||||
npm install
|
||||
npm run build
|
||||
- task: ArchiveFiles@2
|
||||
displayName: "Archive files"
|
||||
inputs:
|
||||
rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
|
||||
includeRootFolder: false
|
||||
archiveFile: "$(System.DefaultWorkingDirectory)/$(Build.BuildId).zip"
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
PathtoPublish: '$(System.DefaultWorkingDirectory)/$(Build.BuildId).zip'
|
||||
name: 'drop'
|
||||
- task: AzureRmWebAppDeployment@4
|
||||
inputs:
|
||||
connectionType: 'AzureRM'
|
||||
azureSubscription: "$(azureSubscription)"
|
||||
appType: 'functionApp'
|
||||
webAppName: "$(functionappName)"
|
10
setup.py
10
setup.py
|
@ -6,8 +6,8 @@
|
|||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
NAME = "azure-devops-build-manager"
|
||||
VERSION = "0.1.0"
|
||||
NAME = "azure-functions-devops-build"
|
||||
VERSION = "0.0.1"
|
||||
|
||||
# To install the library, run the following
|
||||
#
|
||||
|
@ -16,12 +16,14 @@ VERSION = "0.1.0"
|
|||
# prerequisite: setuptools
|
||||
# http://pypi.python.org/pypi/setuptools
|
||||
|
||||
REQUIRES = ["msrest>=0.2.0", 'mock']
|
||||
REQUIRES = ["msrest>=0.2.0",
|
||||
"vsts>=0.1.25",
|
||||
"jinja2>=2.10"]
|
||||
|
||||
setup(
|
||||
name=NAME,
|
||||
version=VERSION,
|
||||
description="Python package for integrating azure functions with azure devops",
|
||||
description="Python package for integrating azure functions with azure devops. Specifically made for the Azure Cli",
|
||||
author_email="t-oldolk@microsoft.com",
|
||||
url="https://github.com/dolko/azure-devops-build-manager",
|
||||
keywords=["Microsoft", "Azure Devops", "Azure Functions"],
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
from azure_devops_build_manager.constants import LINUX_CONSUMPTION, LINUX_DEDICATED, WINDOWS, NODE, PYTHON, JAVA, DOTNET
|
||||
from azure_functions_devops_build.constants import LINUX_CONSUMPTION, LINUX_DEDICATED, WINDOWS, NODE, PYTHON, JAVA, DOTNET
|
||||
|
||||
# You need to fill in the variables with names of the resources you already have
|
||||
# When you are finished setting the configs then you can run test.cmd
|
||||
|
@ -11,8 +11,8 @@ from azure_devops_build_manager.constants import LINUX_CONSUMPTION, LINUX_DEDICA
|
|||
CREATE_DEVOPS_OBJECTS = False
|
||||
|
||||
# Specify the name of your already created devops objects
|
||||
ORGANIZATION_NAME = 'dolk-automated-11'
|
||||
PROJECT_NAME = 'auto-python'
|
||||
ORGANIZATION_NAME = 'ollys-hck'
|
||||
PROJECT_NAME = 'cmd-test-2'
|
||||
SERVICE_ENDPOINT_NAME = ORGANIZATION_NAME + PROJECT_NAME
|
||||
REPOSITORY_NAME = PROJECT_NAME
|
||||
BUILD_DEFINITION_NAME = PROJECT_NAME
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
from azure_devops_build_manager.constants import LINUX_CONSUMPTION, LINUX_DEDICATED, WINDOWS, NODE, PYTHON, JAVA, DOTNET
|
||||
from azure_functions_devops_build.constants import LINUX_CONSUMPTION, LINUX_DEDICATED, WINDOWS, NODE, PYTHON, JAVA, DOTNET
|
||||
|
||||
"""This file contains the configs needed for the tests"""
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
import unittest
|
||||
from azure_devops_build_manager.artifact.artifact_manager import ArtifactManager
|
||||
from azure_functions_devops_build.artifact.artifact_manager import ArtifactManager
|
||||
from ._config import ORGANIZATION_NAME, PROJECT_NAME
|
||||
from ._helpers import get_credentials
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
import unittest
|
||||
from azure_devops_build_manager.builder.builder_manager import BuilderManager
|
||||
from azure_functions_devops_build.builder.builder_manager import BuilderManager
|
||||
from ._config import CREATE_DEVOPS_OBJECTS, ORGANIZATION_NAME, PROJECT_NAME, REPOSITORY_NAME, BUILD_DEFINITION_NAME, POOL_NAME
|
||||
from ._helpers import get_credentials
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
import unittest
|
||||
from azure_devops_build_manager.extension.extension_manager import ExtensionManager
|
||||
from azure_functions_devops_build.extension.extension_manager import ExtensionManager
|
||||
from ._config import CREATE_DEVOPS_OBJECTS, ORGANIZATION_NAME, PROJECT_NAME
|
||||
from ._helpers import get_credentials
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
import unittest, string, random
|
||||
from azure_devops_build_manager.organization.organization_manager import OrganizationManager
|
||||
from azure_devops_build_manager.user.user_manager import UserManager
|
||||
from azure_functions_devops_build.organization.organization_manager import OrganizationManager
|
||||
from azure_functions_devops_build.user.user_manager import UserManager
|
||||
from ._config import CREATE_DEVOPS_OBJECTS, ORGANIZATION_NAME
|
||||
from ._helpers import get_credentials
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
import unittest
|
||||
from azure_devops_build_manager.pool.pool_manager import PoolManager
|
||||
from azure_functions_devops_build.pool.pool_manager import PoolManager
|
||||
from ._config import CREATE_DEVOPS_OBJECTS, ORGANIZATION_NAME, PROJECT_NAME
|
||||
from ._helpers import get_credentials
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
import unittest
|
||||
from azure_devops_build_manager.project.project_manager import ProjectManager
|
||||
from azure_functions_devops_build.project.project_manager import ProjectManager
|
||||
from ._config import CREATE_DEVOPS_OBJECTS, ORGANIZATION_NAME, PROJECT_NAME
|
||||
from ._helpers import get_credentials
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
import unittest
|
||||
from azure_devops_build_manager.release.release_manager import ReleaseManager
|
||||
from azure_functions_devops_build.release.release_manager import ReleaseManager
|
||||
from ._config import CREATE_DEVOPS_OBJECTS, ORGANIZATION_NAME, PROJECT_NAME, REPOSITORY_NAME, SERVICE_ENDPOINT_NAME, BUILD_DEFINITION_NAME, RELEASE_DEFINITION_NAME, POOL_NAME, FUNCTIONAPP_TYPE, FUNCTIONAPP_NAME, STORAGE_NAME, RESOURCE_GROUP_NAME
|
||||
from ._helpers import get_credentials
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
import unittest
|
||||
from azure_devops_build_manager.respository.repository_manager import RepositoryManager
|
||||
from azure_functions_devops_build.respository.repository_manager import RepositoryManager
|
||||
from ._config import ORGANIZATION_NAME, PROJECT_NAME, REPOSITORY_NAME, CREATE_DEVOPS_OBJECTS
|
||||
from ._helpers import get_credentials
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
import unittest
|
||||
from azure_devops_build_manager.service_endpoint.service_endpoint_manager import ServiceEndpointManager
|
||||
from azure_functions_devops_build.service_endpoint.service_endpoint_manager import ServiceEndpointManager
|
||||
from ._config import ORGANIZATION_NAME, PROJECT_NAME, SERVICE_ENDPOINT_NAME, CREATE_DEVOPS_OBJECTS
|
||||
from ._helpers import get_credentials
|
||||
|
||||
|
@ -24,7 +24,7 @@ class TestServiceEndpointManager(unittest.TestCase):
|
|||
creds = get_credentials()
|
||||
service_endpoint_manager = ServiceEndpointManager(organization_name=ORGANIZATION_NAME, project_name=PROJECT_NAME, creds=creds)
|
||||
endpoint = service_endpoint_manager.create_service_endpoint(SERVICE_ENDPOINT_NAME)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
|
@ -4,7 +4,7 @@
|
|||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
import unittest
|
||||
from azure_devops_build_manager.yaml.yaml_manager import YamlManager
|
||||
from azure_functions_devops_build.yaml.yaml_manager import YamlManager
|
||||
from ._config import FUNCTIONAPP_LANGUAGE, FUNCTIONAPP_TYPE
|
||||
|
||||
class TestYamlManager(unittest.TestCase):
|
||||
|
|
Загрузка…
Ссылка в новой задаче