Skip to content
Permalink
Browse files
[FIXED JENKINS-18678] - Update builds location in RunMap after the jo…
…b's renaming

This change resolve the issue with missing builds after the jobs renaming and further cleanup of cache.
Finally, the cache's directory location will be updated after the each job renaming.
https://issues.jenkins-ci.org/browse/JENKINS-18678

Signed-off-by: Oleg Nenashev <nenashev@synopsys.com>
(cherry picked from commit 568ccba)
  • Loading branch information
oleg-nenashev authored and olivergondza committed Jan 9, 2014
1 parent 412befc commit 65502e1cd928e5f3bdaff505313ab8e7cb64350c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
@@ -1659,6 +1659,13 @@ void addToList( T item, List<T> collection ) throws IOException {
updateTransientActions();
}

@Override
public void renameTo(String newName) throws IOException {
super.renameTo(newName);
// Update locations inside builds cache
builds.updateBaseDir(getBuildDir(), false);
}

protected final synchronized <T extends Describable<T>>
void removeFromList(Descriptor<T> item, List<T> collection) throws IOException {
final Iterator<T> iCollection = collection.iterator();
@@ -2102,6 +2109,7 @@ public HttpResponse doEnable() throws IOException, ServletException {
makeDisabled(false);
return new HttpRedirect(".");
}


/**
* RSS feed for changes in this project.
@@ -210,6 +210,17 @@ public final boolean baseDirInitialized() {
return dir != null;
}

/**
* Updates base directory location after directory changes.
* This method should be used on jobs renaming, etc.
* @param dir Directory location
* @param reloadBuilds Purges cache after the directory update
*/
public final void updateBaseDir(File dir, boolean reloadBuilds) {
this.dir = dir;
purgeCache();
}

/**
* Let go of all the loaded references.
*

0 comments on commit 65502e1

Please sign in to comment.