3

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Alavaros
  • 1,665
  • 7
  • 32
  • 52

2 Answers2

2

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi VonC, right now I'm using CC 8.0.1.10. About `config.ini`, I'm unable to find it, where it's supposed to be in a Windows machine? Thanks – Alavaros Dec 18 '15 at 11:24
  • @Alavaros the config.ini is part of the CCRCLI.zip mentioned in http://www-01.ibm.com/support/docview.wss?uid=swg24021929 (but for CC up to 8.0.0.1: I don't know about more recent CC versions) – VonC Dec 18 '15 at 14:34
  • Hi @VonC, only updating the version fixed the problem, now I do `rcleartool update -lname MyUser -server MyServer -password MyPass` and works fine. Thanks! – Alavaros Dec 21 '15 at 08:34
  • @Alavaros Great! I have included your comment in the answer for more visibility. – VonC Dec 21 '15 at 08:36
0

"rcleartool update" is ignored because rcleartool.bat itself is a batch file so u have to use "call rcleartool -params args" in each line in your batch file.

ShellNinja
  • 629
  • 8
  • 25
zhoubig
  • 23
  • 1
  • 4