It was a reglular day of the our product release and I was hoping everything would go as planned, but you know, production releases could go wrong even when everything was in place.
Jenkins is extremely reliable, however it can fail too, and that’s what happened to me. My production build failed with an error without much information. It said (in generic terms)…
Not able to Copy the files to the /tmp directory.
I started feeling the heat since the frontend production release was successful and things could start breaking for the users (though it was the time when the application is not used). I tried again.. Same errror. I tried it for the third time before I started debugging the instance, and now it said, “No Space Left on the Disk”, Finally some context.
Immediately I found my /tmp directory was filling up. I deleted the folder manually to get my build to succeed. It was a sign of relief when it did.
Now was the time to make sure this does not happen again. When I thought of it I realised the same problem happened 15 days ago but I did not get time to figure out what went wrong and since I use beanstalk my instance just restarted.
Anyway so after a bit of digging I found that we can configure each job to “discard old builds” this would ensure that the artifacts and the workspace is deleted for the previous builds.
The steps are below.. (For Freestyle Project)
Click the job that you want to configure.
Click Configure
In General, Click Checkbox for “Discard Old Build”
Configure as per your needs.
Make sure you save the settings.
Repeat it for all the jobs.
In case its not working for you, please leave a comment, I will try to help out! :)