Jenkins creating a view in ClearCase - jenkins

I'm working on an automatic build using Jenkins and ClearCase and I have a problem.
I wrote a batch script to create a view in ClearCase using the cleartool command mkview.
When I execute the script by clicking on it, everything works, the view is created in ClearCase. But when I launch the script via Jenkins, I have the following errors :
C:\Program Files\Jenkins\workspace\JenkinsLecon1>
"C:\Program Files\IBM\RationalSDLC\ClearCase\bin\cleartool.exe"
mkview -sna -tag AUTOBUILD_VIEW_TEST1_CFW_INFRA_V5.10_Dev -str CFW_INFRA_V5.10_Dev#\projects -host sasla15001 -hpath d:\ClearCase_Storage\views\DOM3\268875\ -gpath \\sasla15001\ccstg_d\views\DOM3\268875\ CFW_INFRA_V5.10_Dev
Selected Server Storage Location "sasla15001_ccstg_d_views".
cleartool: Error: unable to set access control list for \\sasla15001\ccstg_d\views\AUTORITE+NT\SYSTEM\CFW_INFRA_V5.10_Dev.22.vws: Accès refusé.
cleartool: Error: protection on \\sasla15001\ccstg_d\views\AUTORITE+NT\SYSTEM\CFW_INFRA_V5.10_Dev.22.vws is out-of-synch with identity.sd and groups.sd
cleartool: Error: Failed to set identity on view: Permission denied
cleartool: Error: unable to set access control list for \\sasla15001\ccstg_d\views\AUTORITE+NT\SYSTEM\CFW_INFRA_V5.10_Dev.22.vws: Accès refusé.
cleartool: Error: \\sasla15001\ccstg_d\views\AUTORITE+NT\SYSTEM\CFW_INFRA_V5.10_Dev.22.vws:
Permission denied
cleartool: Error: Unable to create view "\\sasla15001\ccstg_d\views\AUTORITE+NT\SYSTEM\CFW_INFRA_V5.10_Dev.22.vws".
I pretty sure that the error come from an access right problem.
But I did not find an mkview option like -user or something like that to user my clearcase user account.
I hop that someone had the same problem and solve it or just someone who can help me!

For those who have the same problem, the solution is start Jenkins as administrator.
To do this :
1) open a prompt command as administrator
start/accessories/
Then right click on prompt command and choose start as
2) go to Jenkins directory
cd /D C:\Program Files\Jenkins
3) start Jenkins Server
java -jar jenkins.war --httpPort=8081 not 8080
wait until the sever is running this line will appear INFO:Jenkins is fully up and running
now the Jenkins server is running as administrator
4)open your web browser and go to
http ://localhost:8081
5) create your job!!!
to know where is the workspace just create a new batch script add the command line
cd
save and build the job. Next go to the console and just read the path

See for instance the Error: unable to set access control list for : Access is denied
The cause of this problem relates to restrictive permissions on either the view share or directory to which the view is being created.
Make sure who (i.e. which account) is executing those commands when run by Jenkins (is it the local system account?). As the OP Bastien mentions, running with elevated privileges is key.
Make also sure of the CLEARCASE_PRIMARY_GROUP environment variable value at the time of the Jenkins job.
It must be set to the group of the vob you want to access (or one of its secondary group).

Related

Can't connect to Jenkins Slave No Known Hosts file was found at /var/jenkins_home/.ssh/known_hosts

Here are my jenkins config:
Error message:
/var/jenkins_home/.ssh/known_hosts [SSH] No Known Hosts file was found at /var/jenkins_home/.ssh/known_hosts. Please ensure one is created at this path and that Jenkins can read it.
No matter how much I tried it doesn't work. I've read this post, but still no solution.
I got the same error while launching slave.It has to do with the SSH Slave Plugin. What worked for me was changing the Host key verification strategy in LAUNCH METHOD from "Known Hosts file verification strategy" to "Manually trusted key verification strategy".
CONFIGURE AGENT -> LAUNCH METHOD -> Manually trusted key verification
strategy - > SAVE.
Hope this helps.
The problem is that Jenkins causes confusion by reporting that the file is missing under /var/jenkins_home/, which is a hard-coded value. Instead, it should be telling you that the file is missing under your actual $JENKINS_HOME path. That way, you would immediately know where to look.
So the easiest way to fix this is to:
Go to the actual $JENKINS_HOME directory on your Jenkins master, and create a .ssh directory and known_hosts file under it, for example:
$ mkdir $JENKINS_HOME/.ssh
$ touch $JENKINS_HOME/.ssh/known_hosts
If you've ever SSH-ed from Jenkins master to your slave machine before, then you should already have a known_hosts file under your ~/.ssh directory. If you don't, then SSH from Jenkins master to Jenkins slave machine and it will get automatically created for you under ~/.ssh directory for that user.
Now open that ~/.ssh/known_hosts file and simply copy>paste the line that contains your slave machine's IP address to the $JENKINS_HOME/.ssh/known_hosts file. Alternative way is to copy the entire ~/.ssh/known_hosts file to $JENKINS_HOME/.ssh directory if that is easier for you.
A very simple step helped me to recover this error.
In Slave configuration, select "No verifying verification strategy" for Host Key Verification Strategy. This will allow master to connect with slave and host will also be remembered.
Next time on selecting "Known host file verification strategy" will not give this error.

sesu : not found no such file or directory in Jenkins ssh plugin

