Using the LSCM and SCM CLI in the correct order
Would you please lay out the proper steps to:
-Log in > lscm login -r https://str4:9443/ccm -n str4 u xxxxx -P xxxxxxx
-Turn on RQM Adapter > RQMAdapter.bat start
-Accept any pending change(s) > lscm accept -r https://str4:9443/ccm -v -t "9.2.1 Web UI Stream 8.1.3 Workspace" -d "c:\rqm" -u xxxxx -P xxxxxx
-Log out > lscm logout -r https://str4:9443/ccm
using the SCM and/or LSCM command lines?
That's what i am currently doing and it keeps having a re-sync error or the whole workspace disappears within Eclipse. Not to mentioned that it mostly tells me its locked so I cant do anything with it. I'm doing something out of order or not understanding whats needs to happen before kicking off something else.
I'm mostly referring to this post here > https://jazz.net/forum/questions/94069
So writing the example commands in the correct order and cli command would be a great help.
|
3 answers
Hi David,
That looks like only part of the story.
You might be better off using the RQM execution utility and a RTC build to do what you want. You may not need SCM at all then, I've always found it a bit fussy. For automated builds/ operations you want to force a load or better still use an RTC build to fetch the items and then trigger a RQM Test Suite after that. I favour using an ANT script to do the build then firing a test suite using the execution utility from the ANT script, you can then collect all your links and results on the RTC build result.
LSCM/ SCM may well give you synch issues on occasion, you may wish to process any errors in your script by using powershell or python to wrapper it rather than a one line batch file command, either that or choose all the switches to force and ignore errors you can find :-).
A more robust lscm line would be a load command, not an accept, with the force switch to ignore any issues, also you should not need the password and username more than once, use the str4 nickname you setup in the login step
lscm load -r str4 -f
Note that your current directory should be the root of the workspace directory when you load, otherwise pass this with the -d switch.
Hope that helps
Cheers
Richard
Comments
David G
commented Sep 30 '19, 5:28 p.m.
Looks like that did not work. Would you mind just putting the command(s) steps you would take if you wanted to do the above steps? |
The following powershell should give you some clues. The idea with this sort of thing is to make it as noisy as possible so you give yourself good clues if it fails
<#Example powershell script, show how to fire a daemon, logon load a workspace , process JSON
logoff and kill the daemon
#>
param (
[string] $wspaceDir = "C:\Temp\exp1\loadDir",
[string] $wspaceName = "scmParallelTestWspace1",
[string] $scmLoc= "C:\RTC Eclipse Client\ALM-R12-RTC-Client-Win64-6.0.4-base\jazz\scmtools\eclipse\scm.exe",
[string] $lscmLoc= "C:\RTC Eclipse Client\ALM-R12-RTC-Client-Win64-6.0.4-base\jazz\scmtools\eclipse\lscm",
[string] $rtcURL= "https://YourServer/ccm/",
[string] $rtcUser="userId",
[string] $rtcPasswordFile="C:\UsersDirectory\notObvious.txt",
[string] $portNumForDaemon="61938"
)
function processErrorCode([int] $thisError) {
#scm has a ton of error codes you can process here
#try to hopefully recover from the errors, error code reminder below - collapse by default
<#
Scripted execution of Rational Team Concert source control command line tools can make use of the following exit status codes to make execution or flow control decisions.
Value Status
0 The command completed successfully.
1 There was a syntax error on the command line.
2 The client could not connect to the named repository URI with the credentials supplied by the user.
3 A failure occurred for an unknown reason
4 An internal error indicating that a subcommand could not be loaded.
5 The sandbox is misconfigured (its root could not be found, or is not shared).
6 A resource name collision was detected in the sandbox. An unshared resource in the sandbox has the same name as a shared resource in the repository workspace. This prevented the shared resource from being loaded.
7 A failure occurred due to an unknown internal error
8 The requested operation could not be completed because the sandbox is out of sync with the repository workspace. The user should reload or re-share the sandbox.
9 The requested operation could not be completed because a selector (name, alias, or UUID) supplied by the user either does not match enough items, or matches too many.
10 not used
11 There is a resource conflict in one or more repository workspaces accessed by the subcommand. The user must resolve those conflicts before continuing.
12 An unknown subcommand name was used.
13 reserved (OSGi exception)
14 A request to move a resource failed because the target exists and is unshared, or the target path is invalid.
15 Remote data changed during command execution. Re-run the command.
16 The requested operation could not be completed because it would introduce a gap into the change set history.
17 The requested operation was blocked by Team Process.
18 The requested operation failed because the user lacked one or more repository permissions. The message returned provides more information about the failure.
19 The requested operation could not complete because preconditions were not met.
20 The requested operation attempted to transfer a file that has improper line terminators or encoding.
21 The requested operation could not complete because it would create an n-way conflict in the change set history.
22 The requested operation could not complete because it would create one or more items that have no parent.
23 reserved (OSGi exception)
24 reserved (OSGi exception)
25 One or more specified repository items were not found.
26 Server error.
27 The sandbox is in use by another RCP process (an eclipse GUI or another Rational Team Concert source control command line client).
28 The requested operation could not complete because the repository workspace is misconfigured: the client could not find an item in the repository workspace. The user should verify that any repository workspace paths are correct.
29 The requested operation could not complete because of a license limitation.
30 The requested operation could not complete because but the item's state is inappropriate.
31 The file system daemon didn't receive an initial connection within the alloted amount of time.
32 The communication with the repository timed out.
33 Some of the properties could not be fetched for the specified files.
34 The requested operation cannot continue because there are files that are not checked in.
35 The property could not be set for the specified file.
36 The repository information was incorrectly specified with respect to an item.
37 The change set could not be completed.
38 The suspend operation cannot be performed on the suspended change set.
39 Encountered an IOException.
40 The requested operation could not be completed because the change set is not in history.
41 Service failure encountered when communicating with the repository.
42 Indicates that the mime type could not be set for the specified file.
43 Indicates that the daemon closed the stderror before printing the connection coordinates.
44 Indicates that the specified load rules cannot be processed because it has inaccessible items or has invalid load rules.
45 Indicates that delivering changes would create conflicts in the stream.
46 Indicates that the requested state of the versionable is deleted.
47 Indicates that we could not determine the repository URI for the given repository id.
48 Indicates that a server state mismatch has been detected. This can happen when we try to connect to the server from a daemon which has been active through the server rename process.
49 Indicating the user to rerun the command.
50 Indicates that one or more items are locked in the stream.
51 Indicates that a failure occurred due to an unexpected condition.
52 Indicates that an accept succeeded, but there were no incoming changes, so the workspace remains unchanged.
53 Indicates that a deliver succeeded, but there were no changes to deliver to the repository.
54 Indicates that one or more of the workspaces that are loaded in the sandbox are unreachable; therefore, the output from the status command does not include the status of all the workspaces in the sandbox.
#>
Write-Host "Processing Errorcode $($thisError)"
#the majority of errors cannot be recovered from so test for those that can then exit with the code if there is no clause
switch($thisError)
{
0 {
#should never get here, indicates successful command
break
}
6 {
#load error, ask the user if they want to force a load
#Note - makes no sense if run remotely obviously
$confirmation = Read-Host "Do you want to force a load?"
if ($confirmation -eq 'y') {
$loadResult = &"$($lscmLoc)" "load" "-r" "jazzhost" "--force" $wspaceName
if ($LastExitCode -ne 0 -and $LastExitCode -ne 6) {
processErrorCode -thisError $LastExitCode
}
break
}
}
52 {
write-host "There were no changes to accept"
break
}
53 {
write-host "There was nothing to deliver"
break
}
#enclose clause in curly brackets if using logic, this clause is for
#errors that don't matter and can be skipped over, probably more than shown here
{ $ -eq 33 -or $ -eq 30} {
break
}
#I think we want to crash out if we get any other errors, but nice to clean up
default {
#logout and clear up then exit
&"$($lscmLoc)" "logout" "-r" "jazzhost"
&"$($scmLoc)" "daemon" "stop" "--port" $portNumForDaemon
exit $thisError
}
}
}
Write-Host "Loading Workspace $($wspaceName)"
#get password from file (put file on a drive only visible to you)
$rtcPass= Get-Content $rtcPasswordFile
#logon and start a daemon for all our actions, needs to be a seperate process or it will lock this one
#NOTE THAT THE daemon has to be started in the same directory as any lscm commands being run, and they need to be lscm commands not scm ones
#not sure this is effective
start-job -scriptblock {
Set-Location "$($args[1])"
&"$($args[0])" "daemon" "start" "$($args[1])" "--port" $args[2]
} -ArgumentList $scmLoc, $wspaceDir, $portNumForDaemon
#fire up scm then wait for 10 seconds to let daemon start up
Start-Sleep -Seconds 10
#currrent directory needs to be the one that scm daemon is running in
#always need to logon should always set a nickname for the session, in this case hard coded to jazzhost
Set-Location "$($wspaceDir)"
&"$($lscmLoc)" "login" "-r" "$($rtcURL)" "-u" "$($rtcUser)" "-P" "$($rtcPass)" "-n" "jazzhost"
# we are assuming that we have a workspace and component to deliver to already
# but to illustrate the possibilities lets check for the existence of a component and a workspace and
# give good error messages if we need to exit
#This will get the current users workspaces
$allWorkspaces = &"$($lscmLoc)" "list" "workspaces" "-c" "$($env:USERNAME)" "-j" "-r" "jazzhost" | ConvertFrom-Json
$testWorkspacePresence = @($allWorkspaces | where { $_.name -eq $wspaceName } )
#Not finding the workspace is an error for us so generate an error and exit
if($testWorkspacePresence.Count -lt 1) {
Write-Host "Can't find workspace $($wspaceName) or it is not owned by you, exiting"
processErrorCode -thisError 1
}
#accept all changes into the repository workspace - reasonable assumption with a script
#but may also want to scope to component or work items, need to process output , use v to make it noisey
#note accept returns a ton of information
$acceptResult= &"$($lscmLoc)" "accept" "-j" "-v" "-t" $wspaceName "-r" "jazzhost"| ConvertFrom-Json
if ($LastExitCode -ne 0) {
processErrorCode -thisError $LastExitCode
}
#load our repository workspace tons of things can go wrong here should process errors
#too much for first example though, note that force is a blunt instrument, if a force is
#required an error will be generated and the user will be asked if that is what they want
$loadResult = &"$($lscmLoc)" "load" "-r" "jazzhost" "--allow" $wspaceName
if ($LastExitCode -ne 0) {
processErrorCode -thisError $LastExitCode
}
#logout and clear up and exit with a success errorlevel of 0
&"$($lscmLoc)" "logout" "-r" "jazzhost"
&"$($scmLoc)" "daemon" "stop" "--port" $portNumForDaemon
Write-Host "Script Completed Normally"
exit 0
Comments Thanks for taking the time to do that powershell script! I ran it and it seems to have finished without any issue. However, I still get the out of sync in my rft eclipse pending changes tab. The reason I am so keen to getting it not to be out of sync is because it doesn't seem to actually load the updated pending scripts (even though they are no longer in the pending tab hierarchy). Once i re-sync them inside Eclipse the changes then are shown in the updated scripts.
The way I re-sync was by using the "Load repository workspace" dialog box and choosing "Reload projects that are out of sync. Local changes will be preserved".
Then it shows this message box(es):
The reason I am so keen to getting it not to be out of sync is because it doesn't seem to actually load the updated pending scripts (even though they are no longer in the pending tab hierarchy). Once i re-sync them inside Eclipse the changes then are shown in the updated scripts.
The way I re-sync it is by using the "Load repository workspace" dialog box and choosing "Reload projects that are out of sync. Local changes will be preserved.
Then it shows this message box:
Richard Good
commented Oct 01 '19, 11:21 a.m.
Maybe you need to do a refresh on the directory you are dropping the files in?
lscm refresh -d D:/Testing/Ella_History Hist
David G
commented Oct 01 '19, 12:55 p.m.
I've tried as you requested and I dont seem to have the correct command?
$loadRefresh = &"$($lscmLoc)" "refresh" "-d" $wspaceDir
if ($LastExitCode -ne 0) {
processErrorCode -thisError $LastExitCode
}
David G
commented Oct 01 '19, 2:46 p.m.
Working with it a little more i got that part working. And now it seems that there are no errors. I had to add --force to the load line.
Sadly it still produces out of sync...
Here is my current powershell script:
Set-Location "$($wspaceDir)"
Write-Host "Refreshing"
&"$($lscmLoc)" "refresh" $wspaceDir
As an FYI i do have Eclipse opened when I kick off this script. Trying to automate gathering new pending files and turning on the QMA (Quality Manager Adapter) without any interaction (or interruption) to do on the users end.
What i am confused about is the sandbox and how placing a copy of my repository into it and calling the pending accept to that directory makes my original repository change - but why since i am calling those commands on just the sandbox version???
Richard Good
commented Oct 02 '19, 1:34 a.m.
Hi David,
It seems there's a resynch option on the load command "-s", I suggest you try that. Not quite sure why things are getting out of synch, you must be loading stuff into a sandbox other than the one referenced in the script?
$loadResult = &"$($lscmLoc)" "load" "-r" "jazzhost" "-s" "--allow" "--force" $wspaceName
if ($LastExitCode -ne 0) {
processErrorCode -thisError $LastExitCode
}
Hi again, Richard.
So I ran the script again using the added "s" within the load command. Seems to have worked but also introduced a new issue. See screen shots.
Notice the red "X" on each of the folder icons. Does this mean a conflict or would i need to do a repair command in the script?
David G
commented Oct 02 '19, 2:12 p.m.
Correction - its still out of sync :(
showing 5 of 10
show 5 more comments
|
I think you are somehow using two sandboxes connected to the same workspace causing this conflict. Can you avoid doing that? Comments Not sure how i am doing that. I have my original in c:\NICS_Automated_Repository, using c:\temp\loaddir for the sandbox and C:\_rqm for the powershell script location. That's all I am using so I don't think that's the reason for it to be out of sync?
David G
commented Oct 03 '19, 5:34 p.m.
I've also noticed that it doesnt seem to be starting the daemon. I get a number and string of letters and numbers but it just hangs there never going paste that part.
And the cursor just sits there and blinks.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.