Ema has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/327497 )

Change subject: package_builder: run shell inside the chroot on build failures
......................................................................

package_builder: run shell inside the chroot on build failures

By default, pbuilder removes the chroot environment used during the
build process regardless of whether the build has been successful or
not.

On failed builds, running a shell inside the chroot seems like a better
idea, so that the user can investigate the failure before wiping
everything.

Ref: 
https://pbuilder-docs.readthedocs.io/en/latest/faq.html#logging-in-to-pbuilder-to-investigate-build-failure
Change-Id: I875aadcf617b86097297f47a3328fdd18dbd5e5d
---
M modules/package_builder/manifests/pbuilder_hook.pp
A modules/package_builder/templates/C10shell.wikimedia.org.erb
2 files changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/97/327497/1

diff --git a/modules/package_builder/manifests/pbuilder_hook.pp 
b/modules/package_builder/manifests/pbuilder_hook.pp
index 2cd78ec..9d0b8c0 100644
--- a/modules/package_builder/manifests/pbuilder_hook.pp
+++ b/modules/package_builder/manifests/pbuilder_hook.pp
@@ -13,6 +13,14 @@
         mode   => '0755',
     }
 
+    file { "${basepath}/hooks/${distribution}/C10shell.wikimedia.org":
+        ensure  => present,
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0555',
+        content => template('package_builder/C10shell.wikimedia.org.erb'),
+    }
+
     file { "${basepath}/hooks/${distribution}/D01apt.wikimedia.org":
         ensure  => present,
         owner   => 'root',
@@ -39,6 +47,7 @@
 
 
     # Dependency info
+    File["${basepath}/hooks/${distribution}"] -> 
File["${basepath}/hooks/${distribution}/C10shell.wikimedia.org"]
     File["${basepath}/hooks/${distribution}"] -> 
File["${basepath}/hooks/${distribution}/D01apt.wikimedia.org"]
     File["${basepath}/hooks/${distribution}"] -> 
File["${basepath}/hooks/${distribution}/D02backports"]
     File["${basepath}/hooks/${distribution}"] -> 
File["${basepath}/hooks/${distribution}/D05localsources"]
diff --git a/modules/package_builder/templates/C10shell.wikimedia.org.erb 
b/modules/package_builder/templates/C10shell.wikimedia.org.erb
new file mode 100644
index 0000000..a93c7b2
--- /dev/null
+++ b/modules/package_builder/templates/C10shell.wikimedia.org.erb
@@ -0,0 +1,13 @@
+#!/bin/bash
+#
+# invoke shell if build fails.
+cd /tmp/buildd/*/debian/..
+
+echo "**************************************************************"
+echo "The build has failed. We are now running a shell in the chroot"
+echo "used  for building, giving  you the chance  to investigate the"
+echo "failure. Note that leaving this shell means exiting the chroot"
+echo "itself and the chroot will be removed  immediately afterwards."
+echo "**************************************************************"
+
+/bin/bash < /dev/tty > /dev/tty 2> /dev/tty

-- 
To view, visit https://gerrit.wikimedia.org/r/327497
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I875aadcf617b86097297f47a3328fdd18dbd5e5d
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ema <e...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to