Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# devops-driver

![status sheild](https://img.shields.io/static/v1?label=status&message=beta&color=blue&style=plastic)
[![status sheild](https://img.shields.io/static/v1?label=released&message=v0.1.48&color=active&style=plastic)](https://pypi.org/project/devopsdriver/0.1.48/)
[![GitHub](https://img.shields.io/github/license/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver?tab=Unlicense-1-ov-file#readme)
Expand All @@ -21,13 +23,11 @@
[![Azure](https://img.shields.io/static/v1?label=&message=Supports%20Microsoft%20Azure&color=blue&style=plastic&logo=microsoftazure)](https://azure.microsoft.com/)
[![Gmail](https://img.shields.io/static/v1?label=&message=Supports%20Google%20Gmail&color=white&style=plastic&logo=gmail)](https://gmail.com/)

OS:
OS:
[![Windows](https://img.shields.io/static/v1?label=&message=Windows&color=blue&style=plastic&logo=windows)](https://microsoft.com/)
[![macOS](https://img.shields.io/static/v1?label=&message=macOS&color=white&logoColor=black&style=plastic&logo=apple)](https://apple.com/)
[![Linux](https://img.shields.io/static/v1?label=&message=Linux&color=seashell&logoColor=black&style=plastic&logo=linux)](https://linux.org/)

# devops-driver

Devops-driver is a collection of tools to help streamline developer's experience and gain insights into various processes.

## Tools
Expand All @@ -46,6 +46,7 @@ To allow seamless work in both pipelines as well as in the development environme
Say you want a pipeline that looks for User Stories that are newer than 3 days and send out an email.

### \<platform dependent path\>/devopsdriver.yml

```yaml
smtp:
sender: JohnDoe@company.com
Expand All @@ -55,7 +56,7 @@ secrets:
smtp.password: smtp/password
```

This file is in a global place (location varies by OS) and stores information that you may not want in your repository or is specific to development.
This file is in a global place (location varies by OS) and stores information that you may not want in your repository or is specific to development.

| Platform | Global Directory |
|----------|------------------------|
Expand All @@ -66,6 +67,7 @@ This file is in a global place (location varies by OS) and stores information th
The `secrets` are extra sensative and are stored in the OS keychain.

### Set secrets in the keychain

```bash
$ python3 -m venv .venv
$ source .venv/bin/activate
Expand All @@ -77,16 +79,21 @@ secret: azure.token key: azure/token
smtp.password (azure/token): ****
$ settings --secrets
secret: azure.token key: azure/token
Value set
Value set
secret: smtp.password key: smtp/password
Value set
Value set
$
```

The first call to `settings` will look for every secret and check if they are already set in the keychain.
For any secret that has not been set in the keychain, you will be prompted to enter the password to store.
The second call to `settings` will verify that all the values have been set in the keychain.

**Note**: If your `secrets`, `cli`, or `env` are in a yaml file named after your script,
you can call `settings --secrets --script my_script.py`.

### devopsdriver.yml

```yaml
azure:
url: https://dev.azure.com/MyCompany
Expand All @@ -112,15 +119,18 @@ The `cli` and `env` map command line switches and environment variables to those
This allows for many options for setting values depending on your needs.

### new_stories.yml

```yaml
scrum masters:
- JohnDoe@company.com
- JaneDoe@company.com
```

This file is specific to your script and not shared.
These are values that you want to use in your script but have them here for easy adjustment.

### new_stories.html.mako

```html
<h1>Stories created in the last ${days} days</h1>
<ul>
Expand All @@ -133,6 +143,7 @@ These are values that you want to use in your script but have them here for easy
This file is the template for the email body.

### new_stories.py

```python
from datetime import date, timedelta

Expand Down Expand Up @@ -168,9 +179,9 @@ send_email(

### The email sent

**From**: JohnDoe@company.com
**From**: `JohnDoe@company.com`

**To**: JohnDoe@company.com, JaneDoe@company.com
**To**: `JohnDoe@company.com`, `JaneDoe@company.com`

**Subject**: Stories created in the last 3 days

Expand All @@ -185,4 +196,3 @@ send_email(
- 754 frontend - store to schema
- 755 Transfer job to production. Setup migrations to move to production
- 756 Query subscription status from App

2 changes: 1 addition & 1 deletion devopsdriver/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" DevOps tools """
"""DevOps tools"""

from .settings import Settings
from .sendmail import send_email
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" initialize azure module """
"""initialize azure module"""

# re export symbols for easier use
from .azureobject import AzureObject
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/azureobject.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3


""" An Azure Devops WorkItem """
"""An Azure Devops WorkItem"""


from msrest.serialization import Model
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/builds/build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

""" Azure Build """
"""Azure Build"""

from azure.devops.v7_1.build.models import Build as AzureBuild
from azure.devops.v7_1.build import BuildClient
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/builds/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3


""" Azure Build Client """
"""Azure Build Client"""


from datetime import datetime
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/clients.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3


""" Establish a connection to Azure Devops
"""Establish a connection to Azure Devops

API Documented here:
https://github.com/microsoft/azure-devops-python-api
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/pipeline/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3


""" Pipeline client """
"""Pipeline client"""


from azure.devops.v7_1.pipelines import PipelinesClient
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/pipeline/log.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3


""" Azure Pipeline Run Log """
"""Azure Pipeline Run Log"""


from azure.devops.v7_1.pipelines.models import Log as AzureLog
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/pipeline/pipeline.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3


""" Azure Pipeline """
"""Azure Pipeline"""


from azure.devops.v7_1.pipelines.models import Pipeline as AzurePipeline
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/pipeline/run.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3


""" Pipeline Run """
"""Pipeline Run"""


from azure.devops.v7_1.pipelines.models import Pipeline
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/timestamp.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3


""" Tools that help when working with Azure """
"""Tools that help when working with Azure"""


from datetime import datetime, timezone, timedelta
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/workitem/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""" init workitem module """
"""init workitem module"""
2 changes: 1 addition & 1 deletion devopsdriver/azdo/workitem/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3


""" Azure WorkItem Client """
"""Azure WorkItem Client"""


from azure.devops.v7_1.work_item_tracking.models import Wiql as AzureWiql
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/azdo/workitem/wiql.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3


""" Builds a WIQL query
"""Builds a WIQL query
https://learn.microsoft.com/en-us/azure/devops/boards/queries/wiql-syntax?view=azure-devops

SELECT
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/dataobject.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

""" Data Objects """
"""Data Objects"""


from json import dumps
Expand Down
13 changes: 10 additions & 3 deletions devopsdriver/manage_settings.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python3


""" Module Doc """
"""Module Doc"""


from os.path import dirname, join
from os.path import dirname, join, abspath
from sys import argv as sys_argv
from getpass import getpass as os_getpass

Expand All @@ -31,7 +31,14 @@ def main() -> None:
)
return

settings = Settings(__file__, dirname(dirname(__file__))).key("secrets")
position = args.index("--script") if "--script" in args else len(args)
script = __file__

if position + 1 < len(args):
args.pop(position)
script = abspath(args.pop(position))

settings = Settings(script, dirname(dirname(__file__))).key("secrets")

if "--secrets" in args:
args.remove("--secrets")
Expand Down
2 changes: 1 addition & 1 deletion devopsdriver/sendmail.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3


""" Ability to send emails with embedded images """
"""Ability to send emails with embedded images"""


from smtplib import SMTP as OS_SMTP, SMTP_SSL as OS_SMTP_SSL
Expand Down
Loading