From ca7e04d9dd59ee58260aebd1e3977eed87170b99 Mon Sep 17 00:00:00 2001 From: chengjoey <30427474+chengjoey@users.noreply.github.com> Date: Fri, 21 Jul 2023 09:51:27 +0800 Subject: [PATCH] set `max_old_space_size` option for js-build (#8) --- actions/js-build/1.0/dice.yml | 2 +- actions/js-build/1.0/internal/pkg/build/execute.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/actions/js-build/1.0/dice.yml b/actions/js-build/1.0/dice.yml index 76870de6..8b05b1a4 100644 --- a/actions/js-build/1.0/dice.yml +++ b/actions/js-build/1.0/dice.yml @@ -1,7 +1,7 @@ ### job 配置项 jobs: js-build: - image: registry.erda.cloud/erda-actions/js-build-action:1.0-20230427162436-685950d + image: registry.erda.cloud/erda-actions/js-build-action:1.0-20230710105441-b9ad3492 envs: BP_DOCKER_BASE_REGISTRY: registry.erda.cloud resources: diff --git a/actions/js-build/1.0/internal/pkg/build/execute.go b/actions/js-build/1.0/internal/pkg/build/execute.go index 75d5ede3..66ac7ba3 100644 --- a/actions/js-build/1.0/internal/pkg/build/execute.go +++ b/actions/js-build/1.0/internal/pkg/build/execute.go @@ -117,6 +117,12 @@ func runCommand(cmd string) error { command := exec.Command("/bin/bash", "-c", cmd) command.Stdout = os.Stdout command.Stderr = os.Stderr + memory := os.Getenv("PIPELINE_LIMITED_MEM") + if memory == "" { + memory = "2048" + } + command.Env = append(command.Environ(), fmt.Sprintf("NODE_OPTIONS=--max-old-space-size=%s", + memory)) if err := command.Run(); err != nil { return err }