Skip to content

Commit edbc8d6

Browse files
Merge branch 'master' into improve-conn-log
2 parents ccb7654 + c681c54 commit edbc8d6

File tree

364 files changed

+33457
-6863
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

364 files changed

+33457
-6863
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Related issue: https://github.com/github/gh-ost/issues/0123456789
1111
1212
### Description
1313

14-
This PR [briefly explain what is does]
14+
This PR [briefly explain what it does]
1515

1616
> In case this PR introduced Go code changes:
1717

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Set up Go 1.15
14+
uses: actions/setup-go@v1
15+
with:
16+
go-version: 1.15
17+
18+
- name: Build
19+
run: script/cibuild
20+
21+
- name: Upload gh-ost binary artifact
22+
uses: actions/upload-artifact@v1
23+
with:
24+
name: gh-ost
25+
path: bin/gh-ost

.github/workflows/replica-tests.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: migration tests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Set up Go 1.14
14+
uses: actions/setup-go@v1
15+
with:
16+
go-version: 1.14
17+
18+
- name: migration tests
19+
run: script/cibuild-gh-ost-replica-tests

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/bin/
33
/libexec/
44
/.vendor/
5+
.idea/

.travis.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

Dockerfile.packaging

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
3+
FROM golang:1.15.6
4+
5+
RUN apt-get update
6+
RUN apt-get install -y ruby ruby-dev rubygems build-essential
7+
RUN gem install --no-ri --no-rdoc fpm
8+
ENV GOPATH=/tmp/go
9+
10+
RUN apt-get install -y curl
11+
RUN apt-get install -y rsync
12+
RUN apt-get install -y gcc
13+
RUN apt-get install -y g++
14+
RUN apt-get install -y bash
15+
RUN apt-get install -y git
16+
RUN apt-get install -y tar
17+
RUN apt-get install -y rpm
18+
19+
RUN mkdir -p $GOPATH/src/github.com/github/gh-ost
20+
WORKDIR $GOPATH/src/github.com/github/gh-ost
21+
COPY . .
22+
RUN bash build.sh

