Skip to content

Commit be24724

Browse files
committed
update workflow
1 parent a391cbc commit be24724

File tree

4 files changed

+177
-14
lines changed

4 files changed

+177
-14
lines changed

.github/workflows/README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# GitHub Actions Workflows
2+
3+
This directory contains GitHub Actions workflows for the DevOps The Hard Way - Azure tutorial.
4+
5+
## 📋 Workflow Files
6+
7+
### 🔧 `main.yml` - Tutorial Example Workflow
8+
**Purpose**: Educational content demonstrating CI/CD pipeline setup
9+
**Status**: ⚠️ **DISABLED** - Tutorial content only
10+
11+
This workflow is provided as an example for learning purposes and is **not intended to run** in this tutorial repository.
12+
13+
**Features:**
14+
- Terraform deployment automation
15+
- Azure OIDC authentication
16+
- Static code analysis hooks (commented)
17+
- Terraform documentation generation hooks (commented)
18+
19+
**To Use This Workflow:**
20+
1. Fork or copy this repository to your own GitHub account
21+
2. Set up Azure OIDC authentication (see tutorial)
22+
3. Enable the workflow by modifying the `on:` triggers
23+
4. Customize the configuration for your environment
24+
25+
### 🚀 `deploy-full.yml` - Complete Deployment Pipeline
26+
**Purpose**: Full infrastructure and application deployment
27+
**Status**: ✅ **ACTIVE** - Manual trigger only
28+
29+
This workflow provides complete deployment automation including:
30+
- Infrastructure provisioning (ACR, VNET, Log Analytics, AKS)
31+
- Docker image building and pushing
32+
- Kubernetes application deployment
33+
- ALB Controller and Gateway setup
34+
- Optional resource cleanup
35+
36+
**Triggers:**
37+
- Manual execution only (`workflow_dispatch`)
38+
- Environment selection (dev/staging/prod)
39+
- Optional cleanup after deployment
40+
41+
## 🎓 Educational Notes
42+
43+
### Why Two Workflows?
44+
45+
1. **`main.yml`**: Demonstrates traditional CI/CD patterns
46+
- Shows basic Terraform automation
47+
- Includes hooks for advanced features
48+
- Focuses on single component (AKS)
49+
- Educational and reference material
50+
51+
2. **`deploy-full.yml`**: Complete solution approach
52+
- Deploys entire infrastructure stack
53+
- Production-ready patterns
54+
- Multi-environment support
55+
- Practical automation tool
56+
57+
### Security Considerations
58+
59+
Both workflows use:
60+
- ✅ Azure OIDC authentication (no stored secrets)
61+
- ✅ Least privilege access patterns
62+
- ✅ Environment-specific configurations
63+
- ✅ Manual approval workflows for production
64+
65+
### Best Practices Demonstrated
66+
67+
- **Infrastructure as Code**: All resources defined in Terraform
68+
- **GitOps**: Infrastructure changes through Git workflows
69+
- **Immutable Infrastructure**: Complete rebuilds vs. updates
70+
- **Environment Isolation**: Separate state files and configurations
71+
- **Automated Testing**: Built-in validation and testing steps
72+
73+
## 🔧 Setup Instructions
74+
75+
### For Tutorial Learning:
76+
1. Study the workflow files as examples
77+
2. Understand the patterns and practices
78+
3. Follow the tutorial documentation
79+
80+
### For Practical Use:
81+
1. Copy/fork this repository
82+
2. Set up Azure service principal or OIDC
83+
3. Configure GitHub secrets
84+
4. Customize for your environment
85+
5. Enable and run workflows
86+
87+
## 📚 Related Documentation
88+
89+
- [CI/CD Tutorial](../2-Terraform-AZURE-Services-Creation/5-Run-CICD-For-AKS-Cluster.md)
90+
- [Deployment Scripts](../scripts/README.md)
91+
- [Azure OIDC Setup](../2-Terraform-AZURE-Services-Creation/scripts/5-create-github-oidc.sh)
92+
93+
## 🤝 Contributing
94+
95+
These workflows are part of the tutorial content. If you find improvements or issues:
96+
- Open an issue for discussion
97+
- Submit a pull request with improvements
98+
- Update related documentation

.github/workflows/main.yml

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,50 @@
1-
name: Terrform-Deploy
1+
# TUTORIAL WORKFLOW - NOT ACTIVE
2+
# This workflow is part of the DevOps The Hard Way tutorial content
3+
# It is disabled to prevent accidental runs in the tutorial repository
4+
# Copy this to their own repositories and modify as needed
25

6+
name: Terraform-Deploy (Tutorial Example)
7+
8+
# This workflow only runs manually and is intended as tutorial content
39
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
branches:
9-
- main
1010
workflow_dispatch:
11+
inputs:
12+
tutorial_mode:
13+
description: 'This is a tutorial workflow - copy to your own repo to use'
14+
required: true
15+
default: 'tutorial-only'
16+
type: choice
17+
options:
18+
- tutorial-only
1119

1220
jobs:
21+
tutorial-info:
22+
name: ⚠️ Tutorial Workflow Information
23+
runs-on: ubuntu-latest
24+
if: ${{ github.event.inputs.tutorial_mode == 'tutorial-only' }}
25+
26+
steps:
27+
- name: Tutorial Information
28+
run: |
29+
echo "🎓 This is a TUTORIAL workflow from DevOps The Hard Way - Azure"
30+
echo ""
31+
echo "📋 This workflow is provided as example content for learning purposes."
32+
echo "📋 It is not intended to run in the tutorial repository."
33+
echo ""
34+
echo "✅ To use this workflow:"
35+
echo "1. Copy this repository to your own GitHub account"
36+
echo "2. Set up Azure OIDC authentication secrets"
37+
echo "3. Modify the workflow for your specific needs"
38+
echo "4. Update the terraform.tfvars and backend configuration"
39+
echo ""
40+
echo "📚 For full instructions, see the tutorial documentation."
41+
echo ""
42+
echo "❌ This workflow will not deploy any resources in tutorial mode."
43+
1344
terraform:
14-
name: Terrform-Deploy
45+
name: Terraform-Deploy
1546
runs-on: ubuntu-latest
47+
if: ${{ github.event.inputs.tutorial_mode != 'tutorial-only' }}
1648
permissions:
1749
contents: write
1850
id-token: write # Required for OIDC

2-Terraform-AZURE-Services-Creation/5-Run-CICD-For-AKS-Cluster.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,50 @@ In this lab, you'll learn how to create an Azure Kubernetes Service (AKS) cluste
6767
Note: All three values will be automatically displayed in the output of the `5-create-github-oidc.sh` script, so you can copy them directly from there.
6868
6969
4. **Set Up GitHub Actions Workflow**
70-
- Navigate to the Actions tab in your GitHub repository.
71-
- Select the existing `CI` workflow.
72-
- Choose to run the workflow from the main branch.
70+
71+
⚠️ **Important**: The workflow file `.github/workflows/main.yml` in this repository is **tutorial content only** and is disabled to prevent accidental runs.
72+
73+
**To use this workflow in your own project:**
74+
75+
a) **Copy the Repository**:
76+
- Fork this repository to your own GitHub account, or
77+
- Copy the workflow file to your own repository
78+
79+
b) **Enable the Workflow**:
80+
- Open `.github/workflows/main.yml` in your repository
81+
- Remove the `tutorial_mode` input and the tutorial job
82+
- Change the `on:` section to:
83+
```yaml
84+
on:
85+
push:
86+
branches:
87+
- main
88+
pull_request:
89+
branches:
90+
- main
91+
workflow_dispatch:
92+
```
93+
94+
c) **Customize for Your Environment**:
95+
- Update the `terraform.tfvars` values in the workflow
96+
- Update resource group names and storage account names
97+
- Modify the backend configuration to match your setup
98+
99+
d) **Run the Workflow**:
100+
- Navigate to the Actions tab in your GitHub repository
101+
- Select the `Terraform-Deploy` workflow
102+
- Choose to run the workflow manually or trigger via push/PR
73103
74104
## 🔍 Verification
75-
After running the workflow:
76-
1. Check the GitHub Actions logs for successful completion.
105+
**Note**: Since the workflow in this tutorial repository is disabled, these verification steps apply when you run the workflow in your own repository:
106+
107+
1. Check the GitHub Actions logs in your repository for successful completion.
77108
2. Log into the [Azure Portal](https://portal.azure.com)
78109
3. Navigate to Kubernetes services
79110
4. Verify that your new AKS cluster has been updated or created.
80111
81112
### 🧠 Knowledge Check
82-
The GitHub Actions workflow:
113+
The GitHub Actions workflow (when enabled in your own repository):
83114
- [ ] Triggers manually (`workflow_dispatch`) or on pull requests/pushes to main
84115
- [ ] Checks out the code
85116
- [ ] Authenticates with Azure using OIDC (no secrets stored in GitHub)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ Before you start, ensure you have the following [prerequisites](https://github.c
8383

8484
5. **CICD** - Automatically update AKS cluster with CICD using GitHub Actions
8585
- [ ] [Create a GitHub Actions CICD pipeline](https://github.com/thomast1906/DevOps-The-Hard-Way-Azure/blob/main/2-Terraform-AZURE-Services-Creation/5-Run-CICD-For-AKS-Cluster.md)
86+
87+
⚠️ **Note**: The GitHub Actions workflows in this repository are **tutorial content only** and are disabled to prevent accidental runs. To use them, copy this repository to your own account and follow the instructions in the tutorial.
8688

8789
6. **Terraform Documentation** - Automate Terraform documentation generation
8890
- [ ] [Set Up Terraform-docs with GitHub Actions](https://github.com/thomast1906/DevOps-The-Hard-Way-Azure/blob/main/6-Terraform-Docs/1-Setup-Terraform-Docs.md)

0 commit comments

Comments
 (0)