Skip to content

Commit

Permalink
Keep form names in moscommon
Browse files Browse the repository at this point in the history
PUBLISHED_FROM=2c114c7275d7dca3940e19b4f995a7c9e1d8fae5
  • Loading branch information
dimonomid authored and cesantabot committed Jul 11, 2017
1 parent 0b76af5 commit 4180aca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mos/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ func buildRemote(bParams *buildParams) error {
// prepare multipart body
body := &bytes.Buffer{}
mpw := multipart.NewWriter(body)
part, err := mpw.CreateFormFile("file", "source.zip")
part, err := mpw.CreateFormFile(moscommon.FormSourcesZipName, "source.zip")
if err != nil {
return errors.Trace(err)
}
Expand All @@ -1103,21 +1103,21 @@ func buildRemote(bParams *buildParams) error {
}

if *cleanBuild {
if err := mpw.WriteField("clean", "1"); err != nil {
if err := mpw.WriteField(moscommon.FormCleanName, "1"); err != nil {
return errors.Trace(err)
}
}

if data, err := ioutil.ReadFile(moscommon.GetBuildCtxFilePath(buildDir)); err == nil {
// Successfully read build context name, transmit it to the remote builder
if err := mpw.WriteField("build_ctx", string(data)); err != nil {
if err := mpw.WriteField(moscommon.FormBuildCtxName, string(data)); err != nil {
return errors.Trace(err)
}
}

if data, err := ioutil.ReadFile(moscommon.GetBuildStatFilePath(buildDir)); err == nil {
// Successfully read build stat, transmit it to the remote builder
if err := mpw.WriteField("build_stat", string(data)); err != nil {
if err := mpw.WriteField(moscommon.FormBuildStatName, string(data)); err != nil {
return errors.Trace(err)
}
}
Expand Down
9 changes: 9 additions & 0 deletions mos/common/form.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package moscommon

const (
// Form names used for remote builds
FormBuildCtxName = "build_ctx"
FormBuildStatName = "build_stat"
FormCleanName = "clean"
FormSourcesZipName = "file"
)

0 comments on commit 4180aca

Please sign in to comment.