Skip to content

Commit

Permalink
tools: filter Nomad Enterprise tags in pre-push hook
Browse files Browse the repository at this point in the history
Our git pre-push hook already prevents Nomad Enterprise code from getting pushed
anywhere but its own repo. But this hook only works for files on the current
worktree (checkout). Were you to fetch an Enterprise tag into your local
Community Edition repo but not have it checked out, and then `git push --tags`,
you'd push that tag and the associated commit history.

Add tag filtering to the pre-push hook to prevent Enterprise tags (and the older
`+pro` SKU) tags from getting pushed to the Community Edition repo.
  • Loading branch information
tgross committed Nov 13, 2024
1 parent cf45f18 commit c6bacfa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dev/hooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ if [ -f version/version_ent.go ]; then
fi

# do not push directly to main, stable-*, release/*
# do not push Enterprise tags
# ====================
while read local_ref local_sha remote_ref remote_sha
do
Expand All @@ -45,5 +46,13 @@ do
if echo "$remote_ref"|grep -q 'refs/heads/release/.*'; then
fail "refusing to push directly to a branch prefixed \`release/\`"
fi
done

if echo "$remote_ref" | grep -q 'refs/tags/v.*\+ent'; then
fail "refusing to push Nomad Enterprise tag"
fi

if echo "$remote_ref" | grep -q 'refs/tags/v.*\+pro'; then
fail "refusing to push Nomad Enterprise (pro) tag"
fi

done

0 comments on commit c6bacfa

Please sign in to comment.