Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5574

Removing existing snapshot views often fails

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • clearcase-plugin
    • None
    • Hudson 1.344, Clearcase Plugin 1.1

    Description

      I've noticed that clearcase views are not removed using "clearcase rmview" command.
      In Clearcase's manual (cleartool man rmview) it states this:
      [quote]

      • Never remove a view with any command other than rmview.
      • If a view still exists, do not use rmview -uuid to delete records
        relating to it from any VOB. Make sure that the view need not be used
        again before using this command.
        [/quote]

      The problem on not using this command is errors like this one:
      " FATAL: View path for ccview_01 does not exist, but the view tag does.
      Remove view from tagname instead of directory. ex: ct rmview -tag view_something
      "
      or
      "FATAL: View path for ccview_03 does not exist, but the view tag does.
      View cannot be created - build aborting.
      Finished: FAILURE"

      Real log output:
      — copy/past —
      [Component01] $ /opt/rational/clearcase/bin/cleartool unregister -view -uuid c5f5b55d.0bfb11df.8545.00:01:03:08:08:09
      [Component01] $ /opt/rational/clearcase/bin/cleartool rmtag -view ccview_01
      [Component01] $ /opt/rational/clearcase/bin/cleartool mkview -tag ccview_01 /net/hudson-server/storage/viewstorage/ccview_01.73269190
      Created view.
      Host-local path: hudson-server:/storage/viewstorage/ccview_01.73269190
      Global path: /net/hudson-server/storage/viewstorage/ccview_01.73269190
      It has the following rights:
      User : user1 : rwx
      Group: group1 : r-x
      Other: : r-x
      [Component01] $ /opt/rational/clearcase/bin/cleartool startview ccview_01
      [Component01] $ /opt/rational/clearcase/bin/cleartool catcs -tag ccview_01
      element * CHECKEDOUT
      element * /main/LATEST
      [Component01] $ /opt/rational/clearcase/bin/cleartool startview ccview_01
      [Component01] $ /opt/rational/clearcase/bin/cleartool mount -all
      [ccview_01] $ /opt/rational/clearcase/bin/cleartool lshistory -all -since 28-jan-10.10:56:21utc+0000 -fmt '\"%Nd\" \"%u\" \"%En\" \"%Vn\" \"%e\" \"%o\" \n%c\n' -nco Project1/Customers/Customer01/component01
      — end copy/paste —

      What I've also noticed is that, if we change job's WORKSPACE, clearcase plugin looses it's ability to create or remove snapshot views, because it doesn't use the viewtag to manipulate the view.
      So the behaviour becomes this:
      1) checks if the view exists;
      2) if it exists tries to remove it in the current WORKSPACE directory;
      3) but because workspace changed, it no longer is able to remove the view because it's pathname it's not the current WORKSPACE.
      4) But tries a "configured" number of times, because it "knows" the view exists (lsview is showing it) until it fails the build.

      Thanks in advance.

      Attachments

        Activity

          vlatombe Vincent Latombe added a comment - - edited

          "cleartool rmview -force -tag <viewtag>" should be enough, at least for snapshot views. I will start to review impacted files.

          Let's try the following pseudo-code :

          Bar.java
          skipViewCreation = false
          if (viewTag.exists()) {
          	if (viewPath.exists()) {
          		if (viewTag.equals(viewPath.getViewTag())) {
          			if (useUpdate) {
          				// sounds good, do nothing
          				skipViewCreation = true
          			} else {
          				rmview(viewPath)
          			}
          		} else {
          			// We have a problem, we don't know where is the view, and there is a view-private path at the view place
          		  move(viewPath, viewPath + ".keep")
          		  rmview(viewTag)
          		}
          	} else {
          			// We have to remove the view because we don't know where it is
          		  rmview(viewTag)
          	}
          } else {
          	if (viewPath.exists()) {
          		  move(viewPath, viewPath + ".keep")		
          	}
          }
          if (!skipViewCreation) {
          	mkview(viewTag, viewPath)
          }
          
          vlatombe Vincent Latombe added a comment - - edited "cleartool rmview -force -tag <viewtag>" should be enough, at least for snapshot views. I will start to review impacted files. Let's try the following pseudo-code : Bar.java skipViewCreation = false if (viewTag.exists()) { if (viewPath.exists()) { if (viewTag.equals(viewPath.getViewTag())) { if (useUpdate) { // sounds good, do nothing skipViewCreation = true } else { rmview(viewPath) } } else { // We have a problem, we don't know where is the view, and there is a view- private path at the view place move(viewPath, viewPath + ".keep" ) rmview(viewTag) } } else { // We have to remove the view because we don't know where it is rmview(viewTag) } } else { if (viewPath.exists()) { move(viewPath, viewPath + ".keep" ) } } if (!skipViewCreation) { mkview(viewTag, viewPath) }

          Fixed in trunk. Plugin will be much more resilient regarding handling of existing view tag and view paths.

          vlatombe Vincent Latombe added a comment - Fixed in trunk. Plugin will be much more resilient regarding handling of existing view tag and view paths.

          Code changed in hudson
          User: : vlatombe
          Path:
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/AbstractClearCaseScm.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearCaseSCM.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearCaseUcmSCM.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearTool.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolDynamic.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolDynamicUCM.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolExec.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolSnapshot.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ConfigSpec.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/PluginImpl.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/AbstractCheckoutAction.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/SnapshotCheckoutAction.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/UcmSnapshotCheckoutAction.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/util/PathUtil.java
          trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/AbstractClearCaseScmTest.java
          trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/ClearToolExecTest.java
          trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/ClearToolSnapshotTest.java
          trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/action/SnapshotCheckoutActionTest.java
          trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/action/UcmSnapshotCheckoutActionTest.java
          http://jenkins-ci.org/commit/29961
          Log:
          [FIXED - JENKINS-5574] Removing existing snapshot views often fails
          [FIXED - JENKINS-4569] Use 'cleartool setcs -current' instead of 'cleartool update'

          • Better handling of job renaming/deletion and behaviour regarding custom workspace
          • Plugin will be more resilient in case of existing view tag or view path in the way. Instead of failing, it will remove the view tag and/or rename the view path.
          • UCM : view config spec should be more consistently sync'ed with stream
          • Dev : new unit tests to cover addition/removal of load rules on an existing view
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : vlatombe Path: trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/AbstractClearCaseScm.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearCaseSCM.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearCaseUcmSCM.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearTool.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolDynamic.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolDynamicUCM.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolExec.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolSnapshot.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ConfigSpec.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/PluginImpl.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/AbstractCheckoutAction.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/SnapshotCheckoutAction.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/UcmSnapshotCheckoutAction.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/util/PathUtil.java trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/AbstractClearCaseScmTest.java trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/ClearToolExecTest.java trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/ClearToolSnapshotTest.java trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/action/SnapshotCheckoutActionTest.java trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/action/UcmSnapshotCheckoutActionTest.java http://jenkins-ci.org/commit/29961 Log: [FIXED - JENKINS-5574] Removing existing snapshot views often fails [FIXED - JENKINS-4569] Use 'cleartool setcs -current' instead of 'cleartool update' Better handling of job renaming/deletion and behaviour regarding custom workspace Plugin will be more resilient in case of existing view tag or view path in the way. Instead of failing, it will remove the view tag and/or rename the view path. UCM : view config spec should be more consistently sync'ed with stream Dev : new unit tests to cover addition/removal of load rules on an existing view

          Code changed in hudson
          User: : vlatombe
          Path:
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/AbstractClearCaseScm.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearCaseSCM.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearCaseUcmSCM.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearTool.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolDynamic.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolDynamicUCM.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolExec.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolSnapshot.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ConfigSpec.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/PluginImpl.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/AbstractCheckoutAction.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/SnapshotCheckoutAction.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/UcmSnapshotCheckoutAction.java
          trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/util/PathUtil.java
          trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/AbstractClearCaseScmTest.java
          trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/ClearToolExecTest.java
          trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/ClearToolSnapshotTest.java
          trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/action/SnapshotCheckoutActionTest.java
          trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/action/UcmSnapshotCheckoutActionTest.java
          http://jenkins-ci.org/commit/29961
          Log:
          [FIXED - JENKINS-5574] Removing existing snapshot views often fails
          [FIXED - JENKINS-4569] Use 'cleartool setcs -current' instead of 'cleartool update'

          • Better handling of job renaming/deletion and behaviour regarding custom workspace
          • Plugin will be more resilient in case of existing view tag or view path in the way. Instead of failing, it will remove the view tag and/or rename the view path.
          • UCM : view config spec should be more consistently sync'ed with stream
          • Dev : new unit tests to cover addition/removal of load rules on an existing view
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : vlatombe Path: trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/AbstractClearCaseScm.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearCaseSCM.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearCaseUcmSCM.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearTool.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolDynamic.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolDynamicUCM.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolExec.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ClearToolSnapshot.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/ConfigSpec.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/PluginImpl.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/AbstractCheckoutAction.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/SnapshotCheckoutAction.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/action/UcmSnapshotCheckoutAction.java trunk/hudson/plugins/clearcase/src/main/java/hudson/plugins/clearcase/util/PathUtil.java trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/AbstractClearCaseScmTest.java trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/ClearToolExecTest.java trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/ClearToolSnapshotTest.java trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/action/SnapshotCheckoutActionTest.java trunk/hudson/plugins/clearcase/src/test/java/hudson/plugins/clearcase/action/UcmSnapshotCheckoutActionTest.java http://jenkins-ci.org/commit/29961 Log: [FIXED - JENKINS-5574] Removing existing snapshot views often fails [FIXED - JENKINS-4569] Use 'cleartool setcs -current' instead of 'cleartool update' Better handling of job renaming/deletion and behaviour regarding custom workspace Plugin will be more resilient in case of existing view tag or view path in the way. Instead of failing, it will remove the view tag and/or rename the view path. UCM : view config spec should be more consistently sync'ed with stream Dev : new unit tests to cover addition/removal of load rules on an existing view

          Hello. The fix is available in 1.2. Could you verify and close?

          vlatombe Vincent Latombe added a comment - Hello. The fix is available in 1.2. Could you verify and close?

          People

            hmonteiro hmonteiro
            hmonteiro hmonteiro
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: