docs: update GitHub workflow to v4.0 with three-node verification
- Added gitea-runner node to all verification steps - Added Section 8: Push to GitHub (Milestone Only) as final step - Updated Quick Commands to include gitea-runner sync - Updated Milestone Push Workflow with 3-node verification - Updated Troubleshooting section to handle gitea-runner sync issues
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
description: Git operations workflow with Gitea for daily usage and GitHub for milestone pushes
|
description: Git operations workflow with Gitea for daily usage and GitHub for milestone pushes
|
||||||
title: AITBC Git Operations Workflow (Gitea + GitHub)
|
title: AITBC Git Operations Workflow (Gitea + GitHub)
|
||||||
version: 3.0
|
version: 4.0
|
||||||
auto_execution_mode: 3
|
auto_execution_mode: 3
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ This workflow handles git operations for the AITBC project with a dual-remote st
|
|||||||
- **Gitea**: Used for daily git operations (commits, pushes, pulls, CI/CD)
|
- **Gitea**: Used for daily git operations (commits, pushes, pulls, CI/CD)
|
||||||
- **GitHub**: Used only for milestone pushes (public releases, major milestones)
|
- **GitHub**: Used only for milestone pushes (public releases, major milestones)
|
||||||
|
|
||||||
This ensures both genesis and follower nodes maintain consistent git status after git operations.
|
This ensures genesis, follower, and gitea-runner nodes maintain consistent git status after git operations.
|
||||||
|
|
||||||
## Git Remote Strategy
|
## Git Remote Strategy
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ git push --all origin
|
|||||||
|
|
||||||
### 5. Multi-Node Git Status Check
|
### 5. Multi-Node Git Status Check
|
||||||
```bash
|
```bash
|
||||||
# Check git status on both nodes
|
# Check git status on all three nodes
|
||||||
echo "=== Genesis Node Git Status ==="
|
echo "=== Genesis Node Git Status ==="
|
||||||
cd /opt/aitbc
|
cd /opt/aitbc
|
||||||
git status
|
git status
|
||||||
@@ -132,25 +132,33 @@ echo "=== Follower Node Git Status ==="
|
|||||||
ssh aitbc1 'cd /opt/aitbc && git status'
|
ssh aitbc1 'cd /opt/aitbc && git status'
|
||||||
ssh aitbc1 'cd /opt/aitbc && git log --oneline -3'
|
ssh aitbc1 'cd /opt/aitbc && git log --oneline -3'
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Gitea-Runner Node Git Status ==="
|
||||||
|
ssh gitea-runner 'cd /opt/aitbc && git status'
|
||||||
|
ssh gitea-runner 'cd /opt/aitbc && git log --oneline -3'
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "=== Comparison Check ==="
|
echo "=== Comparison Check ==="
|
||||||
# Get latest commit hashes
|
# Get latest commit hashes
|
||||||
GENESIS_HASH=$(git rev-parse HEAD)
|
GENESIS_HASH=$(git rev-parse HEAD)
|
||||||
FOLLOWER_HASH=$(ssh aitbc1 'cd /opt/aitbc && git rev-parse HEAD')
|
FOLLOWER_HASH=$(ssh aitbc1 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
|
RUNNER_HASH=$(ssh gitea-runner 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
|
|
||||||
echo "Genesis latest: $GENESIS_HASH"
|
echo "Genesis latest: $GENESIS_HASH"
|
||||||
echo "Follower latest: $FOLLOWER_HASH"
|
echo "Follower latest: $FOLLOWER_HASH"
|
||||||
|
echo "Gitea-Runner latest: $RUNNER_HASH"
|
||||||
|
|
||||||
if [ "$GENESIS_HASH" = "$FOLLOWER_HASH" ]; then
|
if [ "$GENESIS_HASH" = "$FOLLOWER_HASH" ] && [ "$GENESIS_HASH" = "$RUNNER_HASH" ]; then
|
||||||
echo "✅ Both nodes are in sync"
|
echo "✅ All three nodes are in sync"
|
||||||
else
|
else
|
||||||
echo "⚠️ Nodes are out of sync"
|
echo "⚠️ Nodes are out of sync"
|
||||||
echo "Genesis ahead by: $(git rev-list --count $FOLLOWER_HASH..HEAD 2>/dev/null || echo "N/A") commits"
|
echo "Genesis ahead by: $(git rev-list --count $FOLLOWER_HASH..HEAD 2>/dev/null || echo "N/A") commits"
|
||||||
echo "Follower ahead by: $(ssh aitbc1 'cd /opt/aitbc && git rev-list --count $GENESIS_HASH..HEAD 2>/dev/null || echo "N/A"') commits"
|
echo "Follower ahead by: $(ssh aitbc1 'cd /opt/aitbc && git rev-list --count $GENESIS_HASH..HEAD 2>/dev/null || echo "N/A"') commits"
|
||||||
|
echo "Runner ahead by: $(ssh gitea-runner 'cd /opt/aitbc && git rev-list --count $GENESIS_HASH..HEAD 2>/dev/null || echo "N/A"') commits"
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6. Sync Follower Node (if needed)
|
### 6. Sync Follower and Gitea-Runner Nodes (if needed)
|
||||||
```bash
|
```bash
|
||||||
# Sync follower node with genesis
|
# Sync follower node with genesis
|
||||||
if [ "$GENESIS_HASH" != "$FOLLOWER_HASH" ]; then
|
if [ "$GENESIS_HASH" != "$FOLLOWER_HASH" ]; then
|
||||||
@@ -166,6 +174,21 @@ if [ "$GENESIS_HASH" != "$FOLLOWER_HASH" ]; then
|
|||||||
|
|
||||||
echo "✅ Follower node synced"
|
echo "✅ Follower node synced"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Sync gitea-runner node with genesis
|
||||||
|
if [ "$GENESIS_HASH" != "$RUNNER_HASH" ]; then
|
||||||
|
echo "=== Syncing Gitea-Runner Node ==="
|
||||||
|
|
||||||
|
# Option 1: Push from genesis to gitea-runner
|
||||||
|
ssh gitea-runner 'cd /opt/aitbc && git fetch origin'
|
||||||
|
ssh gitea-runner 'cd /opt/aitbc && git pull origin main'
|
||||||
|
|
||||||
|
# Option 2: Copy changes directly (if remote sync fails)
|
||||||
|
rsync -av --exclude='.git' /opt/aitbc/ gitea-runner:/opt/aitbc/
|
||||||
|
ssh gitea-runner 'cd /opt/aitbc && git add . && git commit -m "sync from genesis node" || true'
|
||||||
|
|
||||||
|
echo "✅ Gitea-Runner node synced"
|
||||||
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
### 7. Verify Push
|
### 7. Verify Push
|
||||||
@@ -179,23 +202,48 @@ git log --oneline -5 origin/main
|
|||||||
# Verify on Gitea (web interface)
|
# Verify on Gitea (web interface)
|
||||||
# Open: https://gitea.bubuit.net/oib/aitbc
|
# Open: https://gitea.bubuit.net/oib/aitbc
|
||||||
|
|
||||||
# Verify both nodes are updated
|
# Verify all three nodes are updated
|
||||||
echo "=== Final Status Check ==="
|
echo "=== Final Status Check ==="
|
||||||
echo "Genesis: $(git rev-parse --short HEAD)"
|
echo "Genesis: $(git rev-parse --short HEAD)"
|
||||||
echo "Follower: $(ssh aitbc1 'cd /opt/aitbc && git rev-parse --short HEAD')"
|
echo "Follower: $(ssh aitbc1 'cd /opt/aitbc && git rev-parse --short HEAD')"
|
||||||
|
echo "Gitea-Runner: $(ssh gitea-runner 'cd /opt/aitbc && git rev-parse --short HEAD')"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 8. Push to GitHub (Milestone Only)
|
||||||
|
```bash
|
||||||
|
# Only push to GitHub for milestones (releases, major features)
|
||||||
|
# Verify all three nodes are in sync before GitHub push
|
||||||
|
GENESIS_HASH=$(git rev-parse HEAD)
|
||||||
|
FOLLOWER_HASH=$(ssh aitbc1 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
|
RUNNER_HASH=$(ssh gitea-runner 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
|
|
||||||
|
if [ "$GENESIS_HASH" = "$FOLLOWER_HASH" ] && [ "$GENESIS_HASH" = "$RUNNER_HASH" ]; then
|
||||||
|
echo "✅ All nodes in sync, proceeding with GitHub push"
|
||||||
|
|
||||||
|
# Push to GitHub (milestone only)
|
||||||
|
git push github main
|
||||||
|
|
||||||
|
echo "✅ GitHub push complete"
|
||||||
|
echo "Verify on GitHub: https://github.com/oib/AITBC"
|
||||||
|
else
|
||||||
|
echo "❌ Nodes out of sync, aborting GitHub push"
|
||||||
|
echo "Sync all nodes first before pushing to GitHub"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
## Quick Git Commands
|
## Quick Git Commands
|
||||||
|
|
||||||
### Multi-Node Standard Workflow (Gitea)
|
### Multi-Node Standard Workflow (Gitea)
|
||||||
```bash
|
```bash
|
||||||
# Complete multi-node workflow - check, stage, commit, push to Gitea, sync
|
# Complete multi-node workflow - check, stage, commit, push to Gitea, sync all nodes
|
||||||
cd /opt/aitbc
|
cd /opt/aitbc
|
||||||
|
|
||||||
# 1. Check both nodes status
|
# 1. Check all three nodes status
|
||||||
echo "=== Checking Both Nodes ==="
|
echo "=== Checking All Nodes ==="
|
||||||
git status
|
git status
|
||||||
ssh aitbc1 'cd /opt/aitbc && git status'
|
ssh aitbc1 'cd /opt/aitbc && git status'
|
||||||
|
ssh gitea-runner 'cd /opt/aitbc && git status'
|
||||||
|
|
||||||
# 2. Stage and commit
|
# 2. Stage and commit
|
||||||
git add .
|
git add .
|
||||||
@@ -207,10 +255,14 @@ git push origin main
|
|||||||
# 4. Sync follower node
|
# 4. Sync follower node
|
||||||
ssh aitbc1 'cd /opt/aitbc && git pull origin main'
|
ssh aitbc1 'cd /opt/aitbc && git pull origin main'
|
||||||
|
|
||||||
# 5. Verify both nodes
|
# 5. Sync gitea-runner node
|
||||||
|
ssh gitea-runner 'cd /opt/aitbc && git pull origin main'
|
||||||
|
|
||||||
|
# 6. Verify all three nodes
|
||||||
echo "=== Verification ==="
|
echo "=== Verification ==="
|
||||||
git rev-parse --short HEAD
|
git rev-parse --short HEAD
|
||||||
ssh aitbc1 'cd /opt/aitbc && git rev-parse --short HEAD'
|
ssh aitbc1 'cd /opt/aitbc && git rev-parse --short HEAD'
|
||||||
|
ssh gitea-runner 'cd /opt/aitbc && git rev-parse --short HEAD'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Quick Multi-Node Push (Gitea)
|
### Quick Multi-Node Push (Gitea)
|
||||||
@@ -219,6 +271,7 @@ ssh aitbc1 'cd /opt/aitbc && git rev-parse --short HEAD'
|
|||||||
cd /opt/aitbc
|
cd /opt/aitbc
|
||||||
git add . && git commit -m "docs: update documentation" && git push origin main
|
git add . && git commit -m "docs: update documentation" && git push origin main
|
||||||
ssh aitbc1 'cd /opt/aitbc && git pull origin main'
|
ssh aitbc1 'cd /opt/aitbc && git pull origin main'
|
||||||
|
ssh gitea-runner 'cd /opt/aitbc && git pull origin main'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Multi-Node Sync Check
|
### Multi-Node Sync Check
|
||||||
@@ -227,8 +280,9 @@ ssh aitbc1 'cd /opt/aitbc && git pull origin main'
|
|||||||
cd /opt/aitbc
|
cd /opt/aitbc
|
||||||
GENESIS_HASH=$(git rev-parse HEAD)
|
GENESIS_HASH=$(git rev-parse HEAD)
|
||||||
FOLLOWER_HASH=$(ssh aitbc1 'cd /opt/aitbc && git rev-parse HEAD')
|
FOLLOWER_HASH=$(ssh aitbc1 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
if [ "$GENESIS_HASH" = "$FOLLOWER_HASH" ]; then
|
RUNNER_HASH=$(ssh gitea-runner 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
echo "✅ Both nodes in sync"
|
if [ "$GENESIS_HASH" = "$FOLLOWER_HASH" ] && [ "$GENESIS_HASH" = "$RUNNER_HASH" ]; then
|
||||||
|
echo "✅ All three nodes in sync"
|
||||||
else
|
else
|
||||||
echo "⚠️ Nodes out of sync - sync needed"
|
echo "⚠️ Nodes out of sync - sync needed"
|
||||||
fi
|
fi
|
||||||
@@ -272,11 +326,12 @@ cd /opt/aitbc
|
|||||||
git status
|
git status
|
||||||
git pull origin main
|
git pull origin main
|
||||||
|
|
||||||
# 2. Verify commit hash matches between nodes
|
# 2. Verify commit hash matches between all three nodes
|
||||||
GENESIS_HASH=$(git rev-parse HEAD)
|
GENESIS_HASH=$(git rev-parse HEAD)
|
||||||
FOLLOWER_HASH=$(ssh aitbc1 'cd /opt/aitbc && git rev-parse HEAD')
|
FOLLOWER_HASH=$(ssh aitbc1 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
if [ "$GENESIS_HASH" = "$FOLLOWER_HASH" ]; then
|
RUNNER_HASH=$(ssh gitea-runner 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
echo "✅ Nodes in sync, proceeding with GitHub push"
|
if [ "$GENESIS_HASH" = "$FOLLOWER_HASH" ] && [ "$GENESIS_HASH" = "$RUNNER_HASH" ]; then
|
||||||
|
echo "✅ All nodes in sync, proceeding with GitHub push"
|
||||||
else
|
else
|
||||||
echo "❌ Nodes out of sync, aborting GitHub push"
|
echo "❌ Nodes out of sync, aborting GitHub push"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -409,8 +464,9 @@ git push origin main
|
|||||||
cd /opt/aitbc
|
cd /opt/aitbc
|
||||||
GENESIS_HASH=$(git rev-parse HEAD)
|
GENESIS_HASH=$(git rev-parse HEAD)
|
||||||
FOLLOWER_HASH=$(ssh aitbc1 'cd /opt/aitbc && git rev-parse HEAD')
|
FOLLOWER_HASH=$(ssh aitbc1 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
|
RUNNER_HASH=$(ssh gitea-runner 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
|
|
||||||
if [ "$GENESIS_HASH" != "$FOLLOWER_HASH" ]; then
|
if [ "$GENESIS_HASH" != "$FOLLOWER_HASH" ] || [ "$GENESIS_HASH" != "$RUNNER_HASH" ]; then
|
||||||
echo "⚠️ Nodes out of sync - fixing..."
|
echo "⚠️ Nodes out of sync - fixing..."
|
||||||
|
|
||||||
# Check connectivity to follower
|
# Check connectivity to follower
|
||||||
@@ -419,14 +475,29 @@ if [ "$GENESIS_HASH" != "$FOLLOWER_HASH" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check connectivity to gitea-runner
|
||||||
|
ssh gitea-runner 'echo "Gitea-Runner node reachable"' || {
|
||||||
|
echo "❌ Cannot reach gitea-runner node"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Sync follower node
|
# Sync follower node
|
||||||
ssh aitbc1 'cd /opt/aitbc && git fetch origin'
|
if [ "$GENESIS_HASH" != "$FOLLOWER_HASH" ]; then
|
||||||
ssh aitbc1 'cd /opt/aitbc && git pull origin main'
|
ssh aitbc1 'cd /opt/aitbc && git fetch origin'
|
||||||
|
ssh aitbc1 'cd /opt/aitbc && git pull origin main'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sync gitea-runner node
|
||||||
|
if [ "$GENESIS_HASH" != "$RUNNER_HASH" ]; then
|
||||||
|
ssh gitea-runner 'cd /opt/aitbc && git fetch origin'
|
||||||
|
ssh gitea-runner 'cd /opt/aitbc && git pull origin main'
|
||||||
|
fi
|
||||||
|
|
||||||
# Verify sync
|
# Verify sync
|
||||||
NEW_FOLLOWER_HASH=$(ssh aitbc1 'cd /opt/aitbc && git rev-parse HEAD')
|
NEW_FOLLOWER_HASH=$(ssh aitbc1 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
if [ "$GENESIS_HASH" = "$NEW_FOLLOWER_HASH" ]; then
|
NEW_RUNNER_HASH=$(ssh gitea-runner 'cd /opt/aitbc && git rev-parse HEAD')
|
||||||
echo "✅ Nodes synced successfully"
|
if [ "$GENESIS_HASH" = "$NEW_FOLLOWER_HASH" ] && [ "$GENESIS_HASH" = "$NEW_RUNNER_HASH" ]; then
|
||||||
|
echo "✅ All nodes synced successfully"
|
||||||
else
|
else
|
||||||
echo "❌ Sync failed - manual intervention required"
|
echo "❌ Sync failed - manual intervention required"
|
||||||
fi
|
fi
|
||||||
@@ -537,6 +608,35 @@ xdg-open https://github.com/oib/AITBC/commit/$(git rev-parse HEAD)
|
|||||||
- Push to GitHub only for milestones (releases, major features)
|
- Push to GitHub only for milestones (releases, major features)
|
||||||
- Tag releases appropriately on GitHub
|
- Tag releases appropriately on GitHub
|
||||||
|
|
||||||
|
## Recent Updates (v4.0)
|
||||||
|
|
||||||
|
### Three-Node Verification
|
||||||
|
- **Gitea-Runner Added**: Extended multi-node verification to include gitea-runner node
|
||||||
|
- **All-Node Sync Check**: Updated all verification steps to check genesis, aitbc1, and gitea-runner nodes
|
||||||
|
- **GitHub Push Verification**: Added three-node sync verification before GitHub milestone pushes
|
||||||
|
- **Sync Operations**: Updated sync procedures to include gitea-runner node
|
||||||
|
|
||||||
|
### Updated Workflow Sections
|
||||||
|
- **Multi-Node Git Status Check**: Now checks all three nodes (genesis, aitbc1, gitea-runner)
|
||||||
|
- **Sync Follower and Gitea-Runner Nodes**: Added gitea-runner sync to section 6
|
||||||
|
- **Verify Push**: Updated to verify all three nodes are updated
|
||||||
|
- **Push to GitHub (Milestone Only)**: New section 8 for GitHub push with three-node verification
|
||||||
|
|
||||||
|
### Updated Quick Commands
|
||||||
|
- **Multi-Node Standard Workflow**: Updated to include gitea-runner status check and sync
|
||||||
|
- **Quick Multi-Node Push**: Added gitea-runner sync to quick push command
|
||||||
|
- **Multi-Node Sync Check**: Updated to check all three nodes for sync status
|
||||||
|
|
||||||
|
### Updated Milestone Workflow
|
||||||
|
- **Three-Node Verification**: GitHub milestone push now verifies all three nodes are in sync
|
||||||
|
- **Sync Check**: Added gitea-runner hash comparison before GitHub push
|
||||||
|
- **Error Handling**: Aborts GitHub push if any node is out of sync
|
||||||
|
|
||||||
|
### Updated Troubleshooting
|
||||||
|
- **Multi-Node Sync Issues**: Updated to handle gitea-runner sync issues
|
||||||
|
- **Connectivity Checks**: Added gitea-runner connectivity verification
|
||||||
|
- **Sync Validation**: Updated to verify all three nodes after sync operations
|
||||||
|
|
||||||
## Recent Updates (v3.0)
|
## Recent Updates (v3.0)
|
||||||
|
|
||||||
### Dual-Remote Strategy
|
### Dual-Remote Strategy
|
||||||
|
|||||||
Reference in New Issue
Block a user