diff --git a/README.md b/README.md index 1864482..8599272 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Local Builder is not 100% feature-compatible with the hosted Google Cloud Build ### Community Fork -This Google Cloud Build Local (fork) is maintained by volunteers, which at best, makes this ok for a local debugging +This Google Cloud Build Local fork is maintained by volunteers, which at best, makes this ok for a local debugging tool for Google Cloud Build. It does not support 100% feature parity with the hosted Cloud Build service and should not be used for production workloads. diff --git a/localbuilder_main.go b/localbuilder_main.go index 32453d3..373b14a 100644 --- a/localbuilder_main.go +++ b/localbuilder_main.go @@ -163,7 +163,7 @@ func run(ctx context.Context, source string) error { for k, v := range envMap { index := slices.Index(s.SecretEnv, k) if index >= 0 { - s.Env = append(s.Env, fmt.Sprintf("%s=%s", k, v)) + s.Env = append(s.Env, fmt.Sprintf("%s=%s", k, strings.ReplaceAll(v, "\n", "\\n"))) s.SecretEnv = slices.Delete(s.SecretEnv, index, index+1) log.Printf("Found secretEnv '%s' matching env file key and replaced it.", k) } diff --git a/validate/validate.go b/validate/validate.go index a4a1e31..ceff10d 100644 --- a/validate/validate.go +++ b/validate/validate.go @@ -26,10 +26,10 @@ import ( "time" "unicode" - pb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1" - "github.com/golang/protobuf/ptypes" "github.com/GoogleCloudPlatform/cloud-build-local/subst" "github.com/docker/distribution/reference" + "github.com/golang/protobuf/ptypes" + pb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1" ) const ( @@ -38,12 +38,12 @@ const ( // MaxTimeout is the maximum allowable timeout for a build or build step. MaxTimeout = 24 * time.Hour - maxNumSteps = 100 // max number of steps. - maxStepNameLength = 1000 // max length of step name. - maxNumEnvs = 100 // max number of envs per step. - maxEnvLength = 1000 // max length of env value. - maxNumArgs = 100 // max number of args per step. - + maxNumSteps = 100 // max number of steps. + maxStepNameLength = 1000 // max length of step name. + maxNumEnvs = 100 // max number of envs per step. + maxEnvLength = 65536 // max length of env value. + maxNumArgs = 100 // max number of args per step. + maxArgLength = 4000 // max length of arg value. maxDirLength = 1000 // max length of dir value. maxNumImages = 100 // max number of images. @@ -357,7 +357,6 @@ func CheckArtifacts(b *pb.Build) error { } } - if len(b.GetArtifacts().GetImages()) > 0 { b.Images = b.GetArtifacts().GetImages() } @@ -619,7 +618,7 @@ func checkEnvVars(b *pb.Build) error { // build step local env vars for i, s := range b.GetSteps() { if err := runCommonEnvChecks(s.GetEnv()); err != nil { - return fmt.Errorf("invalid .steps.env field: build step %d %v", i, maxNumEnvs) + return fmt.Errorf("invalid .steps.env field: build step %d %v", i, err) } }