Skip to content

Commit 9ef1b98

Browse files
committed
Stop publishing synthetic Godeps.json files
From https://github.com/kubernetes/enhancements/blob/master/keps/sig-architecture/917-go-modules/README.md#publish-staging-component-modules-to-individual-repositories: > Generate synthetic Godeps.json files containing the SHA or git tag of > module dependencies, for consumption by downstream consumers using > dependency management tools like glide. Continue publishing these at > least until our minimum supported version of go defaults to enabling > module support (currently targeted for go 1.13, which is approximately > Kubernetes 1.16-1.17 timeframe). Now that Go 1.16 is in module-aware mode by default, it should be safe to remove support for publishing synthetic `Godeps.json` files.
1 parent 13c28a9 commit 9ef1b98

File tree

15 files changed

+34
-545
lines changed

15 files changed

+34
-545
lines changed

Diff for: Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ ADD _output/collapsed-kube-commit-mapper /collapsed-kube-commit-mapper
3636
ADD _output/sync-tags /sync-tags
3737
ADD _output/init-repo /init-repo
3838

39-
ADD _output/godeps-gen /godeps-gen
4039
ADD _output/gomod-zip /gomod-zip
4140
ADD artifacts/scripts/ /publish_scripts
4241

Diff for: Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ build:
4040
$(call build_cmd,publishing-bot)
4141
$(call build_cmd,sync-tags)
4242
$(call build_cmd,init-repo)
43-
$(call build_cmd,godeps-gen)
4443
$(call build_cmd,gomod-zip)
4544
.PHONY: build
4645

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The publishing bot publishes the code in `k8s.io/kubernetes/staging` to their ow
1010

1111
It pulls the latest k8s.io/kubernetes changes and runs `git filter-branch` to distill the commits that affect a staging repo. Then it cherry-picks merged PRs with their feature branch commits to the target repo. It records the SHA1 of the last cherrypicked commits in `Kubernetes-sha: <sha>` lines in the commit messages.
1212

13-
The robot is also responsible to update the `go-mod` and the `vendor/` directory for the target repos, and to create a fake (sparse and repo level based) `Godeps/Godeps.json`.
13+
The robot is also responsible to update the `go-mod` and the `vendor/` directory for the target repos.
1414

1515
## Playbook
1616

Diff for: artifacts/scripts/construct.sh

-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ if [ -z "${SKIP_TAGS}" ]; then
149149
--push-script ${PUSH_SCRIPT} \
150150
--dependencies "${DEPS}" \
151151
--mapping-output-file "../tag-${REPO}-{{.Tag}}-mapping" \
152-
--generate-godeps=${PUBLISHER_BOT_GENERATE_GODEPS:-false} \
153152
--publish-v0-semver \
154153
-alsologtostderr \
155154
"${EXTRA_ARGS[@]-}"

Diff for: artifacts/scripts/util.sh

