-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-github-repo.sh
More file actions
executable file
·195 lines (175 loc) · 4.61 KB
/
Copy pathinit-github-repo.sh
File metadata and controls
executable file
·195 lines (175 loc) · 4.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/bin/bash
# Script to initialize GitHub repository
set -e
echo "=== Initializing GitHub Repository for Prometheus to SAR Converter ==="
echo ""
# Check if git is installed
if ! command -v git &> /dev/null; then
echo "Error: git is not installed"
exit 1
fi
# Check if we're already in a git repository
if [ -d ".git" ]; then
echo "Warning: This directory is already a git repository"
read -p "Do you want to continue? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
else
# Initialize git repository
echo "1. Initializing git repository..."
git init
echo "✓ Git repository initialized"
echo ""
fi
# Create .gitignore if it doesn't exist
if [ ! -f ".gitignore" ]; then
echo "2. Creating .gitignore..."
cat > .gitignore <<EOF
# Binaries
bin/
dist/
*.exe
*.exe~
*.dll
*.so
*.dylib
prom2sar
prom2sar-*
prometheus-dump-operator
# Test artifacts
*.test
*.out
coverage.out
coverage.html
# Build artifacts
*.o
*.a
# Go workspace
go.work
go.work.sum
# IDE
.idea/
.vscode/
*.swp
*.swo
*~
# OS
.DS_Store
Thumbs.db
# Temporary files
tmp/
temp/
*.tmp
# SAR output (for testing)
sar-output/
*.sar
# Kubernetes
kubeconfig
# Local testing
testdata/prometheus/
must-gather.local.*/
# Environment
.env
.env.local
EOF
echo "✓ .gitignore created"
echo ""
else
echo "2. .gitignore already exists, skipping..."
echo ""
fi
# Copy GITHUB_README.md to README.md
echo "3. Setting up README.md..."
if [ -f "GITHUB_README.md" ]; then
cp GITHUB_README.md README_GITHUB.md
echo "✓ Copied GITHUB_README.md to README_GITHUB.md"
echo " (You can replace README.md with this for GitHub)"
else
echo "⚠ GITHUB_README.md not found, skipping..."
fi
echo ""
# Stage all files
echo "4. Staging files..."
git add .
echo "✓ Files staged"
echo ""
# Create initial commit
echo "5. Creating initial commit..."
if git diff --cached --quiet; then
echo "⚠ No changes to commit"
else
git commit -m "Initial commit: Prometheus to SAR Converter
- Standalone CLI binary (prom2sar)
- Kubernetes Operator for automated conversions
- Complete SAR format output (CPU, memory, disk, network)
- Comprehensive documentation (10+ guides)
- Build and deployment tooling
- Examples and test cases
- GitHub workflows for CI/CD
- Contributing guide and issue templates"
echo "✓ Initial commit created"
fi
echo ""
# Instructions for GitHub
echo "=== Next Steps ==="
echo ""
echo "6. Create a GitHub repository:"
echo " - Go to https://github.com/new"
echo " - Repository name: prometheus-dump-operator"
echo " - Description: Convert Prometheus TSDB to SAR format - Enable kernel engineers to analyze Prometheus metrics using familiar Unix tools"
echo " - Public or Private: Your choice"
echo " - Do NOT initialize with README, .gitignore, or license (we have them)"
echo ""
echo "7. Add GitHub remote and push:"
echo ""
echo " git remote add origin https://github.com/YOUR-USERNAME/prometheus-dump-operator.git"
echo " git branch -M main"
echo " git push -u origin main"
echo ""
echo "8. Configure GitHub repository settings:"
echo " - Add topics: prometheus, sar, monitoring, kubernetes, golang, sysadmin"
echo " - Add description from step 6"
echo " - Enable Issues"
echo " - Enable Discussions (optional but recommended)"
echo " - Enable Wiki (optional)"
echo ""
echo "9. Create first release:"
echo " - Build binaries: ./build.sh"
echo " - Create tag: git tag -a v1.0.0 -m 'First release'"
echo " - Push tag: git push origin v1.0.0"
echo " - GitHub Actions will create release automatically"
echo ""
echo "10. Optional: Set up branch protection"
echo " - Go to Settings > Branches"
echo " - Add rule for 'main' branch"
echo " - Require pull request reviews"
echo " - Require status checks to pass"
echo ""
echo "=== Repository Contents ==="
echo ""
echo "Source Code:"
echo " - cmd/prom2sar/ CLI binary"
echo " - cmd/main.go Operator"
echo " - pkg/tsdb/ TSDB reader"
echo " - pkg/sar/ SAR conversion"
echo ""
echo "Documentation:"
echo " - README.md Main overview"
echo " - GITHUB_README.md GitHub-specific README"
echo " - CLI_GUIDE.md CLI documentation"
echo " - GETTING_STARTED.md Quick start guide"
echo " - CONTRIBUTING.md Contribution guide"
echo " + 6 more guides"
echo ""
echo "GitHub Configuration:"
echo " - .github/workflows/ CI/CD pipelines"
echo " - .github/ISSUE_TEMPLATE/ Issue templates"
echo " - LICENSE Apache 2.0"
echo " - CHANGELOG.md Version history"
echo ""
echo "=== All Set! ==="
echo ""
echo "Your repository is ready to push to GitHub!"
echo ""