Skip to content

Commit

Permalink
Adding Azure Pipelines CI Documentation (#3081)
Browse files Browse the repository at this point in the history
* Adding Azure Pipelines CI Documentation

##### SUMMARY
Adding Azure Pipelines documentation, tested within my own organisation.


##### ISSUE TYPE
- Docs Pull Request

+label: docsite_pr

* Trying to get the code block to show

* Inline code markdown fixed, textual improvement.

* Fixed whitespaces

Co-authored-by: Jim Speir <[email protected]>
  • Loading branch information
ssbarnea and jimbo8098 authored Mar 23, 2021
1 parent d7b10d2 commit 60b6814
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions docs/ci.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,45 @@ Here is another example using Docker, virtualenv and tags on Centos 7.
script:
- molecule test
Azure Pipelines
^^^^^^^^^^^^^^^
`Azure Pipelines`_ projects rely on the ``azure-pipelines.yml`` file within the root folder of a repository. There are a number of pre-requisites for running CI/CD within Azure on self-hosted runners if you intend on using the ``UsePythonVersion`` task. Details of this can be found in the `Use Python Version Task`_ documentation.

.. code-block:: yaml
---
trigger:
- master
pool:
vmImage: ubuntu-16.04
steps:
- checkout: git://project-name/role-name
path: role-name
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
- script: python -m pip install "molecule[lint]" "python-vagrant" "molecule-vagrant" "ansible"
displayName: Install dependencies
- script: python -m pip install "python-tss-sdk"
displayName: Role-specific dependencies
- script: |
export PATH="$PATH:/home/<user>/.local/bin/"
cd $(Agent.BuildDirectory)/role-name
molecule test
displayName: Test relevant platforms
Whilst the pipeline checks out your code initially as part of the pipeline task, by default, it checks it out into a directory named ``s`` within ``$(Agent.BuildDirectory)``. If you checkout one other repository, the ``s`` is substituted with the path provided in that checkout. If you checkout multiple roles (e.g. some private roles within your Azure organisation) then the ``s`` structure is used, hence the importance of the ``cd $(Agent.BuildDirectory)/role-name`` which ensures you are in the correct directory regardless of format. Check the `Azure Build Variables`_ documentation for more detailed information on these.

The ``export PATH`` is required to ensure you can use the ``molecule``/``ansible`` shell scripts. Azure doesn't add these by default.


Jenkins Pipeline
^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -356,5 +395,8 @@ conflict.
.. _`Jenkins`: https://jenkins.io/doc/book/pipeline/jenkinsfile
.. _`Gitlab`: https://gitlab.com
.. _`Tox`: https://tox.readthedocs.io/en/latest
.. _`Azure Pipelines`: https://azure.microsoft.com/en-gb/services/devops/pipelines/
.. _`--parallel functionality`: https://tox.readthedocs.io/en/latest/config.html#cmdoption-tox-p
.. _`issue1567_comment`: https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722
.. _`Use Python Version Task`: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/use-python-version?view=azure-devops
.. _`Azure Build Variables`: https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services

0 comments on commit 60b6814

Please sign in to comment.