forked from Altinity/clickhouse-backup
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EMBEDDED BACKUP/RESTORE works, applied ugly workaround in test to avoid
ClickHouse/ClickHouse#43971, and restore workaround to resolve ClickHouse/ClickHouse#42709
- Loading branch information
Showing
25 changed files
with
4,292 additions
and
4,317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.github | ||
.idea | ||
test | ||
|
||
.github | ||
.idea | ||
test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.