Change /tmp folder for jenkins in debian - jenkins

I recently had a low disc space issue in jenkins. Although the home directory has sufficient space, the /tmp did not and it brought my master down.
I tried many ways to fix this
Discard old build and deleting old workspaces
Restarting jenkins
Tried to setup a node with same config and starting it, but that failed saying i dont have sufficient permission for copying remote.jar
Since my server is debian, I could not find any file where I could set set -Djava.io.tmpdir
Many people talked about jenkin file or config file, but I could not find it.
The only thing that worked was https://updates.jenkins-ci.org/download/plugins/tmpcleaner/ , this plugin hpi, which I installed through Advanced tag in plugins.
Also, I went manually to the /tmp folder in root and then deleted it contents to start the jenkins again. So my question is:
How do i change the /tmp folder in jenkins?
The jenkins home directory is /mnt/data/jenkins, however the tmp it uses it root/tmp. Why is it so? The /mnt/data/jenkins has lots of free space and i manually created a /tmp folder there, but it only takes the /tmp from the root

My colleague found the answer out
open '/etc/defaults/jenkins' file using command 'less /etc/defaults/jenkins'
Add argument
JAVA_ARGS="$JAVA_ARGS -Djava.io.tmpdir=yourNewtempLocation"
Once you restart jenkins, you will be able to see the storage of the new space

Related

Docker containers complain about missing files which exist in their filesystem

I recently moved my code repo from a One drive folder to my C: drive, trying to escape sync issues wiping files (thats another issue). Before doing so both my dev and prod compose files worked as expected (under source control).
Moving the files across (cloning from the repo and checking out to the branch) I ran my dev compose file which worked again as expected however my prod started complaining about "no such file or directory", "not found". I decided to snapshot the filesystem and check and could see the files and could cat the contents. So why is docker complaining?
My compose file does not use any hardcoded file paths, all relative and its evident the files are being copied across.
Compose errors:
exec docker/deployment/folder/scripts/run.sh: no such file or directory
Snapshot:
/app$ cat docker/deployment/folder/scripts/run.sh
#!/bin/sh
As previously mentioned this worked running from a diffirent local dir location. I can't imaging how that would make any diffirence.
Thanks in advance for any support.
Found the issue, vs code had updated the end-of-line sequence to crlf instead of lf.

How to get rid of files which end in .Identifier in Laravel

I cloned a laravel-8 sail project via gitlab but everywhere in every folder which containing files there is a file which ends in .Identifier
I don't know where they come from. There may be 1000 files like this in the project.
My question is:
How can I get rid of those files which endr with .Identifier?
Is there some kind of Ubuntu or docker command that searches the entire project for such file which ends in .Identifier and then deletes them?
Maybe phpStorm has such a function?
If you are on Linux machine, then open terminal in you project folder and run rm *.Identifier. And if you are on Windows machine then open command prompt in your project folder and run del *.Identifier. This will do the trick for you.

Changing JENKINS_HOME to another hard disk

I tried many tutorials I found on the internet on how to change the location of my JENKINS_HOME.
I still encountered these errors:
On the jenkins app - Unable to create the home directory ‘/mnt/2fe95e40-f8ba-418e-804c-0a25571f7b0c/jenkins’. This is most likely a permission problem.
On the jenkins logs - SEVERE hudson.util.BootFailure#publish: Failed to initialize Jenkins
hudson.util.NoHomeDir
In the the tutorials they are saying that one of the reasons to change the JENKINS_HOME is the issue of the disk space, but their steps were always to change the directory to a new /home/<new_folder>. They are still using the same drive, they just change the folder it does not fix their disk space problem.
Does anyone know how to use the another hard disk as the new JENKINS_HOME? Without having to use
SymLink or Symbolic Link that point to another drive.
I am using Ubuntu 18.04.1 x64
Thanks.
I would do a fresh install on the new hard disk, then make a backup from the old location and restore it on the new disk.
If you do not agree with this approach you should check which user has permission on the Jenkins files and folders on the new hard disk.
stat [yourfilename or yourfolder]
Compare with JENKINS_USER variable in etc/default/jenkins.
Change the user if needed on the new location:
chown -R your_user /var/lib/jenkins
You will need to restart Jenkins and maybe reboot the machine.
As a second option, maybe Jenkins can not create its home directory in the new place. You can create the directory manually and then change JENKINS_HOME to point to it.
More info:
https://wiki.jenkins.io/display/JENKINS/Administering+Jenkins
https://askubuntu.com/questions/175054/how-to-find-owner-and-group-of-a-directory
Run jenkins job as another user
Can't get Jenkins to start using Tomcat

