I've been looking for a way to update my CCRC view via windows command line in a non-interactive way.
I'm using Jenkins and today there isn't a plugin for CCRC yet (https://issues.jenkins-ci.org/browse/JENKINS-5192), so I'm trying, as a first step, to auto update my CCRC view via batch script. I installed Managed Script Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Managed+Script+Plugin) and wrote this simple script:
cd C:\Views\PathToMyViewVOB
rcleartool login -lname MyUser -server MyServer.com -password MyPass
rcleartool update
With this script, in the first execution, the login works correctly, but, I don't know why, Jenkins ignores the update command. In the following executions, it shows this error:
CRCLI2014E You have already logged on the server
"MyServer.com".
Build step 'Execute managed windows batch' marked build as failure
Finished: FAILURE
I've also tried with this other command, thinking that you can pass my credentials with any subcommands of rcleartool:
cd C:\Views\PathToMyViewVOB
rcleartool update -username MyUser -password MyPass -server MyServer.com
And this is the error now:
CRCLI2001E Unrecognized option: "-username".
Use: update [-print] [-ove/rwrite | -nove/rwrite | -ren/ame] [-pti/me][nombrep ...]
update -add/_loadrules [-print] [-ove/rwrite | -nove/rwrite | -ren/ame][-pti/me] nombrep [...]
Build step 'Execute managed windows batch' marked build as failure
Finished: FAILURE
I've thought in a script that checks if I'm already logged, if not, log in and then update, if yes, only update, and then go on with the compilation, but I don't know how to do that.
Is there any way to do what I want, auto update the CCRC? I can always do it manually, but...you know, it's better non-interactive.
Any suggestions, advice or idea will be helpful.
It depends on the version of ClearCase that you are using.
Before CC 8.0.1.9, there is this bug where, in non interactive mode, IBM ClearCase rcleartool
waits on prompt for login when previous login failed, instead of reporting an error and not prompt the user.
As mentioned in this thread, you need to make sure CCSHARED & JAVA_HOME are properly in the rcleartool
config.ini
, as in here:
CCSHARED=C:\Program Files (x86)\IBM\IMShared
JAVA_HOME=C:\Program Files (x86)\Java\jre7
Those paths are example only, and might differ from your actual path.
The point is: they must be valid in the Jenkins job execution context (on the slave)
The OP Alavaros mentions in the comments:
only updating the version fixed the problem, now I do:
rcleartool update -lname MyUser -server MyServer -password MyPass
And works fine.