Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

can you tell me how much memory is being used by the npm run build step in this pipeline?

Vishal Singh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 15, 2022
My pipeline has been failing due to memory limit issues for the build step. but after this setting is it working fine. I think the memory being used for docker is 2048 MB and for the Node js container is 6144 I just want to confirm this.
image: node:16.14.0
options:
docker: true
size : 2x

pipelines:
branches:
master:
- step:
name : "building the code"
services:
- docker
caches:
- node
- docker
script :
- npm i
- CI=false npm run build:production && tar czf build.tar.gz build
- pipe: atlassian/scp-deploy:1.2.1
variables:
USER:
SERVER:
LOCAL_PATH:
REMOTE_PATH:
SSH_KEY:
DEBUG: 'true'
definitions:
services:
docker:
memory: 1024

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 18, 2022

Hey Vishal,

To calculate the memory being used on a per-step basis, you can add the following to the beginning of the step:

- while true; do echo "Memory usage in megabytes:" && echo $((`cat /sys/fs/cgroup/memory/memory.memsw.usage_in_bytes | awk '{print $1}'`/1048576)) && sleep 0.1; done &

Once this has been added, you can check the build log and determine the amount of memory used - please see our article below for further troubleshooting steps related to pipelines (including the above specified):
https://confluence.atlassian.com/bbkb/troubleshooting-bitbucket-pipelines-1141505226.html

Cheers!

- Ben (Bitbucket Cloud Support)

Vishal Singh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 18, 2022

Hi Ben, sorry I think I have put my question in the wrong way. I just wanted to ask when the npm run command executes for the "building the code" step how much maximum memory can be allocated to it?

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 18, 2022

Hi Vishal,

The command provided is used to debug the memory that the build step is using so you can determine how much resources are needed.

You are correct in stating that by default the memory is 2048MB maximum, using the 2x flag as you have set increases this to 4096MB, I should have clarified this in my answer - my apologies.

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events