Same VSCode-Settings for the whole crew?

We want to have the same VSCode settings for the whole crew of developers. Also it would be fine to have a oneline command to tear VSCode down and restart it from scratch with predefined settings and plugins so that you do not have to worry about trying out plugins and getting beck to the known state. Kind of Config-as-Code for VSCode.
I already found:
https://code.visualstudio.com/docs/editor/extension-gallery#_command-line-extension-management
https://github.com/microsoft/vscode-dev-containers
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync&ssr=false#qna
https://github.com/gantsign/ansible-role-visual-studio-code-extensions
https://code.visualstudio.com/docs/remote/containers
https://github.com/gantsign/ansible-role-visual-studio-code
But non of these provides a good solution to me
We are using Mac and Windows machines and develop most of the time locally (not remotely in the cloud or the like).
I imagine like having a script like
.... projectname up
or
.... projectname reset
(or
.... projectname down)
to receive/reset the configured settings and newest plugins that have been configured for the project.
Have any ideas or use a similar solution already?
After doing a lot of research, playing with Docker, Ansible and so on... it seems that although I excluded it at first the plugin Settings Sync Plugin from Shan Khan is the way to go. It has round about 1 million installs!
Only dependency - you need a GitHub account to host your configs. That is what held me back at first - but it should be not that much of a problem to get one for everyone in the team and connect it to like a company-github-account.
Copy the files settings.json and keybindings.json to your target machine(s) to copy the settings. You can find those files here:
Win: ~\AppData\Roaming\Code\User
Mac: ~/Library/Application Support/Code/User/
Linux: ~/.config/Code/User
You can copy extentions from ~/.vscode/extensions or C:\Users\username\.vscode\extensions from linux/mac or windows respectively.
FalcoGer's answer should explain how to copy the files in a way VS Code will pick them up. If you only need to copy the config files once, this solution would be fine.
If you need to "sync" these config files on a regular basis, I would advise to create a Git repository where all config files will be stored.
When cloning the repo to local machines, you can symlink the files to the config destinations (see FalcoGer's anwser). Then when you need to "sync", you only have to run git pull and restart VS Code to apply the changes.
For your other script-related question, you could create a CLI for this. Python would be the most friendly way to do this. You can find an example here.

Unable to revert or restore changes in a folder mapped to a different Volume (macOS)

There's a problem with TFS everywhere plugin for Eclipse if I try to revert or restore a file under a source control and if the folder/file is mapped to a different volume than the actual project.
When I try to restore or revert it, I get an error:
java.io.IOException: Failed to rename /Users/*/*/*/*/.tf1/8/d54f18aa-bdce-4ab7-958a-01eaaf0c36c1.tmp to /Volumes/macOSData/*/*/*/*/*/some_file.cs. Check the file and directory permissions.
Log has additional line:
2018-07-31 12:44:39,814 WARN [ModalContext] (com.microsoft.tfs.util.FileHelpers) Main rename failed (source permissions problem?), trying to rename temp file back
There's no problem while I get specific version of the project, even with overriding existing files, so there permissions are fine, at least for getting files. Also, this does not happen when the file is on the same volume as the local TFS mapping.
Setting all permissions to 777 does fix the problem, but this marks all files with +x making them all "changed", making this solution unacceptable.
I tried mapping the base folder to a second drive (i.e. force creating a .tf folder on a second drive), but this doesn't help. The error will appear when I try to revert stuff on the main volume.
I tried using symlinks so the mapping stays within the same volume, but still no luck.
Is there any way to solve this? Or everything should be on the same volume?
After a whole day of digging around and poking with jshell, this appears to be a bug with File.renameTo() in Java on macOS. renameTo function silently fails without any exception even though there's no permission issue to write to the destination. This happens only when writing to a different volume.
I have submitted a pull request into TFS Everywhere repo on github with a workaround for this issue.
Anyone interested can compile plugin with this changes to get things working:
https://github.com/Microsoft/team-explorer-everywhere/pull/276

Resources