Kevin Yeh has proposed merging 
~kevinyeh/hwcert-jenkins-jobs:enhance-cc-lab-manager-job into 
hwcert-jenkins-jobs:master.

Commit message:
Make some enhancements to the cc-lab-manager job:
1. remove sources in the beginning of job to make sure job always pulls latest 
code from the repos.
2. add diff log into artifacts.
3. add if statement to judge if repos are changed.
   since we used "set -e" in the script, if nothing changed, script will be 
terminated when execute "git push".

Requested reviews:
  hwcert-jenkins (hwcert-jenkins)

For more details, see:
https://code.launchpad.net/~kevinyeh/hwcert-jenkins-jobs/+git/hwcert-jenkins-jobs/+merge/428244
-- 
Your team hwcert-jenkins is requested to review the proposed merge of 
~kevinyeh/hwcert-jenkins-jobs:enhance-cc-lab-manager-job into 
hwcert-jenkins-jobs:master.
diff --git a/jobs/infrastructure/cc-lab-manager/cc-lab-manager.yaml b/jobs/infrastructure/cc-lab-manager/cc-lab-manager.yaml
index 64b8574..977552e 100644
--- a/jobs/infrastructure/cc-lab-manager/cc-lab-manager.yaml
+++ b/jobs/infrastructure/cc-lab-manager/cc-lab-manager.yaml
@@ -38,7 +38,7 @@
             !include-raw: run-cc-lab-manager.sh
     publishers:
       - archive:
-          artifacts: '*.db'
+          artifacts: '*.db, *diff.log'
           allow-empty: true
 
 - project:
diff --git a/jobs/infrastructure/cc-lab-manager/run-cc-lab-manager.sh b/jobs/infrastructure/cc-lab-manager/run-cc-lab-manager.sh
index 18a4352..2941d55 100644
--- a/jobs/infrastructure/cc-lab-manager/run-cc-lab-manager.sh
+++ b/jobs/infrastructure/cc-lab-manager/run-cc-lab-manager.sh
@@ -1,8 +1,8 @@
 #!/bin/bash
 set -ex
 
-#Remove previous venv
-rm -rf env
+#Remove previous venv and sources
+rm -rf env cc-tool-box c3-cli cc-lab-manager cert-juju c3
 cat <<EOF >build-env.sh
 {build_env}
 EOF
@@ -48,13 +48,20 @@ mkdir -p c3/data/
 time cc-lab-manager
 
 cd "$WORKSPACE/cc-tool-box"
-git diff
-git add .
-git commit -m "Update by cc-lab-manager on $(date)"
-git push
+if [[ -z $(git status -uno --porcelain) ]];then
+    echo "Nothing changed"
+else
+    git diff > $WORKSPACE/cc-tool-box-diff.log
+    git add .
+    git commit -m "Update by cc-lab-manager on $(date)"
+    git push
 
 cd "$WORKSPACE/cert-juju"
-git diff
-git add .
-git commit -m "Update by cc-lab-manager on $(date)"
-git push
+if [[ -z $(git status -uno --porcelain) ]];then
+    echo "Nothing changed"
+else
+    git diff > $WORKSPACE/juju-diff.log
+    git add .
+    git commit -m "Update by cc-lab-manager on $(date)"
+    git push
+fi
-- 
Mailing list: https://launchpad.net/~canonical-hw-cert
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~canonical-hw-cert
More help   : https://help.launchpad.net/ListHelp

Reply via email to