試nonroot #17
Draft
試nonroot #17
Travis CI / Travis CI - Pull Request
cancelled
Jul 4, 2025 in 9m 8s
Build Canceled
The build canceled. This is a change from the previous build, which failed.
Details
This is a pull request build.
It is running a build against the merge commit, after merging #17 試nonroot.
Any changes that have been made to the main branch before the build ran are also included.
Jobs and Stages
This build has 21 jobs, running in parallel.
Build Configuration
| Build Option | Setting |
|---|---|
| Language | Python |
| Operating System | Linux (Jammy) |
| Python Version | 3.10 |
Build Configuration
{
"language": "python",
"os": [
"linux"
],
"dist": "jammy",
"services": [
"docker"
],
"python": [
"3.10"
],
"env": [
"global={:BUCKET_NAME=>\"backup-bucket\"}={:AWS_ACCESS_KEY_ID=>\"test\"}={:AWS_SECRET_ACCESS_KEY=>\"test\"}"
],
"branches": {
"only": [
"main"
]
},
"before_install": [
"pip install --upgrade pip setuptools"
],
"jobs": {
"include": [
{
"name": "Check YAML format",
"install": [
"pip install tox"
],
"script": [
"tox -e yamllint"
]
},
{
"name": "Check Markdown Format",
"install": [
"pip install tox"
],
"script": [
"tox -e pymarkdown"
]
},
{
"name": "Check Gherkin format",
"language": "node_js",
"node_js": "22",
"before_install": [
"skip"
],
"install": [
"npm install gherkin-lint"
],
"script": [
"npx gherkin-lint"
]
},
{
"name": "Check Python Format",
"install": [
"pip install tox"
],
"script": [
"tox -e flake8"
]
},
{
"name": "Check Bash format",
"install": [
"pip install tox"
],
"script": [
"tox -e shellcheck"
]
},
{
"name": "backup once",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"script": [
"docker compose --file tests/docker-compose-backup.yml up --detach --quiet-pull",
"DATE=`date \"+%Y-%m-%d\"`",
"TIME=`date \"+%Y%m%dT%H%M\"`",
"sleep 10",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"postgres15-postgres-1/${DATE}/postgres15-postgres-1_${TIME}.sql.gz\" postgres15.sql.gz",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\""
]
},
{
"name": "starting message",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"script": [
"docker compose --file tests/docker-compose-backup.yml run --rm backup 2>&1 | tee backup.log",
"cat backup.log | grep 'multiple-databases-backup is starting.'",
"cat backup.log | grep 'multiple-databases-backup is finished, exiting.'",
"cat backup.log"
]
},
{
"name": "crontab",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-minute.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"script": [
"docker compose --file tests/docker-compose-backup-minute.yml up --detach --quiet-pull",
"sleep 1m",
"DATE=`date \"+%Y-%m-%d\"`",
"TIME=`date \"+%Y%m%dT%H%M\"`",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"postgres15-postgres-1/${DATE}/postgres15-postgres-1_${TIME}.sql.gz\" postgres15.sql.gz",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\"",
"sleep 1m",
"DATE=`date \"+%Y-%m-%d\"`",
"TIME=`date \"+%Y%m%dT%H%M\"`",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"postgres15-postgres-1/${DATE}/postgres15-postgres-1_${TIME}.sql.gz\" postgres15.sql.gz",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\"",
"docker compose --file tests/docker-compose-backup-minute.yml exec backup cat /var/log/cron.log",
"docker compose --file tests/docker-compose-backup-minute.yml exec backup cat /var/log/cron.error.log"
]
},
{
"name": "backup once when erasing the SCHEDULE variable",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-minute.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"script": [
"docker compose --file tests/docker-compose-backup-minute.yml run --rm -e SCHEDULE= backup 2>&1 | tee backup.log",
"cat backup.log | grep 'There is not SCHEDULE variable'"
]
},
{
"name": "exit with SCHEDULE wrong format",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-minute.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"script": [
"(docker compose --file tests/docker-compose-backup-minute.yml run --rm -e SCHEDULE=\"0 * *\" backup > backup.log 2>&1) || (echo \"The exit code is $?.\" | tee error.log)",
"cat backup.log",
"cat backup.log | grep 'The SCHEDULE variable should contain five fields exactly.'",
"cat error.log | grep 'The exit code is 1.'"
]
},
{
"name": "GPG encrypt with asymmetric key",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"env": [
{
"GPG_PRIVATE_KEY_PATH": "tests/gpg-key/ithuan.tw.asc"
},
{
"GPG_PRIVATE_KEY_PASSPHRASE_PATH": "tests/gpg-key/ithuan.tw.passphrase"
}
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-encrypt.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"script": [
"gpg --import --batch ${GPG_PRIVATE_KEY_PATH}",
"GPG_PUBLIC_KEY=`gpg --armor --export ithuan+multiple-databases-backup@ithuan.tw | base64 --wrap 0`",
"echo \"GPG_PUBLIC_KEY=${GPG_PUBLIC_KEY}\" | tee tests/.env",
"DATE=`date \"+%Y-%m-%d\"`",
"TIME=`date \"+%Y%m%dT%H%M\"`",
"docker compose --file tests/docker-compose-backup-encrypt.yml run --rm backup",
"sleep 10",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"postgres15-postgres-1/${DATE}/postgres15-postgres-1_${TIME}.sql.gz.gpg\" postgres15.sql.gz.gpg",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\"",
"gpg --decrypt --batch --pinentry-mode loopback --passphrase-file ${GPG_PRIVATE_KEY_PASSPHRASE_PATH} postgres15.sql.gz.gpg | zcat"
]
},
{
"name": "backup strategy for keeping backup in 72 hours(3 days)",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-strategy.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"before_script": [
"TARGET_TIME=`date \"+%Y-%m-%d %H:%M\" --date '3 days ago'`",
"DATE=`date \"+%Y-%m-%d\" --date \"${TARGET_TIME}\"`",
"TIME=`date \"+%Y%m%dT%H%M\" --date \"${TARGET_TIME}\"`",
"OLD_BACKUP=\"postgres15-postgres-1/${DATE}/postgres15-postgres-1_${TIME}.sql.gz\""
],
"script": [
"echo '# SQL' | gzip > test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" --body test.sql.gz",
"docker compose --file tests/docker-compose-backup-strategy.yml run --rm backup",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" postgres15.sql.gz",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\""
]
},
{
"name": "backup strategy for deleting backup exceeding 72 hours(3 days)",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-strategy.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"before_script": [
"TARGET_TIME=`date \"+%Y-%m-%d %H:%M\" --date '3 days ago 1 hour ago'`",
"DATE=`date \"+%Y-%m-%d\" --date \"${TARGET_TIME}\"`",
"TIME=`date \"+%Y%m%dT%H%M\" --date \"${TARGET_TIME}\"`",
"OLD_BACKUP=\"postgres15-postgres-1/${DATE}/postgres15-postgres-1_${TIME}.sql.gz\"",
"DAY_TARGET_TIME=`date \"+%Y-%m-%d\" --date \"${TARGET_TIME}\"`",
"DAY_DATE=`date \"+%Y-%m-%d\" --date \"${DAY_TARGET_TIME}\"`",
"DAY_TIME=`date \"+%Y%m%dT%H%M\" --date \"${DAY_TARGET_TIME}\"`",
"DAY_BACKUP=\"postgres15-postgres-1/${DAY_DATE}/postgres15-postgres-1_${DAY_TIME}.sql.gz\""
],
"script": [
"echo '# SQL' | gzip > test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${DAY_BACKUP}\" --body test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" --body test.sql.gz",
"docker compose --file tests/docker-compose-backup-strategy.yml run --rm backup",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" postgres15.sql.gz || (echo 'Not found.' | tee error.log)",
"cat error.log | grep 'Not found.'",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\""
]
},
{
"name": "backup strategy for keeping day backup in 90 days(3 months)",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-strategy.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"before_script": [
"TARGET_TIME=`date \"+%Y-%m-01\" --date '3 months ago'`",
"DATE=`date \"+%Y-%m-%d\" --date \"${TARGET_TIME}\"`",
"TIME=`date \"+%Y%m%dT%H%M\" --date \"${TARGET_TIME}\"`",
"OLD_BACKUP=\"postgres15-postgres-1/${DATE}/postgres15-postgres-1_${TIME}.sql.gz\""
],
"script": [
"echo '# SQL' | gzip > test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" --body test.sql.gz",
"docker compose --file tests/docker-compose-backup-strategy.yml run --rm backup",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" postgres15.sql.gz",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\""
]
},
{
"name": "backup strategy for keeping day backups if they are backuped in different day.",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-strategy.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"before_script": [
"TARGET1_TIME=`date \"+%Y-%m-01\" --date '2 months ago'`",
"DATE1=`date \"+%Y-%m-%d\" --date \"${TARGET1_TIME}\"`",
"TIME1=`date \"+%Y%m%dT%H%M\" --date \"${TARGET1_TIME}\"`",
"DAY1_BACKUP=\"postgres15-postgres-1/${DATE1}/postgres15-postgres-1_${TIME1}.sql.gz\"",
"TARGET2_TIME=`date \"+%Y-%m-02\" --date '2 months ago'`",
"DATE2=`date \"+%Y-%m-%d\" --date \"${TARGET2_TIME}\"`",
"TIME2=`date \"+%Y%m%dT%H%M\" --date \"${TARGET2_TIME}\"`",
"DAY2_BACKUP=\"postgres15-postgres-1/${DATE2}/postgres15-postgres-1_${TIME2}.sql.gz\""
],
"script": [
"echo '# SQL' | gzip > test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${DAY1_BACKUP}\" --body test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${DAY2_BACKUP}\" --body test.sql.gz",
"docker compose --file tests/docker-compose-backup-strategy.yml run --rm backup",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${DAY1_BACKUP}\" postgres15-1.sql.gz",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${DAY2_BACKUP}\" postgres15-2.sql.gz",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\""
]
},
{
"name": "backup strategy for deleting backup because of keeping day backup only",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-strategy.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"before_script": [
"TARGET1_TIME=\"`date \"+%Y-%m-01 09:00\" --date '3 months ago'`\"",
"DATE1=`date \"+%Y-%m-%d\" --date \"${TARGET1_TIME}\"`",
"TIME1=`date \"+%Y%m%dT%H%M\" --date \"${TARGET1_TIME}\"`",
"DAY_BACKUP=\"postgres15-postgres-1/${DATE1}/postgres15-postgres-1_${TIME1}.sql.gz\"",
"TARGET2_TIME=\"`date \"+%Y-%m-01 10:00\" --date '3 months ago'`\"",
"DATE2=`date \"+%Y-%m-%d\" --date \"${TARGET2_TIME}\"`",
"TIME2=`date \"+%Y%m%dT%H%M\" --date \"${TARGET2_TIME}\"`",
"NOT_DAY_BACKUP=\"postgres15-postgres-1/${DATE2}/postgres15-postgres-1_${TIME2}.sql.gz\""
],
"script": [
"echo '# SQL' | gzip > test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${DAY_BACKUP}\" --body test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${NOT_DAY_BACKUP}\" --body test.sql.gz",
"docker compose --file tests/docker-compose-backup-strategy.yml run --rm backup",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${NOT_DAY_BACKUP}\" postgres15.sql.gz || (echo 'Not found.' | tee error.log)",
"cat error.log | grep 'Not found.'",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\""
]
},
{
"name": "backup strategy for deleting day backup exceeding 90 days(3 months)",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-strategy.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"before_script": [
"TARGET_TIME=`date \"+%Y-%m-10\" --date '5 months ago'`",
"DATE=`date \"+%Y-%m-%d\" --date \"${TARGET_TIME}\"`",
"TIME=`date \"+%Y%m%dT%H%M\" --date \"${TARGET_TIME}\"`",
"OLD_BACKUP=\"postgres15-postgres-1/${DATE}/postgres15-postgres-1_${TIME}.sql.gz\"",
"MONTH_TARGET_TIME=`date \"+%Y-%m-01\" --date \"${TARGET_TIME}\"`",
"MONTH_DATE=`date \"+%Y-%m-%d\" --date \"${MONTH_TARGET_TIME}\"`",
"MONTH_TIME=`date \"+%Y%m%dT%H%M\" --date \"${MONTH_TARGET_TIME}\"`",
"MONTH_BACKUP=\"postgres15-postgres-1/${MONTH_DATE}/postgres15-postgres-1_${MONTH_TIME}.sql.gz\""
],
"script": [
"echo '# SQL' | gzip > test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${MONTH_BACKUP}\" --body test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" --body test.sql.gz",
"docker compose --file tests/docker-compose-backup-strategy.yml run --rm backup",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" postgres15.sql.gz || (echo 'Not found.' | tee error.log)",
"cat error.log | grep 'Not found.'",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\""
]
},
{
"name": "backup strategy for keeping month backup in 36 months(3 years)",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-strategy.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"before_script": [
"TARGET_TIME=`date \"+%Y-%m-01\" --date '3 years ago'`",
"DATE=`date \"+%Y-%m-%d\" --date \"${TARGET_TIME}\"`",
"TIME=`date \"+%Y%m%dT%H%M\" --date \"${TARGET_TIME}\"`",
"OLD_BACKUP=\"postgres15-postgres-1/${DATE}/postgres15-postgres-1_${TIME}.sql.gz\""
],
"script": [
"echo '# SQL' | gzip > test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" --body test.sql.gz",
"docker compose --file tests/docker-compose-backup-strategy.yml run --rm backup",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" postgres15.sql.gz",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\""
]
},
{
"name": "backup strategy for keeping month backups if they are backuped in different month.",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-strategy.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"before_script": [
"TARGET1_TIME=`date \"+%Y-01-01\" --date '1 years ago'`",
"DATE1=`date \"+%Y-%m-%d\" --date \"${TARGET1_TIME}\"`",
"TIME1=`date \"+%Y%m%dT%H%M\" --date \"${TARGET1_TIME}\"`",
"MONTH1_BACKUP=\"postgres15-postgres-1/${DATE1}/postgres15-postgres-1_${TIME1}.sql.gz\"",
"TARGET2_TIME=`date \"+%Y-02-02\" --date '1 years ago'`",
"DATE2=`date \"+%Y-%m-%d\" --date \"${TARGET2_TIME}\"`",
"TIME2=`date \"+%Y%m%dT%H%M\" --date \"${TARGET2_TIME}\"`",
"MONTH2_BACKUP=\"postgres15-postgres-1/${DATE2}/postgres15-postgres-1_${TIME2}.sql.gz\""
],
"script": [
"echo '# SQL' | gzip > test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${MONTH1_BACKUP}\" --body test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${MONTH2_BACKUP}\" --body test.sql.gz",
"docker compose --file tests/docker-compose-backup-strategy.yml run --rm backup",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${MONTH1_BACKUP}\" postgres15-1.sql.gz",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${MONTH2_BACKUP}\" postgres15-2.sql.gz",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\""
]
},
{
"name": "backup strategy for deleting backup because of keeping month backup only",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-strategy.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"before_script": [
"TARGET1_TIME=\"`date \"+%Y-%m-01 09:00\" --date '10 months ago'`\"",
"DATE1=`date \"+%Y-%m-%d\" --date \"${TARGET1_TIME}\"`",
"TIME1=`date \"+%Y%m%dT%H%M\" --date \"${TARGET1_TIME}\"`",
"MONTH_BACKUP=\"postgres15-postgres-1/${DATE1}/postgres15-postgres-1_${TIME1}.sql.gz\"",
"TARGET2_TIME=\"`date \"+%Y-%m-20 09:00\" --date '10 months ago'`\"",
"DATE2=`date \"+%Y-%m-%d\" --date \"${TARGET2_TIME}\"`",
"TIME2=`date \"+%Y%m%dT%H%M\" --date \"${TARGET2_TIME}\"`",
"NOT_MONTH_BACKUP=\"postgres15-postgres-1/${DATE2}/postgres15-postgres-1_${TIME2}.sql.gz\""
],
"script": [
"echo '# SQL' | gzip > test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${MONTH_BACKUP}\" --body test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${NOT_MONTH_BACKUP}\" --body test.sql.gz",
"docker compose --file tests/docker-compose-backup-strategy.yml run --rm backup",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${NOT_MONTH_BACKUP}\" postgres15.sql.gz || (echo 'Not found.' | tee error.log)",
"cat error.log | grep 'Not found.'",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\""
]
},
{
"name": "backup strategy for deleting month backup exceeding 36 months(3 years)",
"before_install": [
"pip install --upgrade pip setuptools",
"pip install -r requirements_travisci.txt",
"DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}",
"mkdir -p $DOCKER_CONFIG/cli-plugins",
"curl -SL https://github.com/docker/compose/releases/download/v2.38.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose",
"chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose"
],
"install": [
"docker compose --file tests/postgres15/docker-compose.yml up --detach --quiet-pull",
"docker compose --file tests/s3/docker-compose-localstack.yml up --detach --quiet-pull",
"docker compose --file tests/docker-compose-backup-strategy.yml build --quiet",
"sleep 10",
"awslocal s3api create-bucket --bucket \"${BUCKET_NAME}\""
],
"before_script": [
"TARGET_TIME=`date \"+%Y-%m-01\" --date '3 years ago 1 months ago'`",
"DATE=`date \"+%Y-%m-%d\" --date \"${TARGET_TIME}\"`",
"TIME=`date \"+%Y%m%dT%H%M\" --date \"${TARGET_TIME}\"`",
"OLD_BACKUP=\"postgres15-postgres-1/${DATE}/postgres15-postgres-1_${TIME}.sql.gz\""
],
"script": [
"echo '# SQL' | gzip > test.sql.gz",
"awslocal s3api put-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" --body test.sql.gz",
"docker compose --file tests/docker-compose-backup-strategy.yml run --rm backup",
"awslocal s3api get-object --bucket \"${BUCKET_NAME}\" --key \"${OLD_BACKUP}\" postgres15.sql.gz || (echo 'Not found.' | tee error.log)",
"cat error.log | grep 'Not found.'",
"awslocal s3api list-objects --bucket \"${BUCKET_NAME}\""
]
}
]
}
}
Loading