Dockerfile.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.15.6
2+
LABEL maintainer="[email protected]"
3+
4+
RUN apt-get update
5+
RUN apt-get install -y lsb-release
6+
RUN rm -rf /var/lib/apt/lists/*
7+
8+
COPY . /go/src/github.com/github/gh-ost
9+
WORKDIR /go/src/github.com/github/gh-ost
10+
11+
CMD ["script/test"]

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Also see:
6565
- [the fine print](doc/the-fine-print.md)
6666
- [Community questions](https://github.com/github/gh-ost/issues?q=label%3Aquestion)
6767
- [Using `gh-ost` on AWS RDS](doc/rds.md)
68+
- [Using `gh-ost` on Azure Database for MySQL](doc/azure.md)
6869

6970
## What's in a name?
7071

@@ -94,7 +95,7 @@ Please see [Coding gh-ost](doc/coding-ghost.md) for a guide to getting started d
9495

9596
[Download latest release here](https://github.com/github/gh-ost/releases/latest)
9697

97-
`gh-ost` is a Go project; it is built with Go `1.8` (though `1.7` should work as well). To build on your own, use either:
98+
`gh-ost` is a Go project; it is built with Go `1.14` and above. To build on your own, use either:
9899
- [script/build](https://github.com/github/gh-ost/blob/master/script/build) - this is the same build script used by CI hence the authoritative; artifact is `./bin/gh-ost` binary.
99100
- [build.sh](https://github.com/github/gh-ost/blob/master/build.sh) for building `tar.gz` artifacts in `/tmp/gh-ost`
100101

@@ -107,3 +108,6 @@ Generally speaking, `master` branch is stable, but only [releases](https://githu
107108
- [@ggunson](https://github.com/ggunson)
108109
- [@tomkrouper](https://github.com/tomkrouper)
109110
- [@shlomi-noach](https://github.com/shlomi-noach)
111+
- [@jessbreckenridge](https://github.com/jessbreckenridge)
112+
- [@gtowey](https://github.com/gtowey)
113+
- [@timvaillancourt](https://github.com/timvaillancourt)

RELEASE_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.42
1+
1.1.0

build.sh

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,70 @@
22
#
33
#
44

5-
RELEASE_VERSION=$(cat RELEASE_VERSION)
5+
RELEASE_VERSION=
6+
buildpath=
7+
8+
function setuptree() {
9+
b=$( mktemp -d $buildpath/gh-ostXXXXXX ) || return 1
10+
mkdir -p $b/gh-ost
11+
mkdir -p $b/gh-ost/usr/bin
12+
echo $b
13+
}
614

715
function build {
8-
osname=$1
9-
osshort=$2
10-
GOOS=$3
11-
GOARCH=$4
12-
13-
echo "Building ${osname} binary"
14-
export GOOS
15-
export GOARCH
16-
go build -ldflags "$ldflags" -o $buildpath/$target go/cmd/gh-ost/main.go
17-
18-
if [ $? -ne 0 ]; then
19-
echo "Build failed for ${osname}"
20-
exit 1
21-
fi
22-
23-
(cd $buildpath && tar cfz ./gh-ost-binary-${osshort}-${timestamp}.tar.gz $target)
16+
osname=$1
17+
osshort=$2
18+
GOOS=$3
19+
GOARCH=$4
20+
21+
if ! go version | egrep -q 'go(1\.1[456])' ; then
22+
echo "go version must be 1.14 or above"
23+
exit 1
24+
fi
25+
26+
echo "Building ${osname} binary"
27+
export GOOS
28+
export GOARCH
29+
go build -ldflags "$ldflags" -o $buildpath/$target go/cmd/gh-ost/main.go
30+
31+
if [ $? -ne 0 ]; then
32+
echo "Build failed for ${osname}"
33+
exit 1
34+
fi
35+
36+
(cd $buildpath && tar cfz ./gh-ost-binary-${osshort}-${timestamp}.tar.gz $target)
37+
38+
if [ "$GOOS" == "linux" ] ; then
39+
echo "Creating Distro full packages"
40+
builddir=$(setuptree)
41+
cp $buildpath/$target $builddir/gh-ost/usr/bin
42+
cd $buildpath
43+
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'shlomi-noach <[email protected]>' --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t rpm .
44+
fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'shlomi-noach <[email protected]>' --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t deb --deb-no-default-config-files .
45+
fi
2446
}
2547

26-
buildpath=/tmp/gh-ost
27-
target=gh-ost
28-
timestamp=$(date "+%Y%m%d%H%M%S")
29-
ldflags="-X main.AppVersion=${RELEASE_VERSION}"
30-
export GO15VENDOREXPERIMENT=1
48+
main() {
49+
if [ -z "${RELEASE_VERSION}" ] ; then
50+
RELEASE_VERSION=$(git describe --abbrev=0 --tags | tr -d 'v')
51+
fi
52+
if [ -z "${RELEASE_VERSION}" ] ; then
53+
RELEASE_VERSION=$(cat RELEASE_VERSION)
54+
fi
55+
56+
57+
buildpath=/tmp/gh-ost-release
58+
target=gh-ost
59+
timestamp=$(date "+%Y%m%d%H%M%S")
60+
ldflags="-X main.AppVersion=${RELEASE_VERSION}"
3161

32-
mkdir -p ${buildpath}
33-
build macOS osx darwin amd64
34-
build GNU/Linux linux linux amd64
62+
mkdir -p ${buildpath}
63+
rm -rf ${buildpath:?}/*
64+
build GNU/Linux linux linux amd64
65+
# build macOS osx darwin amd64
66+
67+
echo "Binaries found in:"
68+
find $buildpath/gh-ost* -type f -maxdepth 1
69+
}
3570

36-
echo "Binaries found in:"
37-
ls -1 $buildpath/gh-ost-binary*${timestamp}.tar.gz
71+
main "$@"

0 commit comments

Comments
 (0)