Skip to content
Draft
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
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Azure AD Configuration
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret
AZURE_TENANT_ID=your-tenant-id

# Azure DevOps Configuration
AZDO_ORGANIZATION=your-organization
AZDO_PROJECT=your-project
AZDO_WIKI_ID=your-wiki-id
AZDO_PAT=your-personal-access-token

# Flask Configuration
SECRET_KEY=your-random-secret-key
FLASK_DEBUG=False
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
__pycache__/
*.py[cod]
.env
.venv/
venv/
flask_session/
*.log
.DS_Store
316 changes: 315 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,315 @@
# release-scheduler
# Release Tracker

A web application for tracking and scheduling software releases with Azure AD authentication and Azure DevOps Wiki integration.

## Features

- πŸ” **Azure AD Authentication** - Secure login using Microsoft Authentication Library (MSAL)
- πŸ“… **Interactive Calendar** - Select release dates with Flatpickr calendar interface
- 🏷️ **Release Types** - Categorize releases as Hotfix, Stable, or Prerelease
- πŸ“ **Wiki Integration** - Automatically update Azure DevOps Wiki pages with release information
- πŸ’… **Modern UI** - Beautiful gradient design with responsive layout

## Prerequisites

Before you begin, ensure you have the following:

- **Python 3.9+** installed on your machine
- **Azure Subscription** with access to create Azure AD app registrations
- **Azure DevOps Account** with permissions to:
- Create and edit Wiki pages
- Generate Personal Access Tokens (PAT)
- **Git** for version control

## Azure AD App Registration

Follow these steps to register your application in Azure AD:

1. **Navigate to Azure Portal**
- Go to [Azure Portal](https://portal.azure.com)
- Search for "Azure Active Directory" and select it

2. **Register New Application**
- In the left sidebar, click **App registrations**
- Click **+ New registration**
- Enter the following details:
- **Name:** Release Tracker
- **Supported account types:** Accounts in this organizational directory only (Single tenant)
- **Redirect URI:**
- Platform: Web
- URI: `http://localhost:5000/getAToken` (for local development)
- Click **Register**

3. **Copy Application Details**
- On the Overview page, copy the following values:
- **Application (client) ID** - This is your `AZURE_CLIENT_ID`
- **Directory (tenant) ID** - This is your `AZURE_TENANT_ID`

4. **Create Client Secret**
- In the left sidebar, click **Certificates & secrets**
- Click **+ New client secret**
- Add a description (e.g., "Release Tracker Secret")
- Select an expiration period (e.g., 24 months)
- Click **Add**
- **Important:** Copy the secret **Value** immediately - This is your `AZURE_CLIENT_SECRET`
- You won't be able to see it again!

5. **Configure API Permissions** (Optional but recommended)
- In the left sidebar, click **API permissions**
- Verify that **Microsoft Graph > User.Read** is present (added by default)
- Click **Grant admin consent** if you have admin rights

## Azure DevOps Personal Access Token (PAT)

Create a PAT to allow the application to update Wiki pages:

1. **Navigate to Azure DevOps**
- Go to [Azure DevOps](https://dev.azure.com)
- Select your organization

2. **Create Personal Access Token**
- Click on **User Settings** (gear icon in top-right)
- Select **Personal access tokens**
- Click **+ New Token**
- Configure the token:
- **Name:** Release Tracker PAT
- **Organization:** Select your organization
- **Expiration:** Set an appropriate expiration date
- **Scopes:** Select **Custom defined**
- Under **Code**, select **Read & Write** for Wiki
- Click **Create**
- **Important:** Copy the token immediately - This is your `AZDO_PAT`

3. **Get Azure DevOps Details**
- **Organization:** Your organization name from the URL (e.g., `https://dev.azure.com/YOUR_ORG`)
- **Project:** Your project name
- **Wiki ID:**
- Navigate to your project Wiki
- The Wiki ID is typically the same as your project name, or you can find it in the Wiki settings

## Local Development Setup

1. **Clone the Repository**
```bash
git clone https://github.com/wh-alice/release-scheduler.git
cd release-scheduler
```

2. **Create Virtual Environment**
```bash
python -m venv venv

# On Windows
venv\Scripts\activate

# On macOS/Linux
source venv/bin/activate
```

3. **Install Dependencies**
```bash
pip install -r requirements.txt
```

4. **Configure Environment Variables**
- Copy `.env.example` to `.env`:
```bash
cp .env.example .env
```
- Edit `.env` and fill in your values:
```
AZURE_CLIENT_ID=<your-client-id>
AZURE_CLIENT_SECRET=<your-client-secret>
AZURE_TENANT_ID=<your-tenant-id>

AZDO_ORGANIZATION=<your-organization>
AZDO_PROJECT=<your-project>
AZDO_WIKI_ID=<your-wiki-id>
AZDO_PAT=<your-personal-access-token>

SECRET_KEY=<generate-random-secret-key>
FLASK_DEBUG=True # Set to False in production
```
- Generate a random secret key:
```bash
python -c "import uuid; print(uuid.uuid4())"
```

5. **Run the Application**
```bash
python app.py
```
- The application will be available at `http://localhost:5000`
- You'll be redirected to Azure AD login
- After authentication, you can start tracking releases!

## Azure App Service Deployment

Deploy your application to Azure App Service using Azure CLI:

1. **Install Azure CLI**
- Download from [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli)
- Or use Cloud Shell in Azure Portal

2. **Login to Azure**
```bash
az login
```

3. **Create Resource Group** (if not exists)
```bash
az group create --name release-tracker-rg --location eastus
```

4. **Create App Service Plan**
```bash
az appservice plan create \
--name release-tracker-plan \
--resource-group release-tracker-rg \
--sku B1 \
--is-linux
```

5. **Create Web App**
```bash
az webapp create \
--resource-group release-tracker-rg \
--plan release-tracker-plan \
--name release-tracker-app \
--runtime "PYTHON:3.9"
```

6. **Configure Application Settings**
```bash
az webapp config appsettings set \
--resource-group release-tracker-rg \
--name release-tracker-app \
--settings \
AZURE_CLIENT_ID="<your-client-id>" \
AZURE_CLIENT_SECRET="<your-client-secret>" \
AZURE_TENANT_ID="<your-tenant-id>" \
AZDO_ORGANIZATION="<your-organization>" \
AZDO_PROJECT="<your-project>" \
AZDO_WIKI_ID="<your-wiki-id>" \
AZDO_PAT="<your-pat>" \
SECRET_KEY="<your-secret-key>" \
SCM_DO_BUILD_DURING_DEPLOYMENT=true
```

7. **Configure Startup Command**
```bash
az webapp config set \
--resource-group release-tracker-rg \
--name release-tracker-app \
--startup-file "gunicorn --bind=0.0.0.0 --timeout 600 app:app"
```

8. **Update Azure AD Redirect URI**
- Go to Azure Portal > Azure Active Directory > App registrations
- Select your "Release Tracker" app
- Go to **Authentication**
- Add a new Redirect URI:
- `https://release-tracker-app.azurewebsites.net/getAToken`
- Click **Save**

9. **Deploy Application**
```bash
# From your local repository
az webapp up \
--resource-group release-tracker-rg \
--name release-tracker-app \
--runtime "PYTHON:3.9"
```

10. **Access Your Application**
- URL: `https://release-tracker-app.azurewebsites.net`
- The app should now be live and accessible!

## Environment Variables Reference

| Variable | Description | Example |
|----------|-------------|---------|
| `AZURE_CLIENT_ID` | Azure AD Application (client) ID | `12345678-1234-1234-1234-123456789012` |
| `AZURE_CLIENT_SECRET` | Azure AD Client Secret | `AbC123~dEf456-GhI789` |
| `AZURE_TENANT_ID` | Azure AD Directory (tenant) ID | `87654321-4321-4321-4321-210987654321` |
| `AZDO_ORGANIZATION` | Azure DevOps organization name | `mycompany` |
| `AZDO_PROJECT` | Azure DevOps project name | `MyProject` |
| `AZDO_WIKI_ID` | Azure DevOps Wiki identifier | `MyProject.wiki` |
| `AZDO_PAT` | Azure DevOps Personal Access Token | `abcdefghijklmnopqrstuvwxyz123456` |
| `SECRET_KEY` | Flask session secret key | `550e8400-e29b-41d4-a716-446655440000` |
| `FLASK_DEBUG` | Enable Flask debug mode (use True for local dev only) | `False` |

## Usage

1. **Login**
- Navigate to the application URL
- Click login or you'll be automatically redirected to Azure AD
- Sign in with your organizational account

2. **Schedule a Release**
- Select a release date from the calendar (left panel)
- Choose one or more release types:
- πŸ”₯ **Hotfix** - Critical bug fixes for production
- βœ… **Stable** - Fully tested production release
- πŸ§ͺ **Prerelease** - Beta or release candidate
- Enter or confirm the Wiki page path (default: `/Releases`)
- Click **Save Release**

3. **View Releases**
- Navigate to your Azure DevOps Wiki
- Open the specified page (e.g., `/Releases`)
- Your release information will be appended with:
- Formatted date
- Release types with icons
- User who scheduled the release

## Project Structure

```
release-scheduler/
β”œβ”€β”€ app.py # Flask application with MSAL auth and Azure DevOps integration
β”œβ”€β”€ requirements.txt # Python dependencies
β”œβ”€β”€ .env.example # Environment variables template
β”œβ”€β”€ .gitignore # Git ignore rules
β”œβ”€β”€ README.md # This file
β”œβ”€β”€ templates/
β”‚ └── index.html # Main application template
└── static/
β”œβ”€β”€ css/
β”‚ └── style.css # Application styles
└── js/
└── app.js # Frontend JavaScript
```

## Troubleshooting

### Authentication Issues
- Verify your `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, and `AZURE_TENANT_ID` are correct
- Ensure the Redirect URI in Azure AD matches your application URL
- Check that the client secret hasn't expired

### Wiki Update Failures
- Verify your `AZDO_PAT` has Wiki Read & Write permissions
- Ensure the Wiki ID and project name are correct
- Check that the wiki page path format is valid (starts with `/`)

### Application Errors
- Check application logs: `az webapp log tail --resource-group release-tracker-rg --name release-tracker-app`
- Verify all environment variables are set correctly
- Ensure the App Service plan has sufficient resources

## Security Considerations

- Never commit `.env` file or secrets to version control
- Regularly rotate your Azure AD client secrets and Azure DevOps PATs
- Use Azure Key Vault for production deployments to store secrets
- Implement proper access controls in Azure AD
- Monitor and audit application access logs

## License

This project is licensed under the MIT License.

## Support

For issues, questions, or contributions, please create an issue in the GitHub repository.
Loading