Skip to content

Commit 46b040c

Browse files
heschigopherbot
authored andcommitted
internal/relui: wait for module files to appear on proxy.golang.org
At some point the modules will be a key part of the release, just like the website entries are now. Make sure that they're available on proxy.golang.org before the release is announced. For golang/go#58659. Change-Id: I744c067f6efa06f3ca4cdbaf40a351f583331c16 Reviewed-on: https://go-review.googlesource.com/c/build/+/489415 Run-TryBot: Heschi Kreinick <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Auto-Submit: Heschi Kreinick <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 85f749b commit 46b040c

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

cmd/relui/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ func main() {
177177
ScratchURL: *scratchFilesBase,
178178
ServingURL: *servingFilesBase,
179179
DownloadURL: *edgeCacheURL,
180+
ProxyPrefix: "https://proxy.golang.org/golang.org/toolchain/@v",
180181
PublishFile: func(f *task.WebsiteFile) error {
181182
return publishFile(*websiteUploadURL, userPassAuth, f)
182183
},

internal/relui/buildrelease_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ esac
220220
CreateBuildlet: fakeBuildlets.CreateBuildlet,
221221
SignService: task.NewFakeSignService(t),
222222
DownloadURL: dlServer.URL,
223+
ProxyPrefix: dlServer.URL,
223224
PublishFile: publishFile,
224225
ApproveAction: func(ctx *workflow.TaskContext) error {
225226
if strings.Contains(ctx.TaskName, "Release Coordinator Approval") {

internal/relui/workflows.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,9 @@ func addSingleReleaseWorkflow(
423423
tagged := wf.Action2(wd, "Tag version", version.TagRelease, nextVersion, tagCommit, wf.After(okayToTagAndPublish))
424424
uploaded := wf.Action1(wd, "Upload artifacts to CDN", build.uploadArtifacts, signedAndTestedArtifacts, wf.After(tagged))
425425
uploadedMods := wf.Action2(wd, "Upload modules to CDN", build.uploadModules, nextVersion, modules, wf.After(tagged))
426+
availableOnProxy := wf.Action2(wd, "Wait for modules on proxy.golang.org", build.awaitProxy, nextVersion, modules, wf.After(uploadedMods))
426427
pushed := wf.Action3(wd, "Push issues", milestone.PushIssues, milestones, nextVersion, kindVal, wf.After(tagged))
427-
versionPublished = wf.Task2(wd, "Publish to website", build.publishArtifacts, nextVersion, signedAndTestedArtifacts, wf.After(uploaded, uploadedMods, pushed))
428+
versionPublished = wf.Task2(wd, "Publish to website", build.publishArtifacts, nextVersion, signedAndTestedArtifacts, wf.After(uploaded, availableOnProxy, pushed))
428429
if kind == task.KindMajor {
429430
goimportsCL := wf.Task2(wd, fmt.Sprintf("Mail goimports CL for 1.%d", major), version.CreateUpdateStdlibIndexCL, coordinators, versionPublished)
430431
goimportsCommit := wf.Task2(wd, "Wait for goimports CL submission", version.AwaitCL, goimportsCL, wf.Const(""))
@@ -559,6 +560,7 @@ type BuildReleaseTasks struct {
559560
GCSClient *storage.Client
560561
ScratchURL, ServingURL string // ScratchURL is a gs:// or file:// URL, no trailing slash. E.g., "gs://golang-release-staging/relui-scratch".
561562
DownloadURL string
563+
ProxyPrefix string // ProxyPrefix is the prefix at which module files are published, e.g. https://proxy.golang.org/golang.org/toolchain/@v
562564
PublishFile func(*task.WebsiteFile) error
563565
CreateBuildlet func(context.Context, string) (buildlet.RemoteClient, error)
564566
SignService sign.Service
@@ -1237,7 +1239,7 @@ func (tasks *BuildReleaseTasks) uploadModules(ctx *wf.TaskContext, version strin
12371239
}
12381240
want := map[string]bool{} // URLs we're waiting on becoming available.
12391241
for _, mod := range modules {
1240-
base := fmt.Sprintf("v0.0.1-%v.%v-%v", version, mod.Target.GOOS, mod.Target.GOARCH)
1242+
base := task.ToolchainModuleVersion(mod.Target, version)
12411243
if err := uploadFile(scratchFS, servingFS, mod.ZipScratch, fmt.Sprintf(base+".zip")); err != nil {
12421244
return err
12431245
}
@@ -1255,6 +1257,16 @@ func (tasks *BuildReleaseTasks) uploadModules(ctx *wf.TaskContext, version strin
12551257
return err
12561258
}
12571259

1260+
func (tasks *BuildReleaseTasks) awaitProxy(ctx *wf.TaskContext, version string, modules []moduleArtifact) error {
1261+
want := map[string]bool{}
1262+
for _, mod := range modules {
1263+
url := fmt.Sprintf("%v/%v.info", tasks.ProxyPrefix, task.ToolchainModuleVersion(mod.Target, version))
1264+
want[url] = true
1265+
}
1266+
_, err := task.AwaitCondition(ctx, 30*time.Second, checkFiles(ctx, want))
1267+
return err
1268+
}
1269+
12581270
func checkFiles(ctx context.Context, want map[string]bool) func() (int, bool, error) {
12591271
found := map[string]bool{}
12601272
return func() (int, bool, error) {

internal/task/dl2mod.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ const (
2525
)
2626

2727
func ToolchainZipPrefix(target *releasetargets.Target, version string) string {
28-
return modulePath + "@" + toolchainModuleVersion(target, version)
28+
return modulePath + "@" + ToolchainModuleVersion(target, version)
2929
}
3030

31-
func toolchainModuleVersion(target *releasetargets.Target, version string) string {
31+
func ToolchainModuleVersion(target *releasetargets.Target, version string) string {
3232
return fmt.Sprintf("%v-%v.%v-%v", moduleVersion, version, target.GOOS, target.GOARCH)
3333
}
3434

3535
// TarToModFiles converts the distribution archive with the given name and content
3636
// to a collection of module files.
3737
func TarToModFiles(target *releasetargets.Target, version string, t time.Time, tgz io.Reader, w io.Writer) (mod string, info string, _ error) {
38-
vers := toolchainModuleVersion(target, version)
38+
vers := ToolchainModuleVersion(target, version)
3939
zipPrefix := ToolchainZipPrefix(target, version)
4040

4141
// rename takes the name of a file found in a distribution archive

0 commit comments

Comments
 (0)