Skip to content

Commit

Permalink
EMBEDDED BACKUP/RESTORE works, applied ugly workaround in test to avoid
Browse files Browse the repository at this point in the history
ClickHouse/ClickHouse#43971, and restore workaround to resolve ClickHouse/ClickHouse#42709
  • Loading branch information
Slach committed Jun 20, 2023
1 parent 526f7c6 commit 9450c94
Show file tree
Hide file tree
Showing 25 changed files with 4,292 additions and 4,317 deletions.
8 changes: 4 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.github
.idea
test

.github
.idea
test

262 changes: 131 additions & 131 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,131 +1,131 @@
name: Release

on:
push:
tags:
- v*.*.*

jobs:
release:
name: Release
runs-on: ubuntu-22.04
strategy:
matrix:
golang-version:
- "1.20"

steps:
- name: Checkout project
uses: actions/checkout@v3

- name: Setup golang
id: setup-go
uses: actions/setup-go@v3
with:
go-version: '^${{ matrix.golang-version }}'

- name: Setup fpm and make
run: |
sudo apt-get install -y --no-install-recommends ruby ruby-dev gcc g++ rpm
sudo apt-get install --no-install-recommends -y make
sudo gem install --no-document fpm
- name: Cache golang
id: cache-golang
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: clickhouse-backup-golang-${{ matrix.golang-version }}-${{ hashFiles('go.mod', '.github/workflows/*.yaml') }}

