Commit 5694d436 authored by MrMan's avatar MrMan
Browse files

Release v0.2.0

parent 96dad9ae
image: registry.gitlab.com/mrman/redis-bootleg-backup/builder:0.1.0
image: registry.gitlab.com/mrman/redis-bootleg-backup/builder:0.2.0
variables:
# Use the cargo target dir that the builder image built to
CARGO_TARGET_DIR: "/app/target"
cache:
paths:
......@@ -8,6 +12,7 @@ stages:
- build+quicktest
- full_test
- image+publish
- extra
build_and_quick_test:
stage: build+quicktest
......@@ -16,15 +21,13 @@ build_and_quick_test:
test_e2e:
stage: full_test
services:
- docker:19.03.8-dind
# only run e2e tests on pre-release branches (ex. "release-v0.2.0")
# only run e2e tests on pre-release branches (ex. "release-vX.X.X")
only:
- /release-v[0-9|\.]+/
script:
- make test-e2e
build_and_publish_image_job:
build_and_publish_image:
stage: image+publish
image: docker
services:
......@@ -34,6 +37,32 @@ build_and_publish_image_job:
except:
- branches
script:
- apk add make musl-dev openssl-dev
- apk add make perl musl-dev openssl-dev
- docker login -u gitlab-ci-token --password $CI_BUILD_TOKEN registry.gitlab.com
- make image publish
# Tag new versions whenever a new version (bumped in a release-vX.X.X branch) is merged in
# The vast majority of the time this step will do nothing
tag_new_version:
stage: extra
image: alpine
only:
- master
script:
- apk add --update gettext make perl git openssh
# Install & setup SSH
- mkdir ~/.ssh && chmod 700 ~/.ssh && touch ~/.ssh/known_hosts
- eval $(ssh-agent -s)
- ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts
# Load CI SSH key
- chmod 700 $CI_DEPLOY_PRIVATE_KEY
- cat $CI_DEPLOY_PRIVATE_KEY
- ssh-add $CI_DEPLOY_PRIVATE_KEY
# Get version, exit early if tag already exists
- export VERSION=v`make get-version`
- export VERSION_TAG_EXISTS=$(git tag | grep $VERSION | wc -l)
- test $VERSION_TAG_EXISTS -eq 1 && exit 0 # exit early if the version tag already exists
# Push new tag
- git remote add gitlab git@gitlab.com:mrman/redis-bootleg-backup.git
- git tag $VERSION
- git push gitlab $VERSION
......@@ -7,11 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.2.0] - 06-24-2020
### Added
- Support for SQLite store ([#3](https://gitlab.com/mrman/redis-bootleg-backup/-/issues/3))
- Support for S3 store ([#10](https://gitlab.com/mrman/redis-bootleg-backup/-/issues/10))
### Changed
- Better binary link and checkum ([commit](https://gitlab.com/mrman/redis-bootleg-backup/-/commit/3194924c83f1085ba5f87bf926f31b15a6614612))
- Use `thiserror` for errors ([#5](https://gitlab.com/mrman/redis-bootleg-backup/-/issues/5))
- Refactor shared testing code ([#12](https://gitlab.com/mrman/redis-bootleg-backup/-/issues/12))
### Fixed
- Deduplicate keys in file listing for errors ([#8](https://gitlab.com/mrman/redis-bootleg-backup/-/issues/8))
## [0.1.0] - 06-06-2020
......@@ -20,5 +28,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add support for folder based backups ([#1](https://gitlab.com/mrman/redis-bootleg-backup/-/issues/1))
- Add `CHANGELOG.md`
[unreleased]: https://gitlab.com/mrman/redis-bootleg-backup/-/compare/v0.1.0...master
[unreleased]: https://gitlab.com/mrman/redis-bootleg-backup/-/compare/v0.2.0...master
[0.2.0]: https://github.com/olivierlacan/keep-a-changelog/releases/tag/v0.2.0
[0.1.0]: https://github.com/olivierlacan/keep-a-changelog/releases/tag/v0.1.0
......@@ -1220,7 +1220,7 @@ dependencies = [
[[package]]
name = "redis-bootleg-backup"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"env_logger",
"fs_extra",
......
[package]
name = "redis-bootleg-backup"
version = "0.1.0"
version = "0.2.0"
description = "A CLI tool for taking redis backups the wrong way (enumerating the keyspace)"
documentation = "https://gitlab.com/mrman/redis-bootleg-backup"
repository = "https://gitlab.com/mrman/redis-bootleg-backup/"
......
......@@ -28,7 +28,8 @@ GIT ?= $(shell command -v git 2> /dev/null)
RELEASES_DIR ?= releases
RELEASE_BINARY_NAME ?= rbb
RELEASE_BUILT_BIN_PATH = target/$(BUILD_TARGET)/release/$(PROJECT_NAME)
CARGO_TARGET_DIR ?= target
RELEASE_BUILT_BIN_PATH = $(CARGO_TARGET_DIR)/$(BUILD_TARGET)/release/$(PROJECT_NAME)
check-tool-cargo:
ifndef CARGO
......
......@@ -90,7 +90,7 @@ RBB_SQLITE_BASE_DIR=/path/to/backup/area rbb --store-type sqlite-v1 restore --na
You can run `rbb --help` to read about the options the
```shell
redis-bootleg-backup 0.1.0
redis-bootleg-backup 0.2.0
Subcommands for structopt
USAGE:
......@@ -115,13 +115,13 @@ To see the options available for `backup` and `restore` subcommands, use `--help
# Installation #
1. Download [the current (v0.1.0) `rbb` binary](https://gitlab.com/mrman/redis-bootleg-backup/-/raw/v0.1.0/releases/rbb?inline=false) (only supported on linux)
2. Validate the binary against the [SHA1 checksum](https://gitlab.com/mrman/redis-bootleg-backup/-/raw/v0.1.0/releases/rbb.sha1sum?inline=false) and/or [SHA256 checksum](https://gitlab.com/mrman/redis-bootleg-backup/-/raw/v0.1.0/releases/rbb.sha256sum?inline=false)
1. Download [the current (v0.2.0) `rbb` binary](https://gitlab.com/mrman/redis-bootleg-backup/-/raw/v0.2.0/releases/rbb?inline=false) (only supported on linux)
2. Validate the binary against the [SHA1 checksum](https://gitlab.com/mrman/redis-bootleg-backup/-/raw/v0.2.0/releases/rbb.sha1sum?inline=false) and/or [SHA256 checksum](https://gitlab.com/mrman/redis-bootleg-backup/-/raw/v0.2.0/releases/rbb.sha256sum?inline=false)
3. Run the `rbb` binary
## Docker ##
You can also run the dockerized CLI by using the `registry.gitlab.com/mrman/redis-bootleg-backup/cli:0.1.0` image.
You can also run the dockerized CLI by using the `registry.gitlab.com/mrman/redis-bootleg-backup/cli:0.2.0` image.
# Extending `redis-bootleg-backup`: noteworthy upcoming features #
......
FROM registry.gitlab.com/mrman/redis-bootleg-backup/builder:0.1.0 as builder
FROM registry.gitlab.com/mrman/redis-bootleg-backup/builder:0.2.0 as builder
# Overwrite code in the base builder image
COPY . /app
......
No preview for this file type
......@@ -73,7 +73,10 @@ impl CanBackup for DirectExecutor {
let mut conn = self.get_connection()
.map_err(|e| BackupError::ExecutorError(e))?;
debug!("[executors/direct-v1] all keys from redis connection...");
let msg = "[executors/direct-v1] retrieving keys...";
debug!("{}", msg);
println!("{}", msg);
let keys = conn.keys::<RedisKey, Vec<RedisKey>>(String::from("*"))
.map_err(|e| BackupError::UnexpectedError(format!("KEYS * command failed: {}",e.to_string())))?
.into_iter();
......@@ -94,7 +97,9 @@ impl CanBackup for DirectExecutor {
info!("[executors/direct-v1] backing up keys from redis instance...");
let mut count = 0;
while let Some(k) = keys.as_mut().next() {
debug!("[executors/direct-v1] writing key [{}]...", &k);
let msg = format!("[executors/direct-v1] writing key [{}]...", &k);
println!("{}", msg);
debug!("{}", msg);
let value = conn.get(k.as_str())
.map_err(|e| BackupError::KeyBackupFailed(
String::from(k.as_str()),
......
......@@ -400,7 +400,7 @@ impl Backup for SQLiteStoreBackup {
fn get_value(&self, key: RedisKey) -> Result<RedisBinaryValue, BackupError> {
let conn = self.connect()?;
debug!("retreiving keys from backup...");
debug!("retreiving value from backup...");
conn.query_row(
"SELECT value FROM kv WHERE key = ?",
......
use std::env;
use std::fs;
use std::thread;
use std::time;
use std::io::{BufReader, BufRead};
use std::path::PathBuf;
use std::process::{Command, Child, Stdio};
......@@ -21,9 +23,6 @@ const REDIS_IMAGE_NAME: &'static str = "redis";
const REDIS_DEFAULT_PORT: u32 = 6379;
const REDIS_DEFAULT_VERSION :&'static str = "5.0.3"; // shoudl match available binary in CI builder image
/// Path to the built release binary
pub const RELEASE_BIN_PATH: &'static str = "target/x86_64-unknown-linux-musl/debug/redis-bootleg-backup";
/// Helper for creating a store with a temporary test folder
#[allow(dead_code)]
pub fn make_test_store() -> Result<FolderStore, String> {
......@@ -280,6 +279,9 @@ pub fn start_minio_test_instance(
// Stop waiting if we see the line
if line.contains("Object API (Amazon S3 compatible):") {
// Since there is no exact "ready to serve connections" line,
// add a slight wait to prevent attempting to connect too quickly
thread::sleep(time::Duration::from_millis(500));
break
}
......@@ -446,6 +448,10 @@ pub fn basic_restore_int_test(
Ok(())
}
/// Path to the built release binary
/// NOTE: the binary *must* be built for release (via `make build-release`) before E2E tests are run
pub const RELEASE_BIN_PATH: &'static str = "releases/rbb";
/// Shared test suite that performs a basic backup for an E2E test
/// this test adds a couple keys and makes sure the backup contains them
/// but importantly runs the built binary itself, "from the outside"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment