fixes. added appbeyor script and diagram (wip)
This commit is contained in:
@ -55,25 +55,27 @@ declare_branch() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to recursively process merged branches
|
||||||
|
process_merged_branches() {
|
||||||
|
local branch=$1
|
||||||
|
local merged_branches=$(git branch --merged "$branch" | grep -v "\* $branch" | grep -v "$main_branch")
|
||||||
|
if [ -n "$merged_branches" ]; then
|
||||||
|
for merged_branch in $merged_branches; do
|
||||||
|
declare_branch "$merged_branch"
|
||||||
|
echo " checkout $(escape_for_mermaid "$branch")"
|
||||||
|
echo " merge $(escape_for_mermaid "$merged_branch")"
|
||||||
|
process_merged_branches "$merged_branch"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Process each branch
|
# Process each branch
|
||||||
for branch in $(git for-each-ref --sort=committerdate --format='%(refname:short)' refs/heads/); do
|
for branch in $(git for-each-ref --sort=committerdate --format='%(refname:short)' refs/heads/); do
|
||||||
base_branch=$(find_base_branch "$branch")
|
base_branch=$(find_base_branch "$branch")
|
||||||
|
|
||||||
declare_branch "$branch"
|
declare_branch "$branch"
|
||||||
echo " checkout $(escape_for_mermaid "$branch")"
|
echo " checkout $(escape_for_mermaid "$branch")"
|
||||||
echo " commit id: \"$(git log -1 --pretty=format:%s "$branch")\""
|
echo " commit id: \"$(git log -1 --pretty=format:%s "$branch")\""
|
||||||
|
process_merged_branches "$branch"
|
||||||
# Check which branches are merged into this branch
|
|
||||||
merged_branches=$(git branch --merged "$branch" | grep -v "\* $branch" | grep -v "$main_branch")
|
|
||||||
if [ -n "$merged_branches" ]; then
|
|
||||||
for merged_branch in $merged_branches; do
|
|
||||||
if [ "$merged_branch" != "$branch" ]; then
|
|
||||||
declare_branch "$merged_branch"
|
|
||||||
echo " checkout $(escape_for_mermaid "$branch")"
|
|
||||||
echo " merge $(escape_for_mermaid "$merged_branch")"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check for branches not yet merged into master
|
# Check for branches not yet merged into master
|
||||||
@ -81,10 +83,10 @@ not_merged=$(git branch --no-merged "$main_branch")
|
|||||||
if [ -n "$not_merged" ]; then
|
if [ -n "$not_merged" ]; then
|
||||||
echo " commit id: \"Branches not yet merged into master:\""
|
echo " commit id: \"Branches not yet merged into master:\""
|
||||||
for branch in $not_merged; do
|
for branch in $not_merged; do
|
||||||
echo " commit id: \"$branch\""
|
echo " commit id: \"$branch\" - merged into: $(git branch --merged "$branch" | grep -v "\* $branch" | grep -v "$main_branch" | tr '\n' ' ')"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
} > $output_file
|
} > $output_file
|
||||||
|
|
||||||
echo "Mermaid diagram saved to $output_file"
|
echo "Mermaid diagram saved to $output_file"
|
35
python/appveyor.mmd
Normal file
35
python/appveyor.mmd
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
graph TD
|
||||||
|
A[Common Configuration] --> B[master]
|
||||||
|
A[Common Configuration] --> C[stable]
|
||||||
|
A[Common Configuration] --> D[deployment]
|
||||||
|
A[Common Configuration] --> E[GAT-5073]
|
||||||
|
A[Common Configuration] --> F[GAT-5098]
|
||||||
|
|
||||||
|
B --> B1[Release_ProfessionalTestServer]
|
||||||
|
B --> B2[Release_TestServer]
|
||||||
|
B --> B3[Release_DemoServer]
|
||||||
|
B1 --> G[TESTPRO on master]
|
||||||
|
B2 --> H[TEST on master]
|
||||||
|
B3 --> I[DEMO on master]
|
||||||
|
|
||||||
|
C --> C1[Release_DemoServer]
|
||||||
|
C --> C2[Release_ProfessionalTestServer]
|
||||||
|
C1 --> J[DEMO on stable]
|
||||||
|
C2 --> K[TESTPRO on stable]
|
||||||
|
|
||||||
|
D --> D1[Release_ProductionServer]
|
||||||
|
D --> D2[Release_ProfessionalServer]
|
||||||
|
D1 --> L[PROD Staging on deployment]
|
||||||
|
D2 --> M[PRO on deployment]
|
||||||
|
|
||||||
|
E --> E1[Staging_TestServer]
|
||||||
|
E1 --> N[TEST-Staging on GAT-5073]
|
||||||
|
|
||||||
|
F --> F1[Staging_DemoServer]
|
||||||
|
F1 --> O[DEMO-Staging on GAT-5098]
|
||||||
|
|
||||||
|
style A fill:#f9f,stroke:#333,stroke-width:2px
|
||||||
|
|
||||||
|
style C1 fill:#bbf,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5
|
||||||
|
style C2 fill:#bbf,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5
|
||||||
|
|
85
python/deployments_graph.py
Normal file
85
python/deployments_graph.py
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import yaml
|
||||||
|
|
||||||
|
# Load the YAML content from the file
|
||||||
|
with open('appveyor.yml', 'r') as file:
|
||||||
|
appveyor_yml = file.read()
|
||||||
|
|
||||||
|
# Parsing the YAML content
|
||||||
|
config = yaml.safe_load(appveyor_yml)
|
||||||
|
|
||||||
|
# Extract branches and configurations from the YAML
|
||||||
|
branches = {}
|
||||||
|
deployments = {}
|
||||||
|
inactive_branches = []
|
||||||
|
|
||||||
|
# Extract specific branch configurations
|
||||||
|
if 'for' in config:
|
||||||
|
for branch_config in config['for']:
|
||||||
|
branch_names = branch_config.get('branches', {}).get('only', [])
|
||||||
|
configurations = branch_config.get('configuration', [])
|
||||||
|
for branch in branch_names:
|
||||||
|
if branch not in branches:
|
||||||
|
branches[branch] = []
|
||||||
|
branches[branch].extend(configurations)
|
||||||
|
|
||||||
|
# Manually add common branches and configurations if not already included
|
||||||
|
if 'branches' in config:
|
||||||
|
common_branches = config['branches'].get('only', [])
|
||||||
|
for branch in common_branches:
|
||||||
|
if branch not in branches:
|
||||||
|
branches[branch] = config.get('configuration', [])
|
||||||
|
|
||||||
|
# Check for inactive branches in the comments
|
||||||
|
lines = appveyor_yml.splitlines()
|
||||||
|
for i, line in enumerate(lines):
|
||||||
|
if line.strip().startswith('#') and i + 2 < len(lines) and 'branches:' in lines[i + 1] and 'only:' in lines[i + 2]:
|
||||||
|
inactive_branches.append(lines[i + 2].split(':')[1].strip())
|
||||||
|
|
||||||
|
# Extract deployment configurations
|
||||||
|
if 'deploy' in config:
|
||||||
|
deployments['common'] = config['deploy']
|
||||||
|
|
||||||
|
if 'for' in config:
|
||||||
|
for branch_config in config['for']:
|
||||||
|
branch_names = branch_config.get('branches', {}).get('only', [])
|
||||||
|
if 'deploy' in branch_config:
|
||||||
|
for branch in branch_names:
|
||||||
|
if branch not in deployments:
|
||||||
|
deployments[branch] = []
|
||||||
|
deployments[branch].extend(branch_config['deploy'])
|
||||||
|
|
||||||
|
# Generate the Mermaid graph content
|
||||||
|
mermaid_graph = """
|
||||||
|
graph TD
|
||||||
|
A[Common Configuration] --> B[master]
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Add branches to the graph
|
||||||
|
for branch in branches.keys():
|
||||||
|
if branch != 'master':
|
||||||
|
mermaid_graph += f" A --> {branch.replace('-', '_')}\n"
|
||||||
|
|
||||||
|
# Add configurations to the branches
|
||||||
|
for branch, configs in branches.items():
|
||||||
|
for config in configs:
|
||||||
|
mermaid_graph += f" {branch.replace('-', '_')} --> {branch.replace('-', '_')}{config}\n"
|
||||||
|
|
||||||
|
# Add deployments to the configurations
|
||||||
|
for branch, deploys in deployments.items():
|
||||||
|
for deploy in deploys:
|
||||||
|
configuration = deploy.get('configuration')
|
||||||
|
website = deploy.get('website')
|
||||||
|
if configuration and website:
|
||||||
|
mermaid_graph += f" {branch.replace('-', '_')}{configuration.replace('_', '')} --> {branch.replace('-', '_')}{website.replace('-', '_')}\n"
|
||||||
|
|
||||||
|
# Highlight inactive branches
|
||||||
|
for inactive_branch in inactive_branches:
|
||||||
|
mermaid_graph += f" style {inactive_branch.replace('-', '_')} fill:#f96,stroke:#333,stroke-width:2px,stroke-dasharray: 5, 5\n"
|
||||||
|
|
||||||
|
# Add styles to the graph
|
||||||
|
mermaid_graph += """
|
||||||
|
style A fill:#f9f,stroke:#333,stroke-width:2px
|
||||||
|
style B fill:#bbf,stroke:#333,stroke-width:2px
|
||||||
|
"""
|
||||||
|
|
||||||
|
print(mermaid_graph)
|
Reference in New Issue
Block a user