how to delete src folder after test cases compiled? - jenkins

I am running the selenium test cases through jenkins. once the workspace is created and src folder is also there. I do not want the src folder to be exposed to all the users. how should I do ?

To restrict from other users,revoke the RWX permission for others(groups as well) to that directory and subdirectory using execute shell.
chmod -R o-rwx src
Here no role to play for jenkins

Thanks.
I used WS clean up plugin and it is able to delete the workspace or specified files and folders.

Related

Jenkins not copying folder structure of project

I'm trying to deploy with Jenkins. I'm sending to a server, and the folder www receives the files from the root project, but doesn't receive any of the folders and subfolders. How can I fix this?
I thought it could be permissions, so I tried to give chmod 777 to www, but didn't work anyway.
I have configured my server (hostname, username, and remote directory). Then I create my job with a git config (url, credentials, and branch to watch), job will run every minute. In the Build option, I put source files (*), Exec Command (commands for migrations and things like that). When it runs, my www folder was empty and receives files, but not folders.
I have found this link that explain how to do a best configuration for Jenkins: Jenkins transferring 0 files using publish over SSH plugin and I've discover why Jenkins just send files and not folders, this * should be **/* in Source files.

Jenkins - Publish Over SSH Plugin: How to copy directory

I'm trying to use Jenkins' Publish Over SSH plugin to copy all files AND sub-directories of some given directory, but so far, I've only able to copy files and NOT directory.
I have a directory named foo in my workspace, and during the build, I want to copy everything in this directory to a remote server.
I've tried this pattern foo/**, but it doesn't copy all sub-directories.
Any suggestion? Or this is not the plugin I should be using?
Thanks
For recursive copy of directory you should give
foo/**/*
I verified this on my laptop using locally deploying Jenkins. It works fine.

Docker build extra folders

I was trying to dockerize a nodejs application. I am adding code files to container using ADD command in Dockerfile. But i just noticed that folders named branches, objects, config, hooks are created automatically. Anybody out there know if its docker?
Found the issue. Using ADD ./* ./folder name/ instead of ADD . ./folder name created the extra folders.
But still wonder where those folders came from.
If your code file is in a git repo, you would have a .git subfolder that could be included by your ADD command.
That would explain the branches, hooks, ... folders.
As mentioned in "How to ADD all files/directories except hidden directory like .git in Dockerfile", you can exclude that folder with a .dockerignore file.

Prevent Jenkins Job from escaping the workspace

A developer committed a makefile with an output path of ....\SomeDir. When the project was built the output was dumped into Jenkins_Home. Is there any way to fail a build if it attempts to escape the workspace directory? Thanks,
-Michael
Worth putting some strong write permissions in place. Make sure that the user that Jenkins runs as only has permission to write to Jenkins_Home and its subdirectories.
You could also make sure that directories under Jenkins_Home only have write permission if it is necessary (workspace, for logging, etc.)
If a makefile attempts to use an absolute path then the build should fail with a permissions error.
I think the solution is that, before running the command, to do a change directory to workspace. If you have the workspace set up, then you can write something like cd $WORKSPACE or cd %WORKSPACE% ( for batch commands).

How to set ANT_PATH in Jenkins from outside of the workspace?

My file structure contains src/ folder with the project's source code, and this folder is the one I want to have in the jenkins' workspace.
However, I also have build folder which is needed for apache ant, and it is changing with every single "ant" command executed. The problem is this folder weights over 200mb. I don't want to end up pushing it to the repo everytime I run the "ant" command.
If someone who reads it has some experience with this - what's the best way to do it? Is it possible to pull src/ folder from the repo, and build/ folder from the system? But I guess it will be wrong because this way only I will be able to execute ant command...
What's the best way to set this?
Huh? You put build in your .hgignore file and then you'll not commit that directory or what's in it. That's the usual setup, but maybe I'm missing some nuance of your question.

Resources