Skip to content

Commit

Permalink
internal/task: remove initial tagging support
Browse files Browse the repository at this point in the history
With the first run done this code is now dead. We can create manual tags
for future bootstrapping.

For golang/go#48523.

Change-Id: Iff147d095205f3e3687136d85eaaa08bae207069
Reviewed-on: https://go-review.googlesource.com/c/build/+/444117
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Heschi Kreinick <[email protected]>
Auto-Submit: Heschi Kreinick <[email protected]>
  • Loading branch information
heschi authored and gopherbot committed Oct 19, 2022
1 parent c1ee1b7 commit bc09ea8
Showing 1 changed file with 13 additions and 33 deletions.
46 changes: 13 additions & 33 deletions internal/task/tagx.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,6 @@ func (x *TagXReposTasks) SelectRepos(ctx *wf.TaskContext) ([]TagRepo, error) {
return repos, nil
}

// TODO(heschi): delete after first use
var initialTags = map[string]bool{
"arch": true,
"crypto": true,
"image": true,
"net": true,
"oauth2": true,
"sync": true,
"sys": true,
"term": true,
"time": true,
}

func (x *TagXReposTasks) readRepo(ctx *wf.TaskContext, project string) (*TagRepo, error) {
head, err := x.Gerrit.ReadBranchHead(ctx, project, "master")
if errors.Is(err, gerrit.ErrResourceNotExist) {
Expand All @@ -106,9 +93,6 @@ func (x *TagXReposTasks) readRepo(ctx *wf.TaskContext, project string) (*TagRepo
if err != nil {
return nil, err
}
if tag == "" && initialTags[project] {
tag = "PLACEHOLDER"
}
if tag == "" {
ctx.Printf("ignoring %v: no semver tag", project)
return nil, nil
Expand Down Expand Up @@ -566,23 +550,19 @@ func (x *TagXReposTasks) MaybeTag(ctx *wf.TaskContext, repo TagRepo, commit stri
}

if highestRelease == "" {
if !initialTags[repo.Name] {
return TagRepo{}, fmt.Errorf("no semver tags found in %v", repo.Name)
}
repo.Version = "v0.1.0"
} else {
tagInfo, err := x.Gerrit.GetTag(ctx, repo.Name, highestRelease)
if err != nil && !initialTags[repo.Name] {
return TagRepo{}, fmt.Errorf("reading project %v tag %v: %v", repo.Name, highestRelease, err)
}
if tagInfo.Revision == commit {
repo.Version = highestRelease
return repo, nil
}
repo.Version, err = nextMinor(highestRelease)
if err != nil {
return TagRepo{}, fmt.Errorf("couldn't pick next version for %v: %v", repo.Name, err)
}
return TagRepo{}, fmt.Errorf("no semver tags found in %v", repo.Name)
}
tagInfo, err := x.Gerrit.GetTag(ctx, repo.Name, highestRelease)
if err != nil {
return TagRepo{}, fmt.Errorf("reading project %v tag %v: %v", repo.Name, highestRelease, err)
}
if tagInfo.Revision == commit {
repo.Version = highestRelease
return repo, nil
}
repo.Version, err = nextMinor(highestRelease)
if err != nil {
return TagRepo{}, fmt.Errorf("couldn't pick next version for %v: %v", repo.Name, err)
}

// TODO(heschi): delete after first couple uses
Expand Down

0 comments on commit bc09ea8

Please sign in to comment.