Skip to content

Commit 81a9538

Browse files
Merge branch 'master' into limitation-encrypted-binlogs
2 parents 48e1281 + 5e953b7 commit 81a9538

File tree

334 files changed

+32763
-6736
lines changed

Some content is hidden

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

334 files changed

+32763
-6736
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.14
14+
uses: actions/setup-go@v1
15+
with:
16+
go-version: 1.14
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 & 29 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.14.7
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.14.7
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Please see [Coding gh-ost](doc/coding-ghost.md) for a guide to getting started d
9494

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

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:
97+
`gh-ost` is a Go project; it is built with Go `1.14` and above. To build on your own, use either:
9898
- [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.
9999
- [build.sh](https://github.com/github/gh-ost/blob/master/build.sh) for building `tar.gz` artifacts in `/tmp/gh-ost`
100100

@@ -109,3 +109,4 @@ Generally speaking, `master` branch is stable, but only [releases](https://githu
109109
- [@shlomi-noach](https://github.com/shlomi-noach)
110110
- [@jessbreckenridge](https://github.com/jessbreckenridge)
111111
- [@gtowey](https://github.com/gtowey)
112+
- [@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.44
1+
1.0.49

build.sh

Lines changed: 57 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +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
16+
osname=$1
17+
osshort=$2
18+
GOOS=$3
19+
GOARCH=$4
1220

13-
if [[ $(go version | egrep "go1[.][012345678]") ]]; then
14-
echo "go version is too low. Must use 1.9 or above"
15-
exit 1
16-
fi
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
1725

18-
echo "Building ${osname} binary"
19-
export GOOS
20-
export GOARCH
21-
go build -ldflags "$ldflags" -o $buildpath/$target go/cmd/gh-ost/main.go
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
2235

23-
if [ $? -ne 0 ]; then
24-
echo "Build failed for ${osname}"
25-
exit 1
26-
fi
36+
(cd $buildpath && tar cfz ./gh-ost-binary-${osshort}-${timestamp}.tar.gz $target)
2737

28-
(cd $buildpath && tar cfz ./gh-ost-binary-${osshort}-${timestamp}.tar.gz $target)
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
2946
}
3047

31-
buildpath=/tmp/gh-ost
32-
target=gh-ost
33-
timestamp=$(date "+%Y%m%d%H%M%S")
34-
ldflags="-X main.AppVersion=${RELEASE_VERSION}"
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
3555

36-
mkdir -p ${buildpath}
37-
build macOS osx darwin amd64
38-
build GNU/Linux linux linux amd64
3956

40-
echo "Binaries found in:"
41-
ls -1 $buildpath/gh-ost-binary*${timestamp}.tar.gz
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}"
61+
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+
}
70+
71+
main "$@"

0 commit comments

Comments
 (0)