If we run it the pipeline (see below), we get:
java.lang.OutOfMemoryError: Java heap space
If we increase heap, e.g. by setting SONAR_SCANNER_JAVA_OPTS to -Xmx4096m, we get:
Container 'Build' exceeded memory limit.
1. How much memory is allocated to the pipeline?
2. How do we increase it? Some posts suggest adding "size: 4x" or similar but what is this 4x of, and where should we put it?
image: maven:3-jdk-11
clone:
depth: full # SonarQube Cloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarQube Cloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarQube Cloud
caches:
- maven
- sonar
script:
- mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
artifacts:
- target/**
pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
branches:
develop:
- step: *build-test-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud
size: 8x
Hi,
You can refer to this article for information about step sizes: https://support.atlassian.com/bitbucket-cloud/docs/step-options/#Size
Bitbucket assigns 4GB per step container (1x) steps. I would recommend trying 2x steps, which would give 8GB of memory to your step container, and then increase the sonarqube heap memory to 4 GB.
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarQube Cloud
size: 2x
I have used Sonar Scanner Docker images for the pipeline. To achieve this, I had to increase the step size to 2x and then increase the Docker memory limits from 1024 to 4096.
Note: 2x builds use 2x minutes off your monthly build minutes.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.