Trying to connect to the server using Jenkins ssh plugin and executing some commands. It's connected but sesu command is not working. Jenkins is unable to recognize sesu command. It says sesu : not found no such file or directory. When trying with putty, sesu command is working. Jenkins version is 2.7. Please help me on same. Thanks in advance. :)
Use locate sesu command. It will show path of sesu command. Use that one in spite of only sesu. e.g. /opt/CA/AccessControl/bin/sesu
As we can't enter password on Jenkins at run-time. Other option for accessing server is generate ssh-key. Use that key to access server from Jenkins.
Use putty or similar tools to create key.
Firstly, log in to your server using credentials.
Then switch to user who has all access rights by using sesu or other switch user command like sudo su.
Execute below steps after that :
ssh-keygen -t rsa
hit enter for all steps without entering input.
then,
Once key is created, type cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys hit [Enter]
use created rsa private key after all these step in SSH plug and you are able to access unix server from Jenkins and execute commands on that server.

Possible bug is Jenkins Swarm plugin - fsroot to set Remote root directory relative vs full path

I have latest Jenkins and it's Swarm plugin client jar (2.0).
I downloaded the swarm-client jar and I ran the following command to create the slave: (Note: : I'm using user Anonymous to connect to Jenkins master without requiring username/password and have provided Create Slave permission in Global Roles, and all access in Slave section under Slave roles by creating a new role with pattern swarm.*). Jenkins Swarm client: https://wiki.jenkins-ci.org/display/JENKINS/Swarm+Plugin
A user can provide a valid username/password if that user has Create Slave (Global Roles) and other access like connect, delete, etc in Slave Roles in Jenkins under Manage Roles).
$ which swarm-client.jar
~/tools/bin/swarm-client.jar
$ pwd
/home/confman/slaves
$ ~/tools/jdk1.7.0_60/bin/java -jar `which swarm-client.jar` -name "swarm_`hostname -a`" -fsroot "~/slaves/swarm_`hostname -a`" -master http://jenkins_master.srvr.company.com:8083 -username Anonymous -description "`hostname -a` " -executors 5 -labels "ANSIBLE_CENTOS CENTOS" -mode 'exclusive' -showHostName -t java=~/tools/jdk1.8.0_45 -t gradle=~/tools/gradle-2.3 -t Maven=~/tools/apache-maven-3.3.3 -t Groovy2=~/tools/groovy-2.4.5 --showHostName -retry 0 -disableClientsUniqueId &
But, instead of the above command setting Slave's Remote Root Directory to ~/slaves/swarm_jmeter01, it's setting the remote root path including the folder as prefix/relative to from where I ran the above command (as shown below). In my case, hostname command value is jmeter01.
The documentation doesn't mention that this paramter is relative to the current folder (where you'd run the java -jar slave-client jar command).
Has anyone found a solution for this i.e. it can ignore the current folder and set it to ~/slaves/swarm_01 or something like that?
Obviously In my automation to resolve this issue, I can first "cd" (change directory) to the correct folder ~/slaves and then just pass -fsroot "swarm_`hostname -a`" to get remote directory path value set as: ~/slaves/swarm_jmeter01 (in that case, it'll work fine).
~ is shell expansion ... if this not works, then use $HOME instead

VS 2013 Release Management - Illegal characters in path

I have build a custom deployment Action based on TFS 2010 command-line utility, TF.exe. When executed from a DOS prompt on the deployment agent server, it runs fine.
TF view /collection:uri "$source path" > "local path"
and the file does get downloaded, without a need of a workspace. However, when executed through VS2013RM, I get an error:
Illegal characters in path.
When I hover over the message column it reads:
The installation command \"my correct command line here\" failed with the exit code \"100\"
What gives? How come it executes fine in one place, but not the other? The RM Client runs under a network service account, which is part of the local admins and collection's service accounts.
After enabling log
I was able to capture this command:
Deployment: **********Installing component using command "C:\DevOps\TfsClient\TF.exe view /collection:http://[removed detail] "$/[removed detail]/MetastoreCS.xml" > "F:\[removed detail]\MetastoreCS.xml""
Than the error
9/24/2014 10:58:10 AM - Information - (12628, 26560) - Deployment: Exception The installation command \"C:\DevOps\TfsClient\TF.exe view /collection:http://[removed detail] "$/[removed detail]/MetastoreCS.xml" > "F:\[removed detail]\MetastoreCS.xml"\" failed with the exit code \"100\".
It seems like the redirecting character '>' is causing issue.
I was able to make it work using the /output option. Refer to the tf view documentation.
C:\DevOps\TfsClient\TF.exe view /collection:http://[removed detail] "$/[removed detail]/MetastoreCS.xml" /output:"F:\[removed detail]\MetastoreCS.xml"

Jenkins, Executable and right

It seems that i have a permission problem to execute a .exe under windows with jenkins.
Things to know about the system:
I have a windows user called 'Tester'. This user has Administrator rights
Jenkins run as a service using Tester username
I have a job which does the following:
cd C:\Program Files (x86)\Jenkins\workspace\sahi\tools
toggle_IE_proxy.exe enable
The process is silent, no output. The executable must probably change some values in registry.
This command tick the checkbox "Use a proxy..."
Note: it is working fine when i execute the command above in a cmd.exe as user 'Tester'.
Do you have an idea what's happening there ?
Many thanks
It seems that turning Off UAC solved my problem

Resources