jjb: xci: Fix permissions in workspace before removing it 93/31193/6
authorMarkos Chandras <mchandras@suse.de>
Tue, 21 Mar 2017 12:46:51 +0000 (12:46 +0000)
committerMarkos Chandras <mchandras@suse.de>
Wed, 22 Mar 2017 20:10:27 +0000 (20:10 +0000)
From time to time we end up in the unfortunate situation where
the jenkins job breaks for random reasons and the logs are left
with 'root' permissions. On the next run, the job fails again but
this time it's because Jenkins does not have enough permissions
to delete them. We workaround this by fixing up the permissions
before removing the workspace.

Change-Id: I2fda20ded527bac73605ffa5818a2c44bf6c9026
Signed-off-by: Markos Chandras <mchandras@suse.de>
jjb/xci/bifrost-verify-jobs.yml
jjb/xci/xci-daily-jobs.yml

index 33032bc..6aea1c4 100644 (file)
         - bifrost-set-name
         - bifrost-build
 
+    wrappers:
+        - bifrost-fix-perms-workspace
+
     publishers:
         - email:
             recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com julienjut@gmail.com
                     pattern: 'prototypes/bifrost/**'
             readable-message: true
 
+#---------------------------
+# wrapper macros
+#---------------------------
+- wrapper:
+    name: bifrost-fix-perms-workspace
+    wrappers:
+        - pre-scm-buildstep:
+          - shell: |
+                #!/bin/bash
+                sudo chown -R $USER $WORKSPACE || exit 1
+
 #---------------------------
 # builder macros
 #---------------------------
index 65da308..ce2e4f3 100644 (file)
@@ -96,6 +96,9 @@
     triggers:
         - '{auto-trigger-name}'
 
+    wrappers:
+        - xci-fix-perms-workspace
+
     builders:
         - description-setter:
             description: "Built on $NODE_NAME"
             name: SLAVE_LABEL
             default: '{slave-label}'
 
+    wrappers:
+        - xci-fix-perms-workspace
+
     builders:
         - description-setter:
             description: "Built on $NODE_NAME - Scenario: $DEPLOY_SCENARIO"
         - 'xci-{phase}-builder'
+
+#---------------------------
+# wrapper macros
+#---------------------------
+- wrapper:
+    name: xci-fix-perms-workspace
+    wrappers:
+        - pre-scm-buildstep:
+          - shell: |
+                #!/bin/bash
+                sudo -R chown $USER $WORKSPACE || exit 1
+
 #---------------------------
 # builder macros
 #---------------------------