Yuvipanda has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/188019

Change subject: puppetmaster: Throw away all local uncommited changes
......................................................................

puppetmaster: Throw away all local uncommited changes

Because it is a terrible thing. Do not do that. Put it on
gerrit and then cherry-pick it. Or make a local commit.

Change-Id: I8fbb882b89bade49b113b9b448e3b17b7dd8ad57
---
M modules/puppetmaster/templates/git-sync-upstream.erb
1 file changed, 6 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/19/188019/1

diff --git a/modules/puppetmaster/templates/git-sync-upstream.erb 
b/modules/puppetmaster/templates/git-sync-upstream.erb
index 27bcaef..af83417 100755
--- a/modules/puppetmaster/templates/git-sync-upstream.erb
+++ b/modules/puppetmaster/templates/git-sync-upstream.erb
@@ -21,41 +21,27 @@
 )
 HAVE_STASH=0
 
-# Create a temp file for capturing command output
-TEMPFILE="$(mktemp -t gsu.XXXXXX)"
-trap '{ rm -f "$TEMPFILE"; }' EXIT
-
 cd ${REPO}
 
 # Fetch new changes from origin
 git fetch --verbose origin
 
-# Hide any dirty local files
-git stash save "rebase $(date +%Y-%m-%dT%H:%M)" 2>&1 |
-tee "${TEMPFILE}"
-
-if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
-    echo "Failed to save local changes; cowardly refusing to continue" 1>&2
-    exit 1
-fi
-
-grep -q "No local changes" "${TEMPFILE}" || HAVE_STASH=1
+# Kill all local uncommited changes.
+# Local hacking on a puppetmaster is bad. Do not do that.
+git reset --hard
 
 # Rebase locally commited changes on top of tracked origin branch
-git rebase "${REBASE_OPTS[@]}" origin/${TRACK_BRANCH} 2>&1 |
-tee "${TEMPFILE}"
+git rebase "${REBASE_OPTS[@]}" origin/${TRACK_BRANCH}
 
-if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
+if [[ $? -ne 0 ]]; then
     echo "Rebase failed! See error messages above." 1>&2
     echo "Reverting rebase attempt" 1>&2
     git rebase --abort
-    [[ ${HAVE_STASH} -ne 0 ]] && git stash pop
     exit 2
 fi
 
 # Ensure that submodule changes are applied to the local checkout
-git submodule update --init --recursive 2>&1 |
-tee "${TEMPFILE}"
+git submodule update --init --recursive
 
 # Tag the local repo state for rollback and troubleshooting
 TAG="beta-$(date +%Y%m%dT%H%M)"
@@ -72,6 +58,3 @@
 CHERRY_PICKED_COUNT=`git log --pretty=oneline --abbrev-commit 
origin/HEAD..HEAD | wc -l`
 echo -n 
"$STATS_PREFIX.puppetmaster.cherrypicked_commits:$CHERRY_PICKED_COUNT|g" |
     nc -w 1 -u <%= @statsd_host %> 8125
-
-# Restore dirty files if present
-[[ ${HAVE_STASH} -ne 0 ]] && git stash pop

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8fbb882b89bade49b113b9b448e3b17b7dd8ad57
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to