Clean Jenkins Directory - jenkins

I check to discard old build, limit Max of the build to keep in Jenkins and delete the old workspace. However, when I run du -sh /var/lib/* Jenkins directory had 21G. I want under it and list files .I see just 236K. Please advise.

In addition to beung a duplicate question(see link), I hope you are aware ls -Sh only lists the space occupied by files and of inodes, if it's a directory. You must run du -hs to get the size of a directory.
Could be space by .m2 (maven local repo), .subversion (SVN data, in each dir), plus check the obvious Jenkins dirs: logs, jobs and workspaces.

Related

Jenkins running out of storage space

Though I have seen many were mentioning to use Deleteworkspace plugin to use and corresponding script in post build actions of the pipeline.
here we are using the multibranch pipeline.. I'm facing the challenges to maintain the storage space ..as it is running out for every build.
my management is not recommended to delete the workspace folder..instead choose the files in workspace and delete.
upon using the command du-sh ./*/ ..i can see workspace storage is 2.5 GB, but when i cd into workspace .. the ls -lart ..got to see ...all files with less size only 1 GB approxiamtely ( not upto 2.5GB)..
can someone. assist me, where i have missed ..
and help me to understand to restore the space in Jenkins

What is the use of multiple Jenkins plugin directory?

I was trying to create a Jenkins master slave system using Helm Charts. [ https://github.com/jenkinsci/helm-charts/blob/main/charts/jenkins/README.md ].
After deploying I can see the plugins are stored in two locations in the pod/ docker container.
1. /var/jenkins_home/plugins
2. /usr/share/jenkins/ref/plugins
What's the relation between these two? JENKINS_HOME is configured as /var/jenkins_home/. If I need to backup the plugins which directory should I backup ?
For a plugin named ace-editor, I can see these many files in respective folders.
/usr/share/jenkins/ref/plugins contains (1 file) -> ace-editor.jpi
/var/jenkins_home/plugins contains (4 file) -> ace-editor.jpi, ace-editor.jpi, ace-editor.jpi.pinned, ace-editor.jpi.version_from_image
What does this mean?
The directory to back up is always /var/jenkins_home. It is meant to be a persistent volume with all the data. /var/jenkins_home/plugins contains the downloaded .jpi plugin files and directories where each plugin has been unpacked.
The directory /usr/share/jenkins/ref is a "reference" directory on the container image. This means /usr/share/jenkins/ref/plugins is used as a starting point to install a base set of plugins into /var/jenkins_home/plugins the first time you run Jenkins.
The log file containing info about installed reference files is /var/jenkins_home/copy_reference_file.log.
The files with suffix .pinned or .version_from_image are used to control subsequent behaviour for example when plugins have been updated in jenkins_home from the UI and/or to the reference directory in a newer container image. Some users might want to use the bundled plugins in the image only for initial startup, others as the definitive source of all updates. See also environmental variables described in the documentation.
If you want to examine the inner workings you can find shell script jenkins.sh and functions source jenkins-support in the repository root or in /usr/local/bin on the image.

Jenkins - How can I change the plugin directory?

Cheers everyone,
I am in a Kubernetes environment and Jenkins plugins are installed at image build time via means of Jenkins CLI.
This causes the Image to have all plugins I require in the JENKINS_HOME inside the image.
When running the image however we mount a single volume to the location of JENKINS_HOME as to persist all files in that location.
This obviously overlays the files of the image with the files on the volume. Classic problem.
Now: In "pure" Docker I was able to simply "re-mount" the plugin folder's location again (I won't go into detail to keep this a little shorter) to "pull it back up to the surface". Thus resulting in all files from the volume BUT the plugins folder from the image.
This functionality does not seem to work in Kubernetes anymore.
Thus I would like to change the directory in which Jenkins stores its plugins (when I install them during build time) so they won't be in JENKINS_HOME anymore and thus won't be "over-mounted" by the volume at runtime.
I am having a hard time finding a config value for the plugin directory. Is there one?

Jenkins workspace standard and #tmp folders

i have multiple big directories in the workspace directory in Jenkins, these directories are about a year old can I rm -rf these folders or it would break something? and what does it mean when i have the same folder name but with different ending such as #2 , #2#tmp?
As far as I know, you can remove everything without any concern. Of course, you'll lose all the job outputs and archived artifacts.
About #2 folders, if I'm not wrong, they are created when there are concurrent jobs running.

Publishing to Artifactory using Jenkins

I am trying to use the Generic Jenkins-Artifactory plugin to deploy the contents of the Jenkins build workspace into Artifactory. This seems to be somewhat fine using the following wildcards
Web\*.msi=>Testing\Web
Web\DeploymentSettings\*.xml=>Testing\Web\DeploymentSettings
Database\Scripts\**=>Testing\Database
However, when it comes to moving the contents of 'Database\Scripts' from the Jenkins workspace, empty folders under 'Database\Scripts' do not get copied into Artifactory. Non-empty folders however are copied successfully. It is important that I maintain the directory integrity/structure so it's a must that I copy these across.
I have considered placing empty text files in the empty directories to have them copy over successfully but I don't want to "pollute" the package.
Please help :-)
Thanks!
Looks like there is no workaround -other than dummy files in the directories.
I see some bugs in Jenkins releated to handling empty directories.
JENKINS-7260 Clone workspace doesn't copy empty directories when cloning entire workspace
JENKINS-20654Empty folders are not copied to the slave
Could you check if answer posted in Hudson: Copy artifact from master to slave fails helps?

Resources