- name: Install golang dependencies
run: go mod download -x
if: |
steps.cache-golang.outputs.cache-hit != 'true'
- name: Extract DOCKER_TAG version
id: docker_tag
run: |
DOCKER_TAG=${GITHUB_REF##*/}
DOCKER_TAG=${DOCKER_TAG##*\\}
export DOCKER_TAG=${DOCKER_TAG#v}
echo "docker_tag=${DOCKER_TAG:-dev}" >> $GITHUB_OUTPUT
- name: Prepare binaries
id: make
env:
GOROOT: ${{ env.GOROOT_1_19_X64 }}
run: |
make build config test
- name: Building deb, rpm and tar.gz packages
id: make_packages
run: |
set -x
export NAME=clickhouse-backup
export VERSION=$(git describe --always --tags --abbrev=0 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/c\1/;s/-/./g')
tar -czvf ${NAME}-linux-amd64.tar.gz build/linux/amd64
tar -czvf ${NAME}-linux-arm64.tar.gz build/linux/arm64
tar -czvf ${NAME}-darwin-amd64.tar.gz build/darwin/amd64
tar -czvf ${NAME}-darwin-arm64.tar.gz build/darwin/arm64
echo "tgz_linux_amd64=${NAME}-linux-amd64.tar.gz" >> $GITHUB_OUTPUT
echo "tgz_linux_arm64=${NAME}-linux-arm64.tar.gz" >> $GITHUB_OUTPUT
echo "tgz_darwin_amd64=${NAME}-darwin-amd64.tar.gz" >> $GITHUB_OUTPUT
echo "tgz_darwin_arm64=${NAME}-darwin-arm64.tar.gz" >> $GITHUB_OUTPUT
make packages
cp -lv ./build/linux/*/*.deb ./
cp -lv ./build/linux/*/*.rpm ./
echo "rpm_amd64=${NAME}-${VERSION}-1.x86_64.rpm" >> $GITHUB_OUTPUT
echo "deb_amd64=${NAME}_${VERSION}_amd64.deb" >> $GITHUB_OUTPUT
echo "rpm_arm64=${NAME}-${VERSION}-1.aarch64.rpm" >> $GITHUB_OUTPUT
echo "deb_arm64=${NAME}_${VERSION}_arm64.deb" >> $GITHUB_OUTPUT
- name: Prepare release notes
id: release_notes
run: |
awk '/^# / {s++} s == 1 {print}' ChangeLog.md > /tmp/release_notes.md
echo "path=/tmp/release_notes.md" >> $GITHUB_OUTPUT
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: v${{ steps.docker_tag.outputs.docker_tag }}
name: ${{ steps.docker_tag.outputs.docker_tag }}
body_path: ${{ steps.release_notes.outputs.path }}
draft: true
fail_on_unmatched_files: true
files: |
${{ steps.make_packages.outputs.rpm_amd64 }}
${{ steps.make_packages.outputs.rpm_arm64 }}
${{ steps.make_packages.outputs.deb_amd64 }}
${{ steps.make_packages.outputs.deb_arm64 }}
${{ steps.make_packages.outputs.tgz_linux_amd64 }}
${{ steps.make_packages.outputs.tgz_linux_arm64 }}
${{ steps.make_packages.outputs.tgz_darwin_amd64 }}
${{ steps.make_packages.outputs.tgz_darwin_arm64 }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Building docker image
env:
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
DOCKER_TAG: ${{ steps.docker_tag.outputs.docker_tag }}
run: |
export DOCKER_REGISTRY=${DOCKER_REGISTRY:-docker.io}
echo ${DOCKER_TOKEN} | docker login -u ${DOCKER_USER} --password-stdin ${DOCKER_REGISTRY}
docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG} --tag ${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:latest --target=image_short --pull --push .
docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}-full:${DOCKER_TAG} --tag ${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}-full:latest --target=image_full --pull --push .
name: Release

on:
push:
tags:
- v*.*.*

jobs:
release:
name: Release
runs-on: ubuntu-22.04
strategy:
matrix:
golang-version:
- "1.20"

steps:
- name: Checkout project
uses: actions/checkout@v3

- name: Setup golang
id: setup-go
uses: actions/setup-go@v3
with:
go-version: '^${{ matrix.golang-version }}'

- name: Setup fpm and make
run: |
sudo apt-get install -y --no-install-recommends ruby ruby-dev gcc g++ rpm
sudo apt-get install --no-install-recommends -y make
sudo gem install --no-document fpm
- name: Cache golang
id: cache-golang
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: clickhouse-backup-golang-${{ matrix.golang-version }}-${{ hashFiles('go.mod', '.github/workflows/*.yaml') }}

- name: Install golang dependencies
run: go mod download -x
if: |
steps.cache-golang.outputs.cache-hit != 'true'
- name: Extract DOCKER_TAG version
id: docker_tag
run: |
DOCKER_TAG=${GITHUB_REF##*/}
DOCKER_TAG=${DOCKER_TAG##*\\}
export DOCKER_TAG=${DOCKER_TAG#v}
echo "docker_tag=${DOCKER_TAG:-dev}" >> $GITHUB_OUTPUT
- name: Prepare binaries
id: make
env:
GOROOT: ${{ env.GOROOT_1_19_X64 }}
run: |
make build config test
- name: Building deb, rpm and tar.gz packages
id: make_packages
run: |
set -x
export NAME=clickhouse-backup
export VERSION=$(git describe --always --tags --abbrev=0 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/c\1/;s/-/./g')
tar -czvf ${NAME}-linux-amd64.tar.gz build/linux/amd64
tar -czvf ${NAME}-linux-arm64.tar.gz build/linux/arm64
tar -czvf ${NAME}-darwin-amd64.tar.gz build/darwin/amd64
tar -czvf ${NAME}-darwin-arm64.tar.gz build/darwin/arm64
echo "tgz_linux_amd64=${NAME}-linux-amd64.tar.gz" >> $GITHUB_OUTPUT
echo "tgz_linux_arm64=${NAME}-linux-arm64.tar.gz" >> $GITHUB_OUTPUT
echo "tgz_darwin_amd64=${NAME}-darwin-amd64.tar.gz" >> $GITHUB_OUTPUT
echo "tgz_darwin_arm64=${NAME}-darwin-arm64.tar.gz" >> $GITHUB_OUTPUT
make packages
cp -lv ./build/linux/*/*.deb ./
cp -lv ./build/linux/*/*.rpm ./
echo "rpm_amd64=${NAME}-${VERSION}-1.x86_64.rpm" >> $GITHUB_OUTPUT
echo "deb_amd64=${NAME}_${VERSION}_amd64.deb" >> $GITHUB_OUTPUT
echo "rpm_arm64=${NAME}-${VERSION}-1.aarch64.rpm" >> $GITHUB_OUTPUT
echo "deb_arm64=${NAME}_${VERSION}_arm64.deb" >> $GITHUB_OUTPUT
- name: Prepare release notes
id: release_notes
run: |
awk '/^# / {s++} s == 1 {print}' ChangeLog.md > /tmp/release_notes.md
echo "path=/tmp/release_notes.md" >> $GITHUB_OUTPUT
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: v${{ steps.docker_tag.outputs.docker_tag }}
name: ${{ steps.docker_tag.outputs.docker_tag }}
body_path: ${{ steps.release_notes.outputs.path }}
draft: true
fail_on_unmatched_files: true
files: |
${{ steps.make_packages.outputs.rpm_amd64 }}
${{ steps.make_packages.outputs.rpm_arm64 }}
${{ steps.make_packages.outputs.deb_amd64 }}
${{ steps.make_packages.outputs.deb_arm64 }}
${{ steps.make_packages.outputs.tgz_linux_amd64 }}
${{ steps.make_packages.outputs.tgz_linux_arm64 }}
${{ steps.make_packages.outputs.tgz_darwin_amd64 }}
${{ steps.make_packages.outputs.tgz_darwin_arm64 }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Building docker image
env:
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
DOCKER_TAG: ${{ steps.docker_tag.outputs.docker_tag }}
run: |
export DOCKER_REGISTRY=${DOCKER_REGISTRY:-docker.io}
echo ${DOCKER_TOKEN} | docker login -u ${DOCKER_USER} --password-stdin ${DOCKER_REGISTRY}
docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:${DOCKER_TAG} --tag ${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}:latest --target=image_short --pull --push .
docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --tag=${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}-full:${DOCKER_TAG} --tag ${DOCKER_REGISTRY}/${DOCKER_REPO}/${DOCKER_IMAGE}-full:latest --target=image_full --pull --push .
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ require (
golang.org/x/mod v0.8.0
golang.org/x/sync v0.3.0
google.golang.org/api v0.127.0
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc
gopkg.in/cheggaaa/pb.v1 v1.0.28
gopkg.in/yaml.v3 v3.0.1
)
Expand All @@ -51,7 +50,6 @@ require (
cloud.google.com/go/compute v1.20.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.0 // indirect
cloud.google.com/go/longrunning v0.4.2 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
Expand Down Expand Up @@ -124,6 +122,7 @@ require (
golang.org/x/text v0.10.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/grpc v1.55.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2Aawl
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/iam v1.1.0 h1:67gSqaPukx7O8WLLHMa0PNs3EBGd2eE4d+psbO/CO94=
cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5gVyk=
cloud.google.com/go/longrunning v0.4.2 h1:WDKiiNXFTaQ6qz/G8FCOkuY9kJmOJGY67wPUC1M2RbE=
cloud.google.com/go/longrunning v0.4.2/go.mod h1:OHrnaYyLUV6oqwh0xiS7e5sLQhP1m0QU9R+WhGDMgIQ=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
Expand Down
Loading

0 comments on commit 9450c94

Please sign in to comment.