From 671a63aa240983eda4447499da72b18b0d29ae82 Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Mon, 12 Aug 2019 19:10:05 -0700 Subject: [PATCH] travis: generate repository snapshot for long-term storage This is triggered for tagged releases and will be used later for long-term repository compatibility testing. --- .gitignore | 1 + .travis.yml | 2 +- Makefile | 25 +++++++++++++++++++++ tests/compat_test/gen-compat-repo.sh | 33 ++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100755 tests/compat_test/gen-compat-repo.sh diff --git a/.gitignore b/.gitignore index 738805ac8..723163a3b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store .release/ .releases/ +compat-test/ playground/ kopia-*.tar.gz kopia-*.zip diff --git a/.travis.yml b/.travis.yml index 638233d6d..26f54a4b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ install: make travis-setup script: make travis-release deploy: - provider: script - script: curl -sL https://git.io/goreleaser | bash /dev/stdin --rm-dist + script: make tagged-release skip_cleanup: true on: tags: true diff --git a/Makefile b/Makefile index 972ef138b..e2b5b4b46 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,11 @@ travis-release: test-with-coverage lint vet verify-release integration-tests upl verify-release: curl -sL https://git.io/goreleaser | bash /dev/stdin --skip-publish --skip-sign --rm-dist --snapshot +tagged-release: + curl -sL https://git.io/goreleaser | bash /dev/stdin --rm-dist + # this is a no-op for PRs and non-tagged releses + $(MAKE) travis-create-long-term-repository + ifeq ($(TRAVIS_PULL_REQUEST),false) upload-coverage: $(GOVERALLS_TOOL) @@ -131,6 +136,10 @@ travis-install-test-credentials: openssl aes-256-cbc -K "$(encrypted_fa1db4b894bb_key)" -iv "$(encrypted_fa1db4b894bb_iv)" -in tests/credentials/sftp/id_kopia.enc -out repo/blob/sftp/id_kopia -d openssl aes-256-cbc -K "$(encrypted_fa1db4b894bb_key)" -iv "$(encrypted_fa1db4b894bb_iv)" -in tests/credentials/sftp/known_hosts.enc -out repo/blob/sftp/known_hosts -d +travis-install-cloud-sdk: travis-install-test-credentials + if [ ! -d $(HOME)/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash; fi + $(HOME)/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file repo/blob/gcs/test_service_account.json + else travis-install-gpg-key: @@ -139,4 +148,20 @@ travis-install-gpg-key: travis-install-test-credentials: @echo Not installing test credentials. +travis-install-cloud-sdk: + @echo Not installing Cloud SDK. + +endif + +ifneq ($(TRAVIS_TAG),) + +travis-create-long-term-repository: dist-binary travis-install-cloud-sdk + echo Creating long-term repository $(TRAVIS_TAG)... + KOPIA_EXE=$(CURDIR)/dist/integration/kopia ./tests/compat_test/gen-compat-repo.sh + +else + +travis-create-long-term-repository: + echo Not creating long-term repository. + endif \ No newline at end of file diff --git a/tests/compat_test/gen-compat-repo.sh b/tests/compat_test/gen-compat-repo.sh new file mode 100755 index 000000000..a549a0016 --- /dev/null +++ b/tests/compat_test/gen-compat-repo.sh @@ -0,0 +1,33 @@ +#!/bin/sh +set -e +if [[ $TRAVIS_TAG == "" ]]; then + echo TRAVIS_TAG must be set. + exit 0 +fi + +if [[ $KOPIA_EXE == "" ]]; then + echo KOPIA_EXE must be set. + exit 0 +fi + +OUTPUT_DIR="compat-test/$TRAVIS_TAG" +rm -rf "$OUTPUT_DIR" + +mkdir -pv "$OUTPUT_DIR" +TMP_DIR=$(mktemp -d) +mkdir -pv $TMP_DIR/{config,repo} +export KOPIA_PASSWORD=long-term-test +KOPIA_ARGS="--analytics-consent=disagree --config-file=$TMP_DIR/config/kopia.config" +$KOPIA_EXE $KOPIA_ARGS repository create filesystem --path "$TMP_DIR/repo" + +$KOPIA_EXE $KOPIA_ARGS snap create repo +$KOPIA_EXE $KOPIA_ARGS snap create cli +$KOPIA_EXE $KOPIA_ARGS snap create site + +$KOPIA_EXE $KOPIA_ARGS snap create repo +$KOPIA_EXE $KOPIA_ARGS snap create cli +$KOPIA_EXE $KOPIA_ARGS snap create site +(cd $TMP_DIR && tar cf - "repo/") > "$OUTPUT_DIR/repo.tar" +cp dist/*.tar.gz "$OUTPUT_DIR" +rm -rf "$TMP_DIR" +gsutil cp -rv $OUTPUT_DIR gs://kopia-compat-test/ \ No newline at end of file