Skip to content

Commit

Permalink
build/merge.bash: script to help sync nightly with upstream
Browse files Browse the repository at this point in the history
Change-Id: Iae9ee80b9fbbb64cc86b432487613334cf1fb72b
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/225097
Reviewed-by: Rebecca Stambler <[email protected]>
  • Loading branch information
hyangah committed Mar 24, 2020
1 parent 67fde72 commit 9af87f1
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions build/merge.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#! /bin/bash
set -euo pipefail

# In order to sync with upstream, run merge.bash

# TODO(hyangah): commands for building docker container and running tests locally with docker run.
root_dir() {
local script_name=$(readlink -f "${0}")
local script_dir=$(dirname "${script_name}")
local parent_dir=$(dirname "${script_dir}")
echo "${parent_dir}"
}

ROOT="$(root_dir)"
cd "${ROOT}" # always run from the root directory.

WORKTREE="$(mktemp -d)"
BRANCH="sync/merge-upstream-$(date +%Y%m%d%H%M%S)"

git fetch
git worktree add --track -b "${BRANCH}" "${WORKTREE}" origin/master

cd "${WORKTREE}"
export GIT_GOFMT_HOOK=off
git merge --no-commit "origin/upstream" || echo "Ignoring conflict..."

COMMIT=`git log --format=%h -n 1 "origin/upstream"`

gcloud builds submit --config=build/cloud.yaml || echo "Build failed. Please address the issue..."

git commit -m "sync: merge microsoft/vscode-go@${COMMIT} into master"

git codereview mail -r [email protected],[email protected] HEAD
cd - && git worktree remove "${WORKTREE}"

0 comments on commit 9af87f1

Please sign in to comment.