Skip to content

Instantly share code, notes, and snippets.

@svet-b
Last active September 1, 2018 23:21
Show Gist options
  • Save svet-b/8912a3d7be3b013f5629e1268b652673 to your computer and use it in GitHub Desktop.
Save svet-b/8912a3d7be3b013f5629e1268b652673 to your computer and use it in GitHub Desktop.
Setting up Grafana environment
#!/bin/bash
export CODEDIR="/opt/codebase"
export DEVGROUP="devs"
export GH_ORIG="github.com/grafana"
export GH_FORK="github.com/ammpio"
export REPONAME="grafana"
export GOROOT=/usr/local/go
export GOPATH=$CODEDIR
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
# If code directory doesn't exist, create it
if [!-d $CODEDIR]; then
mkdir -p $CODEDIR;
fi;
# Get code from repo. The -d flags make go stop after download.
go get -v -d $GH_FORK/$REPONAME
cd $CODEDIR/$GH_FORK/$REPONAME
## First-time setup:
# Add remote for upstream repo
git remote add upstream https://github.com/grafana/grafana
# In order to be able to push to the fork:
git remote set-url origin git@github.com:ammpio/grafana.git
# Fetch upstream and merge changes into forked master
git fetch upstream
git checkout master
# Merge a particular tagged commit
git merge v5.2.0
# Or merge the upstream master
git merge upstream/master
# Push to fork
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment