@@ 688,6 688,21 @@ func (ctx *JobContext) UploadArtifacts() error {
if _, err := rand.Read(random); err != nil {
return err
}
+
+ var (
+ maxSizeGB int64
+ sizeGB string
+ )
+ // assumes the artifact size is specified as an int
+ // e.g. 2 for 2GB and 1 for 1GB
+ if sizeGB, ok = config.Get("builds.sr.ht::worker", "max-artifact-size"); !ok {
+ // default to old hardcoded value if the key wasn't found in the config file
+ artifactCount = "1"
+ }
+ if maxSizeGB, err = strconv.ParseInt(sizeGB, 10, 64); err != nil {
+ return errors.New("The maximum build-artifact size could not be read")
+ }
+
for _, src := range ctx.Manifest.Artifacts {
ctx.Log.Printf("Uploading %s", src)
name := path.Join(prefix, "~"+ctx.Job.Username,
@@ 702,7 717,7 @@ func (ctx *JobContext) UploadArtifacts() error {
}
return err
}
- if size > 1024*1024*1024 { // 1 GiB
+ if size > 1024*1024*1024*maxSizeGB { // 1 GiB * maximum size (in GB)
err = errors.New("Artifact exceeds maximum file size")
ctx.Log.Printf("%v", err)
return err