+1-76
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ sync_repo() {
334334
fi
335335
local date=$(commit-date ${k_pending_merge_commit}) # author and committer date is equal for PR merges
336336
local dst_new_merge=$(GIT_COMMITTER_DATE="${date}" GIT_AUTHOR_DATE="${date}" git commit-tree -p ${dst_merge_point_commit} -p ${dst_parent2} -m "$(commit-message ${k_pending_merge_commit}; echo; echo "${commit_msg_tag}: ${k_pending_merge_commit}")" HEAD^{tree})
337-
# no amend-godeps needed here: because the merge-commit was dropped, both parents had the same tree, i.e. go.mod did not change.
337+
# no amend-gomod needed here: because the merge-commit was dropped, both parents had the same tree, i.e. go.mod did not change.
338338
git reset -q --hard ${dst_new_merge}
339339
if ! skip-gomod-update ${k_pending_merge_commit}; then
340340
fix-gomod "${deps}" "${required_packages}" "${base_package}" "${is_library}" ${dst_needs_gomod_update} true "${commit_msg_tag}" "${recursive_delete_pattern}"
@@ -370,11 +370,6 @@ sync_repo() {
370370
squash_commits=$[${squash_commits} + 1] # squash the cherry-pick into the go.mod reset commit below
371371
dst_needs_gomod_update=true
372372
fi
373-
if godeps-changes ${f_mainline_commit}; then
374-
reset-godeps ${f_mainline_commit}^
375-
squash_commits=$[${squash_commits} + 1]
376-
dst_needs_gomod_update=true
377-
fi
378373

379374
# finally cherry-pick
380375
if ! GIT_COMMITTER_DATE="$(commit-date ${f_mainline_commit})" git cherry-pick --keep-redundant-commits ${pick_args} ${f_mainline_commit} >/dev/null; then
@@ -433,11 +428,6 @@ sync_repo() {
433428
squash_commits=$[${squash_commits} + 1] # squash the cherry-pick into the go.mod reset commit below
434429
dst_needs_gomod_update=true
435430
fi
436-
if godeps-changes ${f_latest_branch_point_commit} ${f_latest_merge_commit}; then
437-
reset-godeps ${f_latest_branch_point_commit}
438-
squash_commits=$[${squash_commits} + 1]
439-
dst_needs_gomod_update=true
440-
fi
441431

442432
if ! git diff --quiet --exit-code ${f_latest_branch_point_commit} ${f_latest_merge_commit}; then
443433
if ! git diff ${f_latest_branch_point_commit} ${f_latest_merge_commit} | git apply --index; then
@@ -463,11 +453,6 @@ sync_repo() {
463453
squash_commits=$[${squash_commits} + 1] # squash the cherry-pick into the go.mod reset commit below
464454
dst_needs_gomod_update=true
465455
fi
466-
if godeps-changes ${f_commit}; then
467-
reset-godeps $(state-before-commit ${f_commit})
468-
squash_commits=$[${squash_commits} + 1]
469-
dst_needs_gomod_update=true
470-
fi
471456

472457
echo "Cherry-picking k8s.io/kubernetes branch-commit $(kube-commit ${commit_msg_tag} ${f_commit}): $(commit-subject ${f_commit})."
473458
if ! GIT_COMMITTER_DATE="$(commit-date ${f_commit})" git cherry-pick --keep-redundant-commits ${f_commit} >/dev/null; then
@@ -636,14 +621,6 @@ function gomod-changes() {
636621
fi
637622
}
638623

639-
function godeps-changes() {
640-
if [ -n "${2:-}" ]; then
641-
! git diff --exit-code --quiet ${1} ${2} -- Godeps/Godeps.json
642-
else
643-
! git diff --exit-code --quiet $(state-before-commit ${1}) ${1} -- Godeps/Godeps.json
644-
fi
645-
}
646-
647624
function state-before-commit() {
648625
if git rev-parse --verify ${1}^1 &>/dev/null; then
649626
echo ${1}^
@@ -728,37 +705,6 @@ function fix-gomod() {
728705
if [ -f go.mod ]; then
729706
checkout-deps-to-kube-commit "${commit_msg_tag}" "${deps}" "${base_package}"
730707
update-deps-in-gomod "${deps}" "${base_package}"
731-
732-
# generate Godeps/Godeps.json from go.mod
733-
if [ "${PUBLISHER_BOT_GENERATE_GODEPS:-}" == true ]; then
734-
mkdir -p Godeps
735-
echo "Resolving dependencies for Godeps.json generation"
736-
GOPROXY="file://${GOPATH}/pkg/mod/cache/download" GO111MODULE=on go list -m -json all > /tmp/go-list
737-
/godeps-gen /tmp/go-list Godeps/Godeps.json
738-
git add Godeps go.mod go.sum # go.mod is surprisingly written: EOF newline
739-
if ! git-index-clean; then
740-
git commit -q -m "sync: update Godeps/Godeps.json"
741-
fi
742-
fi
743-
fi
744-
745-
# remove Godeps/Godeps.json
746-
if [ ! -f go.mod ] || [ "${PUBLISHER_BOT_GENERATE_GODEPS:-}" != true ]; then
747-
if [ -d Godeps ]; then
748-
git rm -q -rf Godeps
749-
if ! git-index-clean; then
750-
git commit -q -m "sync: remove Godeps/"
751-
fi
752-
fi
753-
fi
754-
755-
# remove vendor/ when switching from Godeps to go.mod
756-
if [ -d vendor/ ]; then
757-
echo "Removing vendor/ from Godeps era"
758-
git rm -q -rf vendor/
759-
if ! git-index-clean; then
760-
git commit -q -m "sync: remove vendor/"
761-
fi
762708
fi
763709

764710
# squash go.mod commits, either into ${dst_old_commit} or into _one_ new commit
@@ -797,24 +743,6 @@ function reset-gomod() {
797743
git commit -q -m "sync: reset go.mod" --allow-empty
798744
}
799745

800-
# Reset Godeps/Godeps.json to what it looked like in the given commit $1. Always create a
801-
# commit, even an empty one.
802-
function reset-godeps() {
803-
local f_clean_commit=${1}
804-
805-
# checkout or delete go.mod
806-
if [ -n "$(git ls-tree ${f_clean_commit}^{tree} Godeps/Godeps.json)" ]; then
807-
git checkout ${f_clean_commit} Godeps/Godeps.json
808-
git add Godeps/Godeps.json
809-
elif [ -d Godeps ]; then
810-
rm -f Godeps/Godeps.json
811-
git rm -f Godeps/Godeps.json
812-
fi
813-
814-
# commit go.mod unconditionally
815-
git commit -q -m "sync: reset Godeps/Godeps.json" --allow-empty
816-
}
817-
818746
# Squash the last $1 commits into one, with the commit message of the last.
819747
function squash() {
820748
local head=$(git rev-parse HEAD)
@@ -961,6 +889,3 @@ checkout-deps-to-kube-commit() {
961889
done
962890
}
963891

964-
indent-godeps() {
965-
unexpand --first-only --tabs=2
966-
}

Diff for: cmd/godeps-gen/main.go

-170
This file was deleted.

Diff for: cmd/init-repo/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var (
3838

3939
func Usage() {
4040
fmt.Fprintf(os.Stderr, `
41-
Usage: %s [-config <config-yaml-file>] [-source-repo <repo>] [-source-org <org>] [-rules-file <file> ] [-skip-godep|skip-dep] [-target-org <org>]
41+
Usage: %s [-config <config-yaml-file>] [-source-repo <repo>] [-source-org <org>] [-rules-file <file> ] [-target-org <org>]
4242
4343
Command line flags override config values.
4444
`, os.Args[0])

Diff for: cmd/publishing-bot/config/rules.go

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ type RepositoryRule struct {
7070

7171
type RepositoryRules struct {
7272
SkippedSourceBranches []string `yaml:"skip-source-branches"`
73-
SkipGodeps bool `yaml:"skip-godeps"`
7473
SkipGomod bool `yaml:"skip-gomod"`
7574
SkipTags bool `yaml:"skip-tags"`
7675
Rules []RepositoryRule `yaml:"rules"`

Diff for: cmd/publishing-bot/publisher.go

-3
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,6 @@ func (p *PublisherMunger) construct() error {
304304
lastPublishedUpstreamHash,
305305
)
306306
cmd.Env = append([]string(nil), branchEnv...) // make mutable
307-
if !p.reposRules.SkipGodeps {
308-
cmd.Env = append(cmd.Env, "PUBLISHER_BOT_GENERATE_GODEPS=true")
309-
}
310307
if p.reposRules.SkipGomod {
311308
cmd.Env = append(cmd.Env, "PUBLISHER_BOT_SKIP_GOMOD=true")
312309
}

0 commit comments

Comments
 (0)