Skip to content

Commit 0d7746c

Browse files
committed
ci: clean up workflows and supporting commands
Signed-off-by: Jacob Howard <[email protected]>
1 parent 170843f commit 0d7746c

File tree

10 files changed

+82
-470
lines changed

10 files changed

+82
-470
lines changed

.github/workflows/security-review-changes.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ jobs:
183183
--jq '.id'
184184
}
185185
186+
# Helper to create a slug suitable for check names.
187+
slugify() {
188+
echo "$1" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g' | sed -E 's/^-+|-+$//g'
189+
}
190+
186191
# Create checks for updated pins (differential reviews).
187192
if [ "${{ steps.updatedpins.outputs.has_targets }}" = "true" ]; then
188193
while read -r target; do
@@ -191,7 +196,8 @@ jobs:
191196
old_commit=$(echo "$target" | jq -r '.old_commit')
192197
new_commit=$(echo "$target" | jq -r '.new_commit')
193198
194-
check_name="security-review/$agent/pin/$server"
199+
server_slug=$(slugify "$server")
200+
check_name="security-review/$agent/pin/$server_slug"
195201
check_id=$(create_pending_check "$check_name" "$server" "differential")
196202
197203
echo "$check_name|$check_id|$server|$project|$new_commit|$old_commit|differential" >> review-output/check-ids.txt
@@ -205,7 +211,8 @@ jobs:
205211
project=$(echo "$target" | jq -r '.project')
206212
commit=$(echo "$target" | jq -r '.commit')
207213
208-
check_name="security-review/$agent/new/$server"
214+
server_slug=$(slugify "$server")
215+
check_name="security-review/$agent/new/$server_slug"
209216
check_id=$(create_pending_check "$check_name" "$server" "full")
210217
211218
echo "$check_name|$check_id|$server|$project|$commit||full" >> review-output/check-ids.txt
@@ -356,6 +363,7 @@ jobs:
356363
if [ "$review_type" = "differential" ]; then
357364
if [ -z "$base_commit" ] || [ "$base_commit" = "null" ]; then
358365
echo "Skipping $server: missing base commit for differential review." >&2
366+
skip_check "$check_id" "$server" "missing base commit"
359367
return
360368
fi
361369
cmd+=(--base "$base_commit")
@@ -426,7 +434,7 @@ jobs:
426434
"$project" \
427435
"$head_commit" \
428436
"$base_commit" \
429-
"$review_type"
437+
"$review_type" || true
430438
done < review-output/check-ids.txt
431439
432440
- name: Upload security reports

.github/workflows/security-review-manual.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
REVIEW_MODEL_INPUT: ${{ github.event.inputs.model }}
7575
REVIEW_TIMEOUT_INPUT: ${{ github.event.inputs.timeout_secs }}
7676
run: |
77-
set -euo pipefail
77+
set -uo pipefail
7878
agent="${REVIEW_AGENT_INPUT:-}"
7979
if [ -z "$agent" ]; then
8080
agent="claude"
@@ -115,7 +115,9 @@ jobs:
115115
cmd+=(--model "$model")
116116
fi
117117
118-
"${cmd[@]}"
118+
if ! "${cmd[@]}"; then
119+
echo "Security review failed for $server" >&2
120+
fi
119121
done < <(jq -c '.[]' "${{ steps.collect.outputs.targets }}")
120122
121123
- name: Upload security reports

.github/workflows/update-pins.yaml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ name: Update MCP Server Version Pins
33
on:
44
# schedule:
55
# - cron: "0 5 * * *"
6-
schedule:
7-
- cron: "0 0 1 * *"
86
workflow_dispatch:
97
inputs:
108
max_new_prs:
@@ -132,20 +130,22 @@ jobs:
132130
git fetch origin main
133131
git reset --hard origin/main
134132
135-
# If a prior PR exists for this server, fetch it and bail out when
136-
# the requested commit is identical (no update required).
133+
# Check if we've hit the new PR limit before doing any work.
134+
branch_exists=false
137135
if git ls-remote --exit-code --heads origin "$branch" >/dev/null 2>&1; then
136+
branch_exists=true
138137
git fetch origin "$branch"
139138
existing_commit=$(git show "origin/${branch}:servers/${server}/server.yaml" 2>/dev/null | awk '/commit:/{print $2}' | tail -n1)
140139
if [ -n "$existing_commit" ] && [ "$existing_commit" = "$new_commit" ]; then
141140
echo "Existing PR for $server already pins ${existing_commit}; skipping."
142141
continue
143142
fi
144-
else
145-
if [ -n "$new_pr_limit" ] && [ "$new_pr_count" -ge "$new_pr_limit" ]; then
146-
echo "New PR quota reached ($new_pr_limit); skipping $server."
147-
continue
148-
fi
143+
fi
144+
145+
# Check PR limit for new branches only.
146+
if [ "$branch_exists" = false ] && [ -n "$new_pr_limit" ] && [ "$new_pr_count" -ge "$new_pr_limit" ]; then
147+
echo "New PR quota reached ($new_pr_limit); skipping $server."
148+
continue
149149
fi
150150
151151
# Apply the patch onto a fresh branch for this server.
@@ -163,20 +163,28 @@ jobs:
163163
# Commit the server YAML change and force-push the automation branch.
164164
git add "servers/${server}/server.yaml"
165165
git commit -m "chore: update pin for ${server}"
166-
git push --force origin "$branch"
166+
if ! git push --force origin "$branch"; then
167+
echo "Failed to push branch for $server, skipping." >&2
168+
continue
169+
fi
167170
168171
# Create or update the PR dedicated to this server.
169172
if gh pr view --head "$branch" >/dev/null 2>&1; then
170-
gh pr edit "$branch" \
173+
if ! gh pr edit "$branch" \
171174
--title "chore: update pin for ${server}" \
172-
--body "Automated commit pin update for ${server}."
175+
--body "Automated commit pin update for ${server}." 2>&1; then
176+
echo "Failed to update PR for $server" >&2
177+
fi
173178
else
174-
gh pr create \
179+
if gh pr create \
175180
--title "chore: update pin for ${server}" \
176181
--body "Automated commit pin update for ${server}." \
177182
--base main \
178-
--head "$branch"
179-
new_pr_count=$((new_pr_count + 1))
183+
--head "$branch" 2>&1; then
184+
new_pr_count=$((new_pr_count + 1))
185+
else
186+
echo "Failed to create PR for $server" >&2
187+
fi
180188
fi
181189
done
182190

cmd/ci/compose_pr_summary.go

Lines changed: 0 additions & 82 deletions
This file was deleted.

cmd/ci/helpers.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -128,30 +128,6 @@ func runGitCommand(dir string, args ...string) (string, error) {
128128
return string(output), nil
129129
}
130130

131-
// initGitRepository creates or reuses a git repository rooted at dir with origin set.
132-
func initGitRepository(dir, remote string) error {
133-
if err := os.MkdirAll(dir, 0o755); err != nil {
134-
return err
135-
}
136-
if _, err := runGitCommand(dir, "rev-parse", "--is-inside-work-tree"); err == nil {
137-
return nil
138-
}
139-
if _, err := runGitCommand(dir, "init"); err != nil {
140-
return err
141-
}
142-
if _, err := runGitCommand(dir, "remote", "remove", "origin"); err == nil {
143-
// ignore error
144-
}
145-
_, err := runGitCommand(dir, "remote", "add", "origin", remote)
146-
return err
147-
}
148-
149-
// fetchCommit retrieves a single commit from origin into the repository.
150-
func fetchCommit(dir, commit string) error {
151-
_, err := runGitCommand(dir, "fetch", "--depth", "1", "--no-tags", "origin", commit)
152-
return err
153-
}
154-
155131
// splitList normalizes a delimited string into lowercase server names.
156132
func splitList(raw string) []string {
157133
if raw == "" {

cmd/ci/main.go

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/*
2+
Copyright © 2025 Docker, Inc.
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
THE SOFTWARE.
21+
*/
22+
123
package main
224

325
import (
@@ -19,18 +41,10 @@ func main() {
1941
switch cmd {
2042
case "collect-updated-pins":
2143
err = runCollectUpdatedPins(args)
22-
case "prepare-updated-pins":
23-
err = runPrepareUpdatedPins(args)
2444
case "collect-new-servers":
2545
err = runCollectNewServers(args)
26-
case "prepare-new-servers":
27-
err = runPrepareNewServers(args)
28-
case "compose-pr-summary":
29-
err = runComposePRSummary(args)
3046
case "collect-full-audit":
3147
err = runCollectFullAudit(args)
32-
case "prepare-full-audit":
33-
err = runPrepareFullAudit(args)
3448
case "update-pins":
3549
err = runUpdatePins(args)
3650
default:

0 commit comments

Comments
 (0)