Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,360,197
Community Members
 
Community Events
168
Community Groups

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

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 Sep 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)

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 Sep 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
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

3,470 views 3 10
Read article

Atlassian Community Events