A python library for setting up and managing Azure DevOps builds for Azure Functions projects
Перейти к файлу
Hanzhang Zeng (Roger) 83b7eab507 Added: special requirements for _config.py to run the full suite 2019-03-26 15:06:27 -07:00
azure_functions_devops_build Creating test suite 2019-03-26 15:06:27 -07:00
sample_yaml_builds updating the sample yaml for dotnet to reflect the fixes 2019-01-30 15:54:29 -08:00
tests Added: special requirements for _config.py to run the full suite 2019-03-26 15:06:27 -07:00
.gitignore Remove and untrack tests/_config.py 2019-03-26 15:06:27 -07:00
.pylintrc Fixed: the credential in unit test 2019-03-26 15:06:27 -07:00
LICENSE adding support for github 2019-01-14 14:12:25 -08:00
MANIFEST.in excluding tests from pypi package as it includes extra dependencies 2019-02-05 16:13:19 -08:00
README.md Update README.md 2019-01-28 16:40:43 -08:00
__init__.py adding project 2018-12-21 17:07:41 -08:00
end_to_end_test.cmd End to end tests with better configuration 2019-01-15 11:24:40 -08:00
pylintrc Tests and related fixes 2019-01-04 11:05:29 -08:00
requirements.txt fix requirements.txt to actually reflect smaller dependency list 2019-01-18 16:55:20 -08:00
setup.py updating the dependencies + bug fix for release 2019-02-13 11:17:29 -08:00

README.md

Azure Devops Build Manager For Azure Functions

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.

Install

To install the package from pip:

pip install azure-functions-devops-build

Get started

To use the API, you need to first establish a connection to azure by loging into your azure account using az login. You can then follow the example as below. Firstly we get the token from login and use this to authenticate the different python function calls.

from azure.cli.core import get_default_cli
from azure.cli.core._profile import Profile
from azure_functions_devops_build.organization.organization_manager import OrganizationManager
import pprint

# Get your token from the az login cache
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
organization_manager = OrganizationManager(creds=creds)

# Get the list of organizations for your user
organizations = organization_manager.list_organizations()

# Show details about each organization in the console
for organization in organizations.value:
    pprint.pprint(organization.__dict__)

API documentation

This Python library extensively uses the Azure DevOps REST APIs and Azure Devops Python API. See the Azure DevOps REST API reference for details on calling different APIs and [Azure DevOps Python SDK] (https://github.com/Microsoft/azure-devops-python-api) for details on the azure-devops-python-api.

Samples

See samples by looking at tests or viewing the az-cli functionapp devops-build module.

Testing

Several things need to be setup before you can run the tests:

  1. Signed into the az cli. You can do this by using az login.
  2. Since this directly deploys to azure functions, create an azure functions functionapp using the azure portal. You need to make a functionapp for these tests to successfully run and make sure you record the details of the subscription name, project name, application type and storage name.
  3. Create a _config.py file with all the needed details in the tests folder. You can follow the tests/_config_example.py file in the tests folder to see what information you need.
  4. Run the tests using end to end tests using end_to_end_test.cmd
  5. To run specific manager tests run python -m tests.{NAME_OF_MANAGER} eg. python -m tests.test_builder_manager

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.