Don't modify cord-charts-repo or upload if charts are unchanged

Push new git tag correctly, and clarify commit message to include source
project

Change-Id: I8bb71cfa2580f94d15b3551e3da82f0d305acd7a
diff --git a/jjb/charts.yaml b/jjb/charts.yaml
index 5a2d7fc..c72f75b 100644
--- a/jjb/charts.yaml
+++ b/jjb/charts.yaml
@@ -52,6 +52,8 @@
           #!/usr/bin/env bash
           set -eu -o pipefail
 
+          echo "git version: $(git --version)"
+
           # Configure git
           git config --global user.email "do-not-reply@opencord.org"
           git config --global user.name "Jenkins"
@@ -74,12 +76,20 @@
           # Tag and push to git the charts repo
           pushd cord-charts-repo
 
+            # only update if charts are changed
+            set +e
+            if git diff --exit-code index.yaml > /dev/null; then
+              echo "No changes to charts in patchset $GERRIT_CHANGE_NUMBER on project: $GERRIT_PROJECT, exiting."
+              exit 0
+            fi
+            set -e
+
             # version tag is the current date in RFC3339 format
             NEW_VERSION=$(date -u +%Y%m%dT%H%M%SZ)
 
             # Add changes and create commit
             git add -A
-            git commit -m "Changes created by CORD Jenkins publish-helm-repo job: $BUILD_NUMBER, for Gerrit patchset: $GERRIT_CHANGE_NUMBER"
+            git commit -m "Changed by CORD Jenkins publish-helm-repo job: $BUILD_NUMBER, for project: $GERRIT_PROJECT, patchset: $GERRIT_CHANGE_NUMBER"
 
             # create tag on new commit
             git tag "$NEW_VERSION"
@@ -88,7 +98,8 @@
             git tag -n
 
             # push new commit and tag back into repo
-            git push --follow-tags origin
+            git push origin
+            git push origin "$NEW_VERSION"
           popd
 
           # Set up the ssh host keys for the docs host