Python package for integrating Azure Functions with Azure DevOps. Specifically made for the Azure CLI
Project description
Azure Devops Build Manager For Azure Functions
:construction: The project is currently work in progress. Please do not use in production as we expect developments over time. :construction:
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 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:
- Signed into the az cli. You can do this by using
az login
. - 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.
- Follow the tests/_config_example.py file, create a tests/_config.py with your own testing environment.
- Run the full test suite using
python -m tests.suite
- 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file azure-functions-devops-build-0.0.22.tar.gz
.
File metadata
- Download URL: azure-functions-devops-build-0.0.22.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6341abda6098813f8fa625acd1e925410a17a8a1c7aaabdf975bb7cecb14edf |
|
MD5 | a76c85de8cd66b35d25d382de515feaa |
|
BLAKE2b-256 | d59659ca26c8d9985df8a092cf5974e54b6c3e11208833ea1c0163d7fb763c94 |
File details
Details for the file azure_functions_devops_build-0.0.22-py3-none-any.whl
.
File metadata
- Download URL: azure_functions_devops_build-0.0.22-py3-none-any.whl
- Upload date:
- Size: 47.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | adc4c45de5510acf4c094df84b54bc7767e1466e4bfdce23b99ffccf29de3f2f |
|
MD5 | 2ddbcb35b391ab236c047d38cfed4ef5 |
|
BLAKE2b-256 | 965765ca02568edf21abbb0831dedb3f87b6c2164bd4188778865f27b8a05645 |