How can I provision more PermGen space for my cloudbees jenkins maven build? - cloudbees

I've got a build that is consistently failing with "OOM: PermGen" space errors. I've attempted to adjust my MAVEN_OPTS with a pre-build export command to no avail. What else can I do?

I've written a wiki article on this: https://wiki.jenkins-ci.org/display/JENKINS/Builds+failing+with+OutOfMemoryErrors

setting MAVEN_OPTS on a pre build shell script will only apply to this shell script.
Use MAVEN_OPTS option in maven build step advanced options, or global MAVEN_OPTS to apply to all jobs http://JENKINS.INSTANCE/configure

Related

Buildsteps after each other

How do I run several buildsteps after each other in IntelliJ? I think I want a mini CI/CD build system inside the editor.
For example, the project I work on now is a Spring boot and javascript web site. I need to build it with maven with mvn clean package -Pdockerimage. This copies files for building the Docker image to target/dockerimgbuild.
Then I want to build the docker image using docker build -t scheduling-ui-dev . and after that run it with docker compose docker-compose up --build from src/main/resources/docker-compose.
I have built one run configuration for each of these steps but how do I run them after each other? I have found that you can have before launch but the system is clunky and complains if target/dockerimgbuild doesn't exists even before it have run the maven step which creates it. Latest problem I stumbled on was that a file prevented maven from removing target/dockerimgbuild and all run steps was automatically removed from the run configurations.
There is a run configuration called compound but that runs everything in parallell and you can not specify order which is a problem.
I wonder if it is feasible to start TeamCity in a container, do anyone have a clue about that (is teamcity easy to configure, how to make it launch a docker-compose container on my host machine etc)?
My solution right now is to have several terminals (if this gets more permanent I will replace it with a script) where I just press up and enter to execute the steps manually. Seems stupid as I guess maven itself can do all of this...but I don't know how or how much work it is.
There is a compound Run/Debug configuration: https://www.jetbrains.com/help/idea/run-debug-configuration-compound-run-configuration.html
Also, there is a multi-run plugin: https://plugins.jetbrains.com/plugin/7248-multirun

Run CMD/Powershell command before the build command?

How I can run a CMD/Powershell before my Java GUI Application will be build and invoked.
I want run the command: sass ANYFILE.scss:ANYFILE.css to compile my scss file first.
In the Run/Debug Configurations I found nothing which helps me at the Before launch option.
Add the External Tool in IDE which will run any command you want, then add it in Before launch section.
There is a PowerShell plugin that provides a run configuration to run powershell scripts. You can add it as Before launch option as well.

IntelliJ IDEA: Running a shell script as a Run/Debug Configuration

Is there a way by which a shell script can be invoked from IntelliJ Run/Debug configurations?
I just found out that we can invoke a shell script with the help of BashSupport plugin.
'Add External tool' in the 'Before Launch' does the trick.
Screenshot
IntelliJ IDEA 2019.2 update
New version of IntelliJ IDEA has Shell Script Support included. It means you can now create Shell Script build for your project.
Edit Configurations > (+) Add New Configuration > Shell Script
You can also build your project before executing your script by adding Run Another Configuration task. That's how it looks like: Add Shell Build window
Not sure about 11, but in 12 there's a part of Run/Debug Configuration that is called "Before Launch" and you can select your shell script in "Add External tool" option.

Running rsvars.bat before Teamcity build starts

I have a C++ Builder 2010 project that's being built using TeamCity. I noticed some strange errors and after reading up on them I understand that I have to set a few variables located in rsvars.bat. I would like the build script to execute the bat file to set up the environment before performing the actual build. How do I best accomplish this?
Can I just use a <exec /> command at the very beginning of the file or is there a better way?
One way would be to run wrap the build in a script that calls rsvars.bat AND build commands. That would make the variables survive during the execution of the build.
But since I use TeamCity I like it to be a real msbuild step and not msbuild wrapped in something else. I was thinking of having the buildscript setting the variables from rsvars.bat into Machine or User at the start of the build and then remove them at the end, not nice though.
I finally just went with just adding the configurations to the Build Agents environment configuration in TeamCity and keeping installation paths identical between agents.
You can create a new build step and then specify a custom build step order so a new build step will be the first one.
See Configuring Build Steps
Add them as Build Parameters -> Environment Variables (in the build configuration), straight forward and generally works. The build parameter/environment variables will be setup automatically as environment variables on the build agent running the job.
You can then make a template of the build and reuse it.
Assumes that the 'paths' are the same on all build agents, which is generally the case. If not your suggestion of doing it by build agent is the way to go.

Passing the Maven Debug Flag from Hudson

I'm having an issue with a maven build in hudson. This issue would be fairly easy to resolve if I could see the output of maven with the -X flag passed in. However I can't find a way to do this. If I specify "-X" in the "Goals and options" field of the "Build" section in the job configuration my console output looks exactly the same as if I had not passed the "-X" flag at all. Is the debug logging going somewhere else? Or is there some other way I need to pass the "-X" flag?
UPDATE:
The reason this isn't working is because the build is failing during the "Parsing POMs" part of the hudson process, before it actually kicks off the true maven build and passes in any params I specify in the project. So what I really need is a way to get better logging during the "Parsing POMs" part of a maven build in hudson.
That's what it says in the help text.
Specifies the goals to execute, such
as "clean install" or "deploy". This
field can also accept any other
command line options to Maven, such as
"-e" or "-Dmaven.test.skip=true".
I would have put it there as well.
The maven help gives me the following two options:
-X,--debug Produce execution debug output
-e,--errors Produce execution error messages
May be you can try the --debug or the -e swtich
In Jenkins, and I assume this is true for Hudson as well, command line arguments can be passed to Maven in the "goals" setting. I was able to pass the -X parameter by adding it to the beginning of the "goals".
-X package install
Jenkins apparently blindly appends this setting to the end of the mvn command-line.
I have exactly the same problem with Hudson 1.398 (Maven 2.0.10, jdk 1.6.0_07): the build fails during the parsing of the pom files. It works locally and when launched manually from the Hudson workspace.
That build needs an environment variable to be set (for the path of a module), but the environment variable doesn't seem to be propagated from Hudson to Maven. So, like you, I have also tried to get more details from Maven with the -X option, but it also doesn't seem to be propagated.