Closed lukleh closed 8 years ago
Having the same problem (with "Chroot Plugin" v0.1.4 on Jenkins v2.1):
[…]
$ sudo /usr/sbin/pbuilder --update --basetgz /var/lib/jenkins/pbuilder/Debian_7_Wheezy.tgz --extrapackages "build-essential git-buildpackage libparse-debcontrol-perl libdistro-info-perl dupload"
debconf: delaying package configuration, since apt-utils is not installed
debconf: delaying package configuration, since apt-utils is not installed
$ sudo /usr/sbin/pbuilder --execute --basetgz /var/lib/jenkins/pbuilder/Debian_7_Wheezy.tgz --save-after-exec -- /var/lib/jenkins/chroot3877191375391158996.sh
I: Building the build Environment
I: extracting base tarball [/var/lib/jenkins/pbuilder/Debian_7_Wheezy.tgz]
I: creating local configuration
I: copying local configuration
I: mounting /proc filesystem
I: mounting /run/shm filesystem
I: mounting /dev/pts filesystem
I: policy-rc.d already exists
I: Obtaining the cached apt archive contents
+ cat
I: Copying back the cached apt archive contents
I: Saving the results, modifications to this session will persist
I: unmounting dev/pts filesystem
I: unmounting run/shm filesystem
I: unmounting proc filesystem
I: creating base tarball [/var/lib/jenkins/pbuilder/Debian_7_Wheezy.tgz]
I: cleaning the build env
I: removing directory /var/cache/pbuilder/build//14797 and its subdirectories
$ sudo /usr/sbin/pbuilder --clean --basetgz /var/lib/jenkins/jobs/Build_SPL_Daily/workspace/Debian_7_Wheezy/Debian_7_Wheezy.tgz
E: File /var/lib/jenkins/jobs/Build_SPL_Daily/workspace/Debian_7_Wheezy/Debian_7_Wheezy.tgz does not exist
FATAL: Chroot environment cleanup failed
Build step 'Chroot Builder' marked build as failure
Sending e-mails to: XXXXXX
[WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] Skipped based on build state FAILURE
Finished: FAILURE
I don't know [any] java, but I've been looking at this for a while now, and doesn't this patch makes sense?
--- a/src/main/java/org/jenkinsci/plugins/chroot/builders/ChrootBuilder.java
+++ b/src/main/java/org/jenkinsci/plugins/chroot/builders/ChrootBuilder.java
@@ -151,6 +151,11 @@ public class ChrootBuilder extends Builder implements Serializable {
FilePath workerTarBall = build.getWorkspace().child(this.chrootName).child(tarBall.getName());
workerTarBall.getParent().mkdirs();
+ if (!workerTarBall.exists() || !ChrootUtil.isFileIntact(workerTarBall) || tarBall.lastModified() > workerTarBall.lastModified()) {
+ tarBall.act(new LocalCopyTo(workerTarBall.getRemote()));
+ ChrootUtil.getDigestFile(tarBall).act(new LocalCopyTo(ChrootUtil.getDigestFile(workerTarBall).getRemote()));
+ }
+
// force environment recreation when clear is selected
if (isClear()) {
boolean ret = installation.getChrootWorker().cleanUp(build, launcher, listener, workerTarBall);
@@ -160,11 +165,6 @@ public class ChrootBuilder extends Builder implements Serializable {
}
}
- if (!workerTarBall.exists() || !ChrootUtil.isFileIntact(workerTarBall) || tarBall.lastModified() > workerTarBall.lastModified()) {
- tarBall.act(new LocalCopyTo(workerTarBall.getRemote()));
- ChrootUtil.getDigestFile(tarBall).act(new LocalCopyTo(ChrootUtil.getDigestFile(workerTarBall).getRemote()));
- }
-
//install extra packages
List<String> packages = new LinkedList<String>(this.additionalPackages);
for (String packagesFile : ChrootUtil.splitFiles(getPackagesFile())) {
Basically, because it tries to call installation.getChrootWorker().cleanUp(build, launcher, listener, workerTarBall);
before it actually copies the workerTarBall to it's new ('worker'? :) directory… ?
As in:
FilePath tarBall = new FilePath(build.getBuiltOn().getChannel(), installation.getHome());
FilePath workerTarBall = build.getWorkspace().child(this.chrootName).child(tarBall.getName());
workerTarBall.getParent().mkdirs();
if (!workerTarBall.exists() || !ChrootUtil.isFileIntact(workerTarBall) || tarBall.lastModified() > workerTarBall.lastModified()) {
tarBall.act(new LocalCopyTo(workerTarBall.getRemote()));
ChrootUtil.getDigestFile(tarBall).act(new LocalCopyTo(ChrootUtil.getDigestFile(workerTarBall).getRemote()));
}
// force environment recreation when clear is selected
if (isClear()) {
boolean ret = installation.getChrootWorker().cleanUp(build, launcher, listener, workerTarBall);
if (ret == false) {
listener.fatalError("Chroot environment cleanup failed");
return ret || ignoreExit;
}
}
instead of:
FilePath workerTarBall = build.getWorkspace().child(this.chrootName).child(tarBall.getName());
workerTarBall.getParent().mkdirs();
// force environment recreation when clear is selected
if (isClear()) {
boolean ret = installation.getChrootWorker().cleanUp(build, launcher, listener, workerTarBall);
if (ret == false) {
listener.fatalError("Chroot environment cleanup failed");
return ret || ignoreExit;
}
}
if (!workerTarBall.exists() || !ChrootUtil.isFileIntact(workerTarBall) || tarBall.lastModified() > workerTarBall.lastModified()) {
tarBall.act(new LocalCopyTo(workerTarBall.getRemote()));
ChrootUtil.getDigestFile(tarBall).act(new LocalCopyTo(ChrootUtil.getDigestFile(workerTarBall).getRemote()));
}
I can't test this, because it won't compile for me.
[ERROR] /root/chroot-plugin.jenkinsci/src/test/java/org/jenkinsci/plugins/chroot/util/ChrootUtilTest.java:[33,41] error: cannot find symbol
[ERROR] class ChrootUtilTest
[etc, etc]
@lukleh Do you know how to compile Jenkins plugins? If you do, maybe you could check my PR?
@FransUrbo I don't have jenkins anymore nor I work with it, but #28 makes sense.
Thanx.
@rmohr Could I trouble you to check this and possibly apply it right away if it's ok? I can't seem to be able to build jenkins plugins, so I can't check it :(
Fixed by 34819b89f921ef33478ab5306cb0d17836ec170d.
@FransUrbo until I do a release doing mvn clean package
and installing the resulting hpi plugin file by hand should be enough. Let me know if you still have issues building the plugin.
while "Clear" checkbox is checked, the error occurs when pbuilder image is recreated during the build form my understanding, the plugin is trying to clean image that does not exists yet