Skip to content

Commit 3ffeaec

Browse files
authored
Merge pull request #190 from pfeifferj/feat/pre-commit-hooks
Feat: Add pre commit hooks
2 parents 86f3381 + 24f4819 commit 3ffeaec

File tree

103 files changed

+1268
-1246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1268
-1246
lines changed

.github/ISSUE_TEMPLATE/feature.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ body:
1313
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
1414
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
1515
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
16-

.github/workflows/cleanup-nightly-builds.yaml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030
const retentionDays = parseInt('${{ github.event.inputs.retention_days || 7 }}');
3131
const dryRun = ${{ github.event.inputs.dry_run || false }};
3232
const packageName = 'karpenter-provider-ibm-cloud/controller';
33-
33+
3434
console.log(`Retention period: ${retentionDays} days`);
3535
console.log(`Dry run: ${dryRun}`);
36-
36+
3737
// Get all package versions
3838
let versions = [];
3939
try {
@@ -52,52 +52,52 @@ jobs:
5252
}
5353
throw error;
5454
}
55-
55+
5656
const now = new Date();
5757
const cutoffDate = new Date(now.getTime() - (retentionDays * 24 * 60 * 60 * 1000));
58-
58+
5959
console.log(`Cutoff date: ${cutoffDate.toISOString()}`);
6060
console.log(`Total versions found: ${versions.length}`);
61-
61+
6262
const nightlyVersions = versions.filter(v => {
6363
// Check if this is a nightly build by examining tags
6464
const tags = v.metadata?.container?.tags || [];
65-
return tags.some(tag =>
66-
tag.includes('nightly') ||
65+
return tags.some(tag =>
66+
tag.includes('nightly') ||
6767
tag.match(/v\d+\.\d+\.\d+-\d{4}-\d{2}-\d{2}-[a-f0-9]+-/)
6868
);
6969
});
70-
70+
7171
console.log(`Nightly versions found: ${nightlyVersions.length}`);
72-
72+
7373
const versionsToDelete = nightlyVersions.filter(v => {
7474
const createdAt = new Date(v.created_at);
7575
return createdAt < cutoffDate;
7676
});
77-
77+
7878
console.log(`Versions to delete: ${versionsToDelete.length}`);
79-
79+
8080
if (versionsToDelete.length === 0) {
8181
console.log('No old nightly builds to clean up');
8282
return;
8383
}
84-
84+
8585
// Create summary
8686
let summary = '# Nightly Build Cleanup Summary\n\n';
8787
summary += `- **Retention Period**: ${retentionDays} days\n`;
8888
summary += `- **Cutoff Date**: ${cutoffDate.toISOString()}\n`;
8989
summary += `- **Total Nightly Versions**: ${nightlyVersions.length}\n`;
9090
summary += `- **Versions to Delete**: ${versionsToDelete.length}\n`;
9191
summary += `- **Dry Run**: ${dryRun}\n\n`;
92-
92+
9393
summary += '## Versions to be deleted:\n\n';
9494
summary += '| Version | Created At | Tags |\n';
9595
summary += '|---------|------------|------|\n';
96-
96+
9797
for (const version of versionsToDelete) {
9898
const tags = version.metadata?.container?.tags || [];
9999
summary += `| ${version.name} | ${version.created_at} | ${tags.join(', ')} |\n`;
100-
100+
101101
if (!dryRun) {
102102
try {
103103
// First, try to get the version to confirm it exists
@@ -115,7 +115,7 @@ jobs:
115115
}
116116
throw getError;
117117
}
118-
118+
119119
// Version exists, proceed with deletion
120120
await github.rest.packages.deletePackageVersionForUser({
121121
package_type: 'container',
@@ -133,13 +133,13 @@ jobs:
133133
}
134134
}
135135
}
136-
136+
137137
// Write summary
138138
const fs = require('fs');
139139
fs.writeFileSync(process.env.GITHUB_STEP_SUMMARY, summary);
140-
140+
141141
if (dryRun) {
142142
console.log('Dry run completed - no versions were actually deleted');
143143
} else {
144144
console.log('Cleanup completed');
145-
}
145+
}

.github/workflows/e2e-tests-in-cluster.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,41 +13,41 @@ on:
1313
- cron: '0 2 * * *'
1414
pull_request:
1515
types: [labeled]
16-
16+
1717
jobs:
1818
e2e-tests:
1919
# Use self-hosted runner with 'ibm-e2e' label
2020
runs-on: [self-hosted, ibm-e2e]
2121
if: |
22-
github.event_name == 'workflow_dispatch' ||
22+
github.event_name == 'workflow_dispatch' ||
2323
github.event_name == 'schedule' ||
2424
(github.event_name == 'pull_request' && contains(github.event.label.name, 'run-e2e'))
25-
25+
2626
# Prevent concurrent e2e runs
2727
concurrency:
2828
group: e2e-tests
2929
cancel-in-progress: false
30-
30+
3131
timeout-minutes: 60
32-
32+
3333
container:
3434
# Run in a container with necessary tools
3535
image: golang:1.24.4
3636
options: --user 0
37-
37+
3838
steps:
3939
- name: Checkout
4040
uses: actions/checkout@v4
4141

4242
- name: Install dependencies
4343
run: |
4444
apt-get update && apt-get install -y curl jq
45-
45+
4646
# Install kubectl
4747
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
4848
chmod +x kubectl
4949
mv kubectl /usr/local/bin/
50-
50+
5151
# Install IBM Cloud CLI
5252
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
5353
ibmcloud plugin install vpc-infrastructure
@@ -56,11 +56,11 @@ jobs:
5656
env:
5757
KUBECONFIG_CONTENT: ${{ secrets.KUBECONFIG }}
5858
run: |
59-
# Create kubeconfig from secret
59+
# Create kubeconfig from secret
6060
printf '%s' "$KUBECONFIG_CONTENT" | base64 -d > /tmp/kubeconfig
6161
chmod 600 /tmp/kubeconfig
6262
export KUBECONFIG=/tmp/kubeconfig
63-
63+
6464
# Verify the kubeconfig works
6565
kubectl version --client
6666
@@ -86,8 +86,8 @@ jobs:
8686
run: |
8787
# Install or update Karpenter CRDs
8888
kubectl apply -f charts/crds/
89-
90-
# Restart operator pods to pull latest upstream image tag
89+
90+
# Restart operator pods to pull latest upstream image tag
9191
kubectl rollout restart deployment/karpenter-karpenter-ibm -n karpenter
9292
9393
- name: Run E2E tests
@@ -111,7 +111,7 @@ jobs:
111111
run: |
112112
# The in-cluster config will be automatically detected
113113
go test -v -timeout 45m ./test/e2e/... -run TestE2E
114-
114+
115115
# Run benchmarks if requested
116116
if [[ "$RUN_E2E_BENCHMARKS" == "true" ]]; then
117117
go test -v -timeout 30m ./test/e2e/... -run=^$ -bench=.
@@ -123,7 +123,7 @@ jobs:
123123
KUBECONFIG: /tmp/kubeconfig
124124
run: |
125125
mkdir -p test-artifacts
126-
126+
127127
# Collect logs and events
128128
kubectl logs -n karpenter -l app.kubernetes.io/name=karpenter --tail=1000 > test-artifacts/karpenter-logs.txt || true
129129
kubectl get events -A --sort-by='.lastTimestamp' > test-artifacts/events.txt || true
@@ -150,8 +150,8 @@ jobs:
150150
kubectl delete nodeclaims -l test=e2e --all --timeout=5m || true
151151
kubectl delete nodepools -l test=e2e --all --timeout=5m || true
152152
kubectl delete ibmnodeclasses -l test=e2e --all --timeout=5m || true
153-
153+
154154
# Clean up IBM Cloud instances
155155
ibmcloud is instances --output json | \
156156
jq -r '.[] | select(.tags | index("karpenter-e2e")) | .id' | \
157-
xargs -I {} ibmcloud is instance-delete {} --force || true
157+
xargs -I {} ibmcloud is instance-delete {} --force || true

.github/workflows/helm-test.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,3 @@ jobs:
5151
5252
# Validate template rendering
5353
helm template . -f ci-values.yaml
54-

.github/workflows/nightly-build.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,23 @@ jobs:
5555
# Get the latest tag
5656
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
5757
echo "Latest tag: $LATEST_TAG"
58-
58+
5959
# Get commit info
6060
SHORT_SHA=$(git rev-parse --short HEAD)
6161
COMMIT_DATE=$(git show -s --format=%cs)
62-
62+
6363
# Generate nightly version
6464
# Format: <latest-tag>-<date>-<short-sha>-<suffix>
6565
SUFFIX="${{ github.event.inputs.tag_suffix || 'nightly' }}"
6666
NIGHTLY_VERSION="${LATEST_TAG}-${COMMIT_DATE}-${SHORT_SHA}-${SUFFIX}"
67-
67+
6868
echo "nightly_version=$NIGHTLY_VERSION" >> $GITHUB_OUTPUT
6969
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
7070
echo "commit_date=$COMMIT_DATE" >> $GITHUB_OUTPUT
71-
71+
7272
# Also create a simple 'nightly' tag that always points to latest
7373
echo "latest_tag=nightly" >> $GITHUB_OUTPUT
74-
74+
7575
echo "Generated nightly version: $NIGHTLY_VERSION"
7676
7777
- name: Build and push multi-arch images
@@ -95,35 +95,35 @@ jobs:
9595
# Verify the manifests
9696
echo "Verifying nightly version manifest..."
9797
docker buildx imagetools inspect $KO_DOCKER_REPO:${{ steps.version.outputs.nightly_version }}
98-
98+
9999
echo "Verifying latest nightly manifest..."
100100
docker buildx imagetools inspect $KO_DOCKER_REPO:${{ steps.version.outputs.latest_tag }}
101101
102102
- name: Create build summary
103103
run: |
104104
cat >> $GITHUB_STEP_SUMMARY <<EOF
105105
# Nightly Build Summary
106-
106+
107107
## Version Information
108108
- **Nightly Version**: \`${{ steps.version.outputs.nightly_version }}\`
109109
- **Commit SHA**: \`${{ steps.version.outputs.short_sha }}\`
110110
- **Commit Date**: \`${{ steps.version.outputs.commit_date }}\`
111-
111+
112112
## Images Published
113113
- \`$KO_DOCKER_REPO:${{ steps.version.outputs.nightly_version }}\`
114114
- \`$KO_DOCKER_REPO:nightly\` (latest nightly)
115-
115+
116116
## Platforms
117117
- linux/amd64
118118
- linux/arm64
119-
119+
120120
## Usage
121-
121+
122122
To use the latest nightly build:
123123
\`\`\`bash
124124
podman pull $KO_DOCKER_REPO:nightly
125125
\`\`\`
126-
126+
127127
To use this specific nightly build:
128128
\`\`\`bash
129129
podman pull $KO_DOCKER_REPO:${{ steps.version.outputs.nightly_version }}
@@ -150,17 +150,17 @@ jobs:
150150
script: |
151151
const date = new Date().toISOString().split('T')[0];
152152
const title = `Nightly build failed - ${date}`;
153-
153+
154154
// Check if issue already exists
155155
const issues = await github.rest.issues.listForRepo({
156156
owner: context.repo.owner,
157157
repo: context.repo.repo,
158158
labels: ['nightly-build-failure'],
159159
state: 'open'
160160
});
161-
161+
162162
const existingIssue = issues.data.find(issue => issue.title === title);
163-
163+
164164
if (!existingIssue) {
165165
await github.rest.issues.create({
166166
owner: context.repo.owner,
@@ -169,4 +169,4 @@ jobs:
169169
body: `The nightly build failed on ${date}.\n\nWorkflow run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
170170
labels: ['nightly-build-failure', 'automated']
171171
});
172-
}
172+
}

.github/workflows/pages-deploy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,27 +56,27 @@ jobs:
5656
- name: Package Helm charts
5757
run: |
5858
mkdir -p _helm-repo
59-
59+
6060
# Package the chart from charts/ directory
6161
if [ -f "charts/Chart.yaml" ]; then
6262
echo "Packaging chart: charts/"
6363
helm package charts/ --destination _helm-repo
6464
fi
65-
65+
6666
# Generate index
6767
helm repo index _helm-repo --url https://karpenter-ibm.sh
6868
6969
- name: Combine site content
7070
run: |
7171
# Put docs at root (since we build with root URL)
7272
cp -r site/* .
73-
73+
7474
# Keep charts at root (existing customer configs)
7575
cp -r _helm-repo/* .
76-
76+
7777
# Preserve custom domain configuration
7878
cp docs/CNAME .
79-
79+
8080
# Clean up build directories
8181
rm -rf site _helm-repo
8282

0 commit comments

Comments
 (0)