1
1
//
2
2
// DISCLAIMER
3
3
//
4
- // Copyright 2017 ArangoDB GmbH, Cologne, Germany
4
+ // Copyright 2017-2023 ArangoDB GmbH, Cologne, Germany
5
5
//
6
6
// Licensed under the Apache License, Version 2.0 (the "License");
7
7
// you may not use this file except in compliance with the License.
17
17
//
18
18
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19
19
//
20
- // Author Ewout Prangsma
21
- //
22
20
23
21
package main
24
22
@@ -33,6 +31,7 @@ import (
33
31
"os/exec"
34
32
"path/filepath"
35
33
"strings"
34
+ "time"
36
35
37
36
"github.com/coreos/go-semver/semver"
38
37
)
@@ -188,6 +187,9 @@ func githubCreateRelease(version string) {
188
187
if err := run (ghRelease , args ... ); err != nil {
189
188
log .Fatalf ("Failed to create github release: %v\n " , err )
190
189
}
190
+ // Ensure release created (sometimes there is a delay between creation request and it's availability for assets upload)
191
+ ensureReleaseCreated (version )
192
+
191
193
// Upload binaries
192
194
assets := map [string ]string {
193
195
"SHA256SUMS" : "SHA256SUMS" ,
@@ -220,6 +222,31 @@ func githubCreateRelease(version string) {
220
222
}
221
223
}
222
224
225
+ func ensureReleaseCreated (tagName string ) {
226
+ const attemptsCount = 5
227
+ var interval = time .Second
228
+ var err error
229
+
230
+ for i := 1 ; i <= attemptsCount ; i ++ {
231
+ time .Sleep (interval )
232
+ interval *= 2
233
+
234
+ args := []string {
235
+ "info" ,
236
+ "--user" , ghUser ,
237
+ "--repo" , ghRepo ,
238
+ "--tag" , tagName ,
239
+ }
240
+ err = run (ghRelease , args ... )
241
+ if err == nil {
242
+ return
243
+ }
244
+ log .Printf ("attempt #%d to get release info for tag %s failed. Retry in %s..." , i , tagName , interval .String ())
245
+ }
246
+
247
+ log .Fatalf ("failed to get release info for tag %s" , tagName )
248
+ }
249
+
223
250
func run (cmd string , args ... string ) error {
224
251
c := exec .Command (cmd , args ... )
225
252
c .Stdout = os .Stdout
0 commit comments