From a1272c83fa2149c9a7a9ec3bf469505070b8a87a Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sun, 29 Dec 2019 17:55:03 +0000 Subject: [PATCH 01/15] Backfill changelog to version 0.3.2 --- CHANGELOG.md | 26 ++++++++++++++++++++++---- README.md | 4 ++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f980126..72619cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,29 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog][keep-a-changelog] this project adheres to [Semantic Versioning][semantic-versioning]. +## [v0.3.2] (2018-10-12) + +[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.3.1...v0.3.2) + +### Fixed + +- Role-based permissions in hassio - use `backup` permissions + +## [v0.3.1] (2018-10-12) + +[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.3.0...v0.3.1) + +### Fixed + +- Fix `config.json` for multidigit `keep_local_backup` values +- Role-based permissions in hassio - use `manager` permissions + ## [v0.3.0] (2018-03-12) -[Full Changelog](https://github.com/mr-bjerre/hassio-remote-backup/compare/v0.2.1...v0.3.0) +[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.2.1...v0.3.0) ### Added @@ -13,7 +31,7 @@ The format is based on [Keep a Changelog][keep-a-changelog] this project adheres ## [v0.2.1] (2018-03-11) -[Full Changelog](https://github.com/mr-bjerre/hassio-remote-backup/compare/v0.2.0...v0.2.1) +[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.2.0...v0.2.1) ### Fixed @@ -22,7 +40,7 @@ The format is based on [Keep a Changelog][keep-a-changelog] this project adheres ## [v0.2.0] (2018-03-07) -[Full Changelog](https://github.com/mr-bjerre/hassio-remote-backup/compare/v0.1.0...v0.2.0) +[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.1.0...v0.2.0) ### Added @@ -36,4 +54,4 @@ The format is based on [Keep a Changelog][keep-a-changelog] this project adheres [keep-a-changelog]: http://keepachangelog.com/en/1.0.0/ [semantic-versioning]: http://semver.org/spec/v2.0.0.html -[addons-repo]: https://github.com/mr-bjerre/hassio-addons/blob/master/remote-backup/config.json +[addons-repo]: https://github.com/overkill32/hassio-addons/blob/master/remote-backup/config.json diff --git a/README.md b/README.md index 6703b9e..311768a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - # Remote Backup [![GitHub Release][releases-shield]][releases] @@ -7,7 +6,7 @@ > Automatically create Hass.io snapshots to remote server location using `SCP`. -
+---- ## Table of Contents @@ -21,6 +20,7 @@ ## About When the add-on is started the following happens: + 1. Snapshot are being created locally with a timestamp name, e.g. *Automatic backup 2018-03-04 04:00*. 1. The snapshot are copied to the specified remote location using `SCP`. From ee13af6f4a87bd8ee60e61e835bcb316ba66e245 Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sun, 29 Dec 2019 18:26:06 +0000 Subject: [PATCH 02/15] Updated to hassio-cli version 3.1.1 --- CHANGELOG.md | 9 +++++++++ remote-backup/Dockerfile | 2 +- remote-backup/run.sh | 10 +++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72619cb..fff3e7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog][keep-a-changelog] this project adheres to [Semantic Versioning][semantic-versioning]. +## [v0.3.2++] (????-??-??) + +[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.3.2...master) + +### Fixed + +- Updated `hassio-cli` to version 3.1.1 +- Modified `run.sh` hassio calls to work with version 3.1.1 + ## [v0.3.2] (2018-10-12) [Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.3.1...v0.3.2) diff --git a/remote-backup/Dockerfile b/remote-backup/Dockerfile index 094f41c..860b866 100644 --- a/remote-backup/Dockerfile +++ b/remote-backup/Dockerfile @@ -11,7 +11,7 @@ RUN apk add --no-cache jq openssh-client zip ARG BUILD_ARCH ARG CLI_VERSION RUN apk add --no-cache curl \ - && curl -Lso /usr/bin/hassio https://github.com/home-assistant/hassio-cli/releases/download/1.2.1/hassio_${BUILD_ARCH} \ + && curl -Lso /usr/bin/hassio https://github.com/home-assistant/hassio-cli/releases/download/3.1.1/hassio_${BUILD_ARCH} \ && chmod a+x /usr/bin/hassio # Copy data diff --git a/remote-backup/run.sh b/remote-backup/run.sh index dbd25b4..cf40a3f 100755 --- a/remote-backup/run.sh +++ b/remote-backup/run.sh @@ -57,16 +57,16 @@ function delete-local-backup { : elif [[ -z ${KEEP_LOCAL_BACKUP} ]]; then echo "Deleting local backup: ${slug}" - hassio snapshots remove -name "${slug}" + hassio snapshots remove "${slug}" else - last_date_to_keep=$(hassio snapshots list | jq .data.snapshots[].date | sort -r | \ + last_date_to_keep=$(hassio snapshots list --raw-json | jq .data.snapshots[].date | sort -r | \ head -n "${KEEP_LOCAL_BACKUP}" | tail -n 1 | xargs date -D "%Y-%m-%dT%T" +%s --date ) - hassio snapshots list | jq -c .data.snapshots[] | while read backup; do + hassio snapshots list --raw-json | jq -c .data.snapshots[] | while read backup; do if [[ $(echo ${backup} | jq .date | xargs date -D "%Y-%m-%dT%T" +%s --date ) -lt ${last_date_to_keep} ]]; then echo "Deleting local backup: $(echo ${backup} | jq -r .slug)" - hassio snapshots remove -name "$(echo ${backup} | jq -r .slug)" + hassio snapshots remove "$(echo ${backup} | jq -r .slug)" fi done @@ -76,7 +76,7 @@ function delete-local-backup { function create-local-backup { name="Automated backup $(date +'%Y-%m-%d %H:%M')" echo "Creating local backup: \"${name}\"" - slug=$(hassio snapshots new --options name="${name}" | jq --raw-output '.data.slug') + slug=$(hassio snapshots new --raw-json --name="${name}" --no-progress | jq --raw-output '.data.slug') echo "Backup created: ${slug}" } From 9f55d099dd8f34eccbde020fb30c1fbe4b767f51 Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Mon, 30 Dec 2019 09:57:29 +0000 Subject: [PATCH 03/15] Convert snapshot remove logic into jq filter Rather than doing a lot of work as a set of shell commands have moved the sort and select operations into a jq filter. The jq filter returns snapshots to be deleted, it:- - ignores any protected backups - sorts the snapshots by date (and reverses to newest first) - returns all entries after the keep_local_backup value --- CHANGELOG.md | 1 + remote-backup/run.sh | 29 ++++++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fff3e7b..fe21678 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog][keep-a-changelog] this project adheres - Updated `hassio-cli` to version 3.1.1 - Modified `run.sh` hassio calls to work with version 3.1.1 +- Converted snapshot removal selection logic to a jq filter ## [v0.3.2] (2018-10-12) diff --git a/remote-backup/run.sh b/remote-backup/run.sh index cf40a3f..c717b6f 100755 --- a/remote-backup/run.sh +++ b/remote-backup/run.sh @@ -59,15 +59,26 @@ function delete-local-backup { echo "Deleting local backup: ${slug}" hassio snapshots remove "${slug}" else - - last_date_to_keep=$(hassio snapshots list --raw-json | jq .data.snapshots[].date | sort -r | \ - head -n "${KEEP_LOCAL_BACKUP}" | tail -n 1 | xargs date -D "%Y-%m-%dT%T" +%s --date ) - - hassio snapshots list --raw-json | jq -c .data.snapshots[] | while read backup; do - if [[ $(echo ${backup} | jq .date | xargs date -D "%Y-%m-%dT%T" +%s --date ) -lt ${last_date_to_keep} ]]; then - echo "Deleting local backup: $(echo ${backup} | jq -r .slug)" - hassio snapshots remove "$(echo ${backup} | jq -r .slug)" - fi + ## jq filter used to select required snapshots to delete. + ## Expanded form given here with explanation... + # # Remove outer containers to leave an array of snapshot objects + # .data.snapshots + # # select out snapshots that are not protected + # | map(select(.protected==false)) + # # sort the objects by date - oldest first + # | sort_by(.date) + # # reverse the sort - now oldest last + # | reverse + # # select all items after the fist ${KEEP_LOCAL_BACKUP} items + # | .[${KEEP_LOCAL_BACKUP}:] + # # output just the slug entry for each snapshot + # | .[].slug + for slug in $( \ + hassio snapshots list --raw-json | \ + jq -r ".data.snapshots | map(select(.protected==false)) | sort_by(.date) | reverse | .[${KEEP_LOCAL_BACKUP}:] | .[].slug" ) + do + echo "Deleting local backup: ${slug}" + hassio snapshots remove ${slug} done fi From 9fdb05e23d946150fc2b286b6b79e6c3f983074d Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Mon, 30 Dec 2019 17:41:35 +0000 Subject: [PATCH 04/15] Added readme comment about remote expiry --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 311768a..1d91cfc 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,10 @@ See my [repository of addons][hassio-addons] for more information. |`zip_password`|No|If set then the backup will be contained in a password protected zip| |`keep_local_backup`|No|Control how many local backups you want to preserve. Default (`""`) is to keep no local backups created from this addon. If `all` then all loocal backups will be preserved. A positive integer will determine how many of the latest backups will be preserved. Note this will delete other local backups created outside this addon. +Remember that no matter what `keep_local_backup` is set to, you will add one +new snapshot backup file to the remote location each time this is run. You +may wish to have some form of expiry of these snapshots. + ## Example: daily backups at 4 AM Personally I've added the following automation to make a daily backup. It is password-protected and the last two weeks of snapshots are kept locally as well. From 4f66e4f03a86ef9ab6c2c444dd4aee772d0a127a Mon Sep 17 00:00:00 2001 From: Rob Coleman Date: Wed, 12 Aug 2020 17:55:50 -0700 Subject: [PATCH 05/15] Fixed to work with recent Home Assistant OS releases. --- remote-backup/Dockerfile | 12 ++++++------ remote-backup/run.sh | 14 ++++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/remote-backup/Dockerfile b/remote-backup/Dockerfile index 094f41c..3ec375a 100644 --- a/remote-backup/Dockerfile +++ b/remote-backup/Dockerfile @@ -11,8 +11,8 @@ RUN apk add --no-cache jq openssh-client zip ARG BUILD_ARCH ARG CLI_VERSION RUN apk add --no-cache curl \ - && curl -Lso /usr/bin/hassio https://github.com/home-assistant/hassio-cli/releases/download/1.2.1/hassio_${BUILD_ARCH} \ - && chmod a+x /usr/bin/hassio + && curl -Lso /usr/bin/ha https://github.com/home-assistant/cli/releases/download/4.3.0/ha_${BUILD_ARCH} \ + && chmod a+x /usr/bin/ha # Copy data COPY run.sh / @@ -32,12 +32,12 @@ LABEL \ io.hass.arch="${BUILD_ARCH}" \ io.hass.type="addon" \ io.hass.version=${BUILD_VERSION} \ - maintainer="Nicolai Bjerre Pedersen " \ + maintainer="Nicolai Bjerre Pedersen / TheStigh" \ org.label-schema.description="Automatically create Hass.io snapshots to remote server location using `SCP`." \ org.label-schema.build-date=${BUILD_DATE} \ org.label-schema.name="Remote Backup" \ org.label-schema.schema-version="1.0" \ - org.label-schema.usage="https://github.com/overkill32/hassio-remote-backup/tree/master/README.md" \ + org.label-schema.usage="https://github.com/thestigh/hassio-remote-backup/tree/master/README.md" \ org.label-schema.vcs-ref=${BUILD_REF} \ - org.label-schema.vcs-url="https://github.com/overkill32/hassio-remote-backup/" \ - org.label-schema.vendor="Hass.io add-ons by Nicolai" + org.label-schema.vcs-url="https://github.com/thestigh/hassio-remote-backup/" \ + org.label-schema.vendor="Hass.io add-ons by Nicolai/TheStigh" diff --git a/remote-backup/run.sh b/remote-backup/run.sh index dbd25b4..e3310fb 100755 --- a/remote-backup/run.sh +++ b/remote-backup/run.sh @@ -2,6 +2,7 @@ set -e CONFIG_PATH=/data/options.json +HA=/usr/bin/ha # parse inputs from options SSH_HOST=$(jq --raw-output ".ssh_host" $CONFIG_PATH) @@ -51,32 +52,33 @@ function copy-backup-to-remote { function delete-local-backup { - hassio snapshots reload + ${HA} snapshots reload if [[ ${KEEP_LOCAL_BACKUP} == "all" ]]; then : elif [[ -z ${KEEP_LOCAL_BACKUP} ]]; then echo "Deleting local backup: ${slug}" - hassio snapshots remove -name "${slug}" + ${HA} snapshots remove ${slug} else - last_date_to_keep=$(hassio snapshots list | jq .data.snapshots[].date | sort -r | \ + last_date_to_keep=$($HA --raw-json snapshots list | jq .data.snapshots[].date | sort -r | \ head -n "${KEEP_LOCAL_BACKUP}" | tail -n 1 | xargs date -D "%Y-%m-%dT%T" +%s --date ) - hassio snapshots list | jq -c .data.snapshots[] | while read backup; do + $HA --raw-json snapshots list | jq -c .data.snapshots[] | while read backup; do if [[ $(echo ${backup} | jq .date | xargs date -D "%Y-%m-%dT%T" +%s --date ) -lt ${last_date_to_keep} ]]; then echo "Deleting local backup: $(echo ${backup} | jq -r .slug)" - hassio snapshots remove -name "$(echo ${backup} | jq -r .slug)" + ${HA} snapshots remove $(echo ${backup} | jq -r .slug) fi done fi + echo Exiting } function create-local-backup { name="Automated backup $(date +'%Y-%m-%d %H:%M')" echo "Creating local backup: \"${name}\"" - slug=$(hassio snapshots new --options name="${name}" | jq --raw-output '.data.slug') + slug=$(${HA} snapshots new --name="${name}" | cut -d' ' -f2) echo "Backup created: ${slug}" } From b21afd74738114ee06aaf00d67aad21549fbe4db Mon Sep 17 00:00:00 2001 From: rccoleman Date: Wed, 27 Jan 2021 16:34:45 -0800 Subject: [PATCH 06/15] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6703b9e..9d31ead 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ ## About +*Note: For anyone using this as a local addon, it appears that the latest base image now requires updating to the new "OPENSSH" private key format. If you were previously using a private key that started "RSA PRIVATE KEY", you'll need to follow the instructions [here](https://serverfault.com/questions/854208/ssh-suddenly-returning-invalid-format/960647) to update your private key and add the new key in the addon config. Using the older key format will result in "Load pubkey "xxx": Invalid format" as described at the link.* + When the add-on is started the following happens: 1. Snapshot are being created locally with a timestamp name, e.g. *Automatic backup 2018-03-04 04:00*. From 54dd53aa53766944efe7b2a1a4962b38130ff01c Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sat, 27 Feb 2021 15:37:16 +0000 Subject: [PATCH 07/15] Set up for build and release under my own id --- .travis.yml | 8 -------- CHANGELOG.md | 10 +++++++++- README.md | 28 +++++++++++++++++++--------- build.sh | 31 ------------------------------- remote-backup/Dockerfile | 10 +++++----- 5 files changed, 33 insertions(+), 54 deletions(-) delete mode 100644 .travis.yml delete mode 100755 build.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 80bbbba..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -sudo: required -services: -- docker -script: -- "$TRAVIS_BUILD_DIR/build.sh" -env: - global: - secure: I1qaPNCHzZ0rntK1/aMMSCI50zhIdHO+V2UPwimUHmlQ8YdW1dUnuictFFoGEbp2S7owub9U4cwm5LHp8VjtrnDxoDEBuzb50RMTQ8vNWE4SAILawe9TWKfHQKqgCgONQsv9O4Bh8moqwDD+PrqnoGvqEsRjiS6Icx8jk1zCvy7WDzpgnZIHIzytAudRTNwVb/nIJWGMfG29ekxqLgX1YXQ6XsZfQm+JSt8a8dGLdYoYQZRbrriznanYkeMrBanwkKQgbmA1MirIwfcprvnXad1aX8l6/uKomvehc1PbUH6DXUqq8lzuu42gF+J9W3aL4YtbWYtzOItq2Hi0nnj26EvUyn1yIGzfCXv4j3eNA6cqplPKePZ9dYREx0bEiQP412T6w1WviRrhB4THSeCmn6HCkb/k2quTX4vLT1lQWOv4CRe0Qp5kHExbe2kGREJONiUsXU/6zKtT4S+iF9g5EalCaG8beFIwYllkbcSIsle/mfjHKTvwwQ8vI0cnRb7aKLI1pLgb6fQVIRN5ia+fwOvd/S/phy30wAzqtAjuxehbJ8dmnaS0Q21CRUmMAsRJ09x4KUTRMg0hBVib7JJ6jPQIvGgyILe4aJtBFZ5upxwPtk3eEc29RV/FbgJzPa7419boPflIpPY20a+VkfUpSjD4UcS/Xvd+6bjOecT9Fh4= diff --git a/CHANGELOG.md b/CHANGELOG.md index fe21678..952f4a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,21 @@ The format is based on [Keep a Changelog][keep-a-changelog] this project adheres ## [v0.3.2++] (????-??-??) -[Full Changelog](https://github.com/overkill32/hassio-remote-backup/compare/v0.3.2...master) +[Full Changelog](https://github.com/nigelm/hassio-remote-backup/compare/v0.3.2...master) ### Fixed - Updated `hassio-cli` to version 3.1.1 - Modified `run.sh` hassio calls to work with version 3.1.1 - Converted snapshot removal selection logic to a jq filter +- Merged in changes from rccoleman - https://github.com/rccoleman/hassio-remote-backup + - Updated `hassio-cli` to 4.3.0 + - Added README notes + - Reformatted run.sh for change of `hassio-cli` binary name +- Updated `hassio-cli` to 4.10.1 +- Since the previous maintainers do not appear to be keeping up with this, and + have not got available docker builds, I have updated the references to point + to my repositories. ## [v0.3.2] (2018-10-12) diff --git a/README.md b/README.md index d01e042..d020f41 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,12 @@ * [Installation](#installation) * [Configuration](#configuration) * [Example](#example) +* [Issues](#issues) * [Changelog & Releases](#changelog) * [Docker status](#docker) ## About -*Note: For anyone using this as a local addon, it appears that the latest base image now requires updating to the new "OPENSSH" private key format. If you were previously using a private key that started "RSA PRIVATE KEY", you'll need to follow the instructions [here](https://serverfault.com/questions/854208/ssh-suddenly-returning-invalid-format/960647) to update your private key and add the new key in the addon config. Using the older key format will result in "Load pubkey "xxx": Invalid format" as described at the link.* - When the add-on is started the following happens: 1. Snapshot are being created locally with a timestamp name, e.g. @@ -32,7 +31,7 @@ _Note_ the filenames of the backup are given by their assigned slug. ## Installation -1. Add the add-ons repository to your Hass.io instance: `https://github.com/overkill32/hassio-addons`. +1. Add the add-ons repository to your Hass.io instance: `https://github.com/nigelm/hassio-addons`. 1. Install the Remote Backup add-on. 1. Configure the add-on with your SSH credentials and desired output directory (see configuration below). @@ -94,6 +93,17 @@ _Add-on configuration_: **Note**: _This is just an example, don't copy and past it! Create your own!_ +## Issues + +*Note: For anyone using this as a local addon, it appears that the latest base +image now requires updating to the new "OPENSSH" private key format. If you +were previously using a private key that started "RSA PRIVATE KEY", you'll +need to follow the instructions +[here](https://serverfault.com/questions/854208/ssh-suddenly-returning-invalid-format/960647) +to update your private key and add the new key in the addon config. Using +the older key format will result in "Load pubkey "xxx": Invalid format" as +described at the link.* + ## Changelog & Releases This repository keeps a [change log](CHANGELOG.md). The format of the log @@ -156,13 +166,13 @@ based on the following: [i386-pulls-shield]: https://img.shields.io/docker/pulls/fixated/remote-backup-i386.svg [i386-version-shield]: https://images.microbadger.com/badges/version/fixated/remote-backup-i386.svg -[license-shield]: https://img.shields.io/github/license/overkill32/hassio-remote-backup.svg -[releases]: https://github.com/overkill32/hassio-remote-backup/releases -[releases-shield]: https://img.shields.io/github/release/overkill32/hassio-remote-backup.svg -[travis-build]: https://travis-ci.org/overkill32/hassio-remote-backup -[travis-build-shield]: https://travis-ci.org/overkill32/hassio-remote-backup.svg?branch=master +[license-shield]: https://img.shields.io/github/license/nigelm/hassio-remote-backup.svg +[releases]: https://github.com/nigelm/hassio-remote-backup/releases +[releases-shield]: https://img.shields.io/github/release/nigelm/hassio-remote-backup.svg +[travis-build]: https://travis-ci.org/nigelm/hassio-remote-backup +[travis-build-shield]: https://travis-ci.org/nigelm/hassio-remote-backup.svg?branch=master [keepchangelog]: http://keepachangelog.com/en/1.0.0/ [semver]: http://semver.org/spec/v2.0.0.html -[hassio-addons]: https://github.com/overkill32/hassio-addons +[hassio-addons]: https://github.com/nigelm/hassio-addons diff --git a/build.sh b/build.sh deleted file mode 100755 index 5a9d80d..0000000 --- a/build.sh +++ /dev/null @@ -1,31 +0,0 @@ -set -ev -docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" - -if [ -z ${TRAVIS_TAG} ]; then - echo "Untagged build found. Building to test." - docker run -it --rm --privileged --name "${ADDON_NAME}" \ - -v ~/.docker:/root/.docker \ - -v "$(pwd)":/docker \ - hassioaddons/build-env:latest \ - --target "${ADDON_NAME}" \ - --git \ - --all \ - --from "homeassistant/{arch}-base" \ - --author "Nicolai Bjerre Pedersen " \ - --doc-url "${GITHUB_URL}" \ - --image "fixated/${ADDON_NAME}-{arch}" -else - echo "New git tagged build found. Building to distribute." - docker run -it --rm --privileged --name "${ADDON_NAME}" \ - -v ~/.docker:/root/.docker \ - -v "$(pwd)":/docker \ - hassioaddons/build-env:latest \ - --target "${ADDON_NAME}" \ - --git \ - --all \ - --push \ - --from "homeassistant/{arch}-base" \ - --author "Nicolai Bjerre Pedersen " \ - --doc-url "${GITHUB_URL}" \ - --image "fixated/${ADDON_NAME}-{arch}" -fi diff --git a/remote-backup/Dockerfile b/remote-backup/Dockerfile index 3ec375a..4677b06 100644 --- a/remote-backup/Dockerfile +++ b/remote-backup/Dockerfile @@ -11,7 +11,7 @@ RUN apk add --no-cache jq openssh-client zip ARG BUILD_ARCH ARG CLI_VERSION RUN apk add --no-cache curl \ - && curl -Lso /usr/bin/ha https://github.com/home-assistant/cli/releases/download/4.3.0/ha_${BUILD_ARCH} \ + && curl -Lso /usr/bin/ha https://github.com/home-assistant/cli/releases/download/4.10.1/ha_${BUILD_ARCH} \ && chmod a+x /usr/bin/ha # Copy data @@ -32,12 +32,12 @@ LABEL \ io.hass.arch="${BUILD_ARCH}" \ io.hass.type="addon" \ io.hass.version=${BUILD_VERSION} \ - maintainer="Nicolai Bjerre Pedersen / TheStigh" \ + maintainer="Nigel Metheringham " \ org.label-schema.description="Automatically create Hass.io snapshots to remote server location using `SCP`." \ org.label-schema.build-date=${BUILD_DATE} \ org.label-schema.name="Remote Backup" \ org.label-schema.schema-version="1.0" \ - org.label-schema.usage="https://github.com/thestigh/hassio-remote-backup/tree/master/README.md" \ + org.label-schema.usage="https://github.com/nigelm/hassio-remote-backup/tree/master/README.md" \ org.label-schema.vcs-ref=${BUILD_REF} \ - org.label-schema.vcs-url="https://github.com/thestigh/hassio-remote-backup/" \ - org.label-schema.vendor="Hass.io add-ons by Nicolai/TheStigh" + org.label-schema.vcs-url="https://github.com/nigelm/hassio-remote-backup/" \ + org.label-schema.vendor="Hass.io add-ons by Nigel Metheringham" From cc2387bd2e466cb713e8a9f98a77c76f2388d966 Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sat, 27 Feb 2021 16:10:17 +0000 Subject: [PATCH 08/15] Added github workflows --- .github/workflows/homeassistant-publish.yml | 27 +++++++++++++++++++++ .github/workflows/homeassistant-test.yml | 21 ++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .github/workflows/homeassistant-publish.yml create mode 100644 .github/workflows/homeassistant-test.yml diff --git a/.github/workflows/homeassistant-publish.yml b/.github/workflows/homeassistant-publish.yml new file mode 100644 index 0000000..134e48a --- /dev/null +++ b/.github/workflows/homeassistant-publish.yml @@ -0,0 +1,27 @@ +name: 'Publish' + +on: + release: + types: [published] + +jobs: + publish: + name: Publish + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v2 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Publish + uses: home-assistant/builder@master + with: + args: | + --all \ + --target remote-backup \ + --docker-hub nigelm + +# end \ No newline at end of file diff --git a/.github/workflows/homeassistant-test.yml b/.github/workflows/homeassistant-test.yml new file mode 100644 index 0000000..e97be5b --- /dev/null +++ b/.github/workflows/homeassistant-test.yml @@ -0,0 +1,21 @@ +name: 'Test' + +on: [push, pull_request] + +jobs: + build: + name: Test build + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v2 + - name: Test build + uses: home-assistant/builder@master + with: + args: | + --test \ + --all \ + --target remote-backup \ + --docker-hub nigelm + +# end \ No newline at end of file From f51d6c0a6a150fd132af058f2ec0abc36f800091 Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sat, 27 Feb 2021 16:20:23 +0000 Subject: [PATCH 09/15] Modified workflow parameters --- .github/workflows/homeassistant-publish.yml | 2 +- .github/workflows/homeassistant-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/homeassistant-publish.yml b/.github/workflows/homeassistant-publish.yml index 134e48a..a7d1217 100644 --- a/.github/workflows/homeassistant-publish.yml +++ b/.github/workflows/homeassistant-publish.yml @@ -22,6 +22,6 @@ jobs: args: | --all \ --target remote-backup \ - --docker-hub nigelm + --docker-hub nigelm/hassio-remote-backup # end \ No newline at end of file diff --git a/.github/workflows/homeassistant-test.yml b/.github/workflows/homeassistant-test.yml index e97be5b..9b9288f 100644 --- a/.github/workflows/homeassistant-test.yml +++ b/.github/workflows/homeassistant-test.yml @@ -16,6 +16,6 @@ jobs: --test \ --all \ --target remote-backup \ - --docker-hub nigelm + --docker-hub nigelm/hassio-remote-backup # end \ No newline at end of file From f9b06be99c3b9e08e3ffcf00931093d4b6ff39db Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sat, 27 Feb 2021 16:28:44 +0000 Subject: [PATCH 10/15] Try adding an image argument --- .github/workflows/homeassistant-publish.yml | 1 + .github/workflows/homeassistant-test.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/homeassistant-publish.yml b/.github/workflows/homeassistant-publish.yml index a7d1217..95456c5 100644 --- a/.github/workflows/homeassistant-publish.yml +++ b/.github/workflows/homeassistant-publish.yml @@ -22,6 +22,7 @@ jobs: args: | --all \ --target remote-backup \ + --image hassio-remote-backup-{arch} \ --docker-hub nigelm/hassio-remote-backup # end \ No newline at end of file diff --git a/.github/workflows/homeassistant-test.yml b/.github/workflows/homeassistant-test.yml index 9b9288f..0f2debe 100644 --- a/.github/workflows/homeassistant-test.yml +++ b/.github/workflows/homeassistant-test.yml @@ -16,6 +16,7 @@ jobs: --test \ --all \ --target remote-backup \ + --image hassio-remote-backup-{arch} \ --docker-hub nigelm/hassio-remote-backup # end \ No newline at end of file From f6e5f871f26d2cf14316e91b90ff89ca164fb786 Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sat, 27 Feb 2021 17:09:40 +0000 Subject: [PATCH 11/15] It appears the automation is unclear on what a docker repo is --- .github/workflows/homeassistant-publish.yml | 2 +- .github/workflows/homeassistant-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/homeassistant-publish.yml b/.github/workflows/homeassistant-publish.yml index 95456c5..5c1ab4f 100644 --- a/.github/workflows/homeassistant-publish.yml +++ b/.github/workflows/homeassistant-publish.yml @@ -23,6 +23,6 @@ jobs: --all \ --target remote-backup \ --image hassio-remote-backup-{arch} \ - --docker-hub nigelm/hassio-remote-backup + --docker-hub nigelm # end \ No newline at end of file diff --git a/.github/workflows/homeassistant-test.yml b/.github/workflows/homeassistant-test.yml index 0f2debe..cb239f6 100644 --- a/.github/workflows/homeassistant-test.yml +++ b/.github/workflows/homeassistant-test.yml @@ -17,6 +17,6 @@ jobs: --all \ --target remote-backup \ --image hassio-remote-backup-{arch} \ - --docker-hub nigelm/hassio-remote-backup + --docker-hub nigelm # end \ No newline at end of file From 292cd435fa5128454658a64ea0b2f4514ac8ce62 Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sat, 27 Feb 2021 17:34:58 +0000 Subject: [PATCH 12/15] Need to add a version number on publishing --- .github/workflows/homeassistant-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/homeassistant-publish.yml b/.github/workflows/homeassistant-publish.yml index 5c1ab4f..b63f524 100644 --- a/.github/workflows/homeassistant-publish.yml +++ b/.github/workflows/homeassistant-publish.yml @@ -23,6 +23,7 @@ jobs: --all \ --target remote-backup \ --image hassio-remote-backup-{arch} \ + --version ${{ github.event.release.tag_name }} \ --docker-hub nigelm # end \ No newline at end of file From 17df1eb62f44ca2089c28bfb38379ec7f5324886 Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sat, 27 Feb 2021 18:57:17 +0000 Subject: [PATCH 13/15] Fix various shields in README --- README.md | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index d020f41..c5342e6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Remote Backup [![GitHub Release][releases-shield]][releases] -[![Build Status][travis-build-shield]][travis-build] +[![Build Status](https://github.com/nigelm/hassio-remote-backup/actions/workflows/homeassistant-test.yml/badge.svg) +[![Release Status](https://github.com/nigelm/hassio-remote-backup/actions/workflows/homeassistant-publish.yml/badge.svg) [![GitHub license][license-shield]](LICENSE.md) > Automatically create Hass.io snapshots to remote server location using `SCP`. @@ -142,29 +143,29 @@ based on the following: [aarch64-arch-shield]: https://img.shields.io/badge/architecture-aarch64-blue.svg -[aarch64-dockerhub]: https://hub.docker.com/r/fixated/remote-backup-aarch64 -[aarch64-layers-shield]: https://images.microbadger.com/badges/image/fixated/remote-backup-aarch64.svg -[aarch64-microbadger]: https://microbadger.com/images/fixated/remote-backup-aarch64 -[aarch64-pulls-shield]: https://img.shields.io/docker/pulls/fixated/remote-backup-aarch64.svg -[aarch64-version-shield]: https://images.microbadger.com/badges/version/fixated/remote-backup-aarch64.svg +[aarch64-dockerhub]: https://hub.docker.com/r/nigelm/remote-backup-aarch64 +[aarch64-layers-shield]: https://images.microbadger.com/badges/image/nigelm/remote-backup-aarch64.svg +[aarch64-microbadger]: https://microbadger.com/images/nigelm/remote-backup-aarch64 +[aarch64-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/remote-backup-aarch64.svg +[aarch64-version-shield]: https://images.microbadger.com/badges/version/nigelm/remote-backup-aarch64.svg [amd64-arch-shield]: https://img.shields.io/badge/architecture-amd64-blue.svg -[amd64-dockerhub]: https://hub.docker.com/r/fixated/remote-backup-amd64 -[amd64-layers-shield]: https://images.microbadger.com/badges/image/fixated/remote-backup-amd64.svg -[amd64-microbadger]: https://microbadger.com/images/fixated/remote-backup-amd64 -[amd64-pulls-shield]: https://img.shields.io/docker/pulls/fixated/remote-backup-amd64.svg -[amd64-version-shield]: https://images.microbadger.com/badges/version/fixated/remote-backup-amd64.svg +[amd64-dockerhub]: https://hub.docker.com/r/nigelm/remote-backup-amd64 +[amd64-layers-shield]: https://images.microbadger.com/badges/image/nigelm/remote-backup-amd64.svg +[amd64-microbadger]: https://microbadger.com/images/nigelm/remote-backup-amd64 +[amd64-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/remote-backup-amd64.svg +[amd64-version-shield]: https://images.microbadger.com/badges/version/nigelm/remote-backup-amd64.svg [armhf-arch-shield]: https://img.shields.io/badge/architecture-armhf-blue.svg -[armhf-dockerhub]: https://hub.docker.com/r/fixated/remote-backup-armhf -[armhf-layers-shield]: https://images.microbadger.com/badges/image/fixated/remote-backup-armhf.svg -[armhf-microbadger]: https://microbadger.com/images/fixated/remote-backup-armhf -[armhf-pulls-shield]: https://img.shields.io/docker/pulls/fixated/remote-backup-armhf.svg -[armhf-version-shield]: https://images.microbadger.com/badges/version/fixated/remote-backup-armhf.svg +[armhf-dockerhub]: https://hub.docker.com/r/nigelm/remote-backup-armhf +[armhf-layers-shield]: https://images.microbadger.com/badges/image/nigelm/remote-backup-armhf.svg +[armhf-microbadger]: https://microbadger.com/images/nigelm/remote-backup-armhf +[armhf-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/remote-backup-armhf.svg +[armhf-version-shield]: https://images.microbadger.com/badges/version/nigelm/remote-backup-armhf.svg [i386-arch-shield]: https://img.shields.io/badge/architecture-i386-blue.svg -[i386-dockerhub]: https://hub.docker.com/r/fixated/remote-backup-i386 -[i386-layers-shield]: https://images.microbadger.com/badges/image/fixated/remote-backup-i386.svg -[i386-microbadger]: https://microbadger.com/images/fixated/remote-backup-i386 -[i386-pulls-shield]: https://img.shields.io/docker/pulls/fixated/remote-backup-i386.svg -[i386-version-shield]: https://images.microbadger.com/badges/version/fixated/remote-backup-i386.svg +[i386-dockerhub]: https://hub.docker.com/r/nigelm/remote-backup-i386 +[i386-layers-shield]: https://images.microbadger.com/badges/image/nigelm/remote-backup-i386.svg +[i386-microbadger]: https://microbadger.com/images/nigelm/remote-backup-i386 +[i386-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/remote-backup-i386.svg +[i386-version-shield]: https://images.microbadger.com/badges/version/nigelm/remote-backup-i386.svg [license-shield]: https://img.shields.io/github/license/nigelm/hassio-remote-backup.svg [releases]: https://github.com/nigelm/hassio-remote-backup/releases From c314fc0bb613296f885f33219606485879f7c35c Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sat, 27 Feb 2021 18:59:02 +0000 Subject: [PATCH 14/15] Badges point to correct repo name --- README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index c5342e6..ba4c169 100644 --- a/README.md +++ b/README.md @@ -143,29 +143,29 @@ based on the following: [aarch64-arch-shield]: https://img.shields.io/badge/architecture-aarch64-blue.svg -[aarch64-dockerhub]: https://hub.docker.com/r/nigelm/remote-backup-aarch64 -[aarch64-layers-shield]: https://images.microbadger.com/badges/image/nigelm/remote-backup-aarch64.svg -[aarch64-microbadger]: https://microbadger.com/images/nigelm/remote-backup-aarch64 -[aarch64-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/remote-backup-aarch64.svg -[aarch64-version-shield]: https://images.microbadger.com/badges/version/nigelm/remote-backup-aarch64.svg +[aarch64-dockerhub]: https://hub.docker.com/r/nigelm/hassio-remote-backup-aarch64 +[aarch64-layers-shield]: https://images.microbadger.com/badges/image/nigelm/hassio-remote-backup-aarch64.svg +[aarch64-microbadger]: https://microbadger.com/images/nigelm/hassio-remote-backup-aarch64 +[aarch64-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/hassio-remote-backup-aarch64.svg +[aarch64-version-shield]: https://images.microbadger.com/badges/version/nigelm/hassio-remote-backup-aarch64.svg [amd64-arch-shield]: https://img.shields.io/badge/architecture-amd64-blue.svg -[amd64-dockerhub]: https://hub.docker.com/r/nigelm/remote-backup-amd64 -[amd64-layers-shield]: https://images.microbadger.com/badges/image/nigelm/remote-backup-amd64.svg -[amd64-microbadger]: https://microbadger.com/images/nigelm/remote-backup-amd64 -[amd64-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/remote-backup-amd64.svg -[amd64-version-shield]: https://images.microbadger.com/badges/version/nigelm/remote-backup-amd64.svg +[amd64-dockerhub]: https://hub.docker.com/r/nigelm/hassio-remote-backup-amd64 +[amd64-layers-shield]: https://images.microbadger.com/badges/image/nigelm/hassio-remote-backup-amd64.svg +[amd64-microbadger]: https://microbadger.com/images/nigelm/hassio-remote-backup-amd64 +[amd64-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/hassio-remote-backup-amd64.svg +[amd64-version-shield]: https://images.microbadger.com/badges/version/nigelm/hassio-remote-backup-amd64.svg [armhf-arch-shield]: https://img.shields.io/badge/architecture-armhf-blue.svg -[armhf-dockerhub]: https://hub.docker.com/r/nigelm/remote-backup-armhf -[armhf-layers-shield]: https://images.microbadger.com/badges/image/nigelm/remote-backup-armhf.svg -[armhf-microbadger]: https://microbadger.com/images/nigelm/remote-backup-armhf -[armhf-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/remote-backup-armhf.svg -[armhf-version-shield]: https://images.microbadger.com/badges/version/nigelm/remote-backup-armhf.svg +[armhf-dockerhub]: https://hub.docker.com/r/nigelm/hassio-remote-backup-armhf +[armhf-layers-shield]: https://images.microbadger.com/badges/image/nigelm/hassio-remote-backup-armhf.svg +[armhf-microbadger]: https://microbadger.com/images/nigelm/hassio-remote-backup-armhf +[armhf-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/hassio-remote-backup-armhf.svg +[armhf-version-shield]: https://images.microbadger.com/badges/version/nigelm/hassio-remote-backup-armhf.svg [i386-arch-shield]: https://img.shields.io/badge/architecture-i386-blue.svg -[i386-dockerhub]: https://hub.docker.com/r/nigelm/remote-backup-i386 -[i386-layers-shield]: https://images.microbadger.com/badges/image/nigelm/remote-backup-i386.svg -[i386-microbadger]: https://microbadger.com/images/nigelm/remote-backup-i386 -[i386-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/remote-backup-i386.svg -[i386-version-shield]: https://images.microbadger.com/badges/version/nigelm/remote-backup-i386.svg +[i386-dockerhub]: https://hub.docker.com/r/nigelm/hassio-remote-backup-i386 +[i386-layers-shield]: https://images.microbadger.com/badges/image/nigelm/hassio-remote-backup-i386.svg +[i386-microbadger]: https://microbadger.com/images/nigelm/hassio-remote-backup-i386 +[i386-pulls-shield]: https://img.shields.io/docker/pulls/nigelm/hassio-remote-backup-i386.svg +[i386-version-shield]: https://images.microbadger.com/badges/version/nigelm/hassio-remote-backup-i386.svg [license-shield]: https://img.shields.io/github/license/nigelm/hassio-remote-backup.svg [releases]: https://github.com/nigelm/hassio-remote-backup/releases From 3efc9d61361aaf50bd9ef7cb85652f3dc2b7a4b5 Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sat, 27 Feb 2021 19:03:43 +0000 Subject: [PATCH 15/15] Updated changelog correctly, made new release --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 952f4a6..ba973cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog][keep-a-changelog] this project adheres to [Semantic Versioning][semantic-versioning]. -## [v0.3.2++] (????-??-??) +## [v0.4.3++] (????-??-??) [Full Changelog](https://github.com/nigelm/hassio-remote-backup/compare/v0.3.2...master) ### Fixed +## [v0.4.3] (2021-02-27) + - Updated `hassio-cli` to version 3.1.1 - Modified `run.sh` hassio calls to work with version 3.1.1 - Converted snapshot removal selection logic to a jq filter @@ -21,6 +23,7 @@ The format is based on [Keep a Changelog][keep-a-changelog] this project adheres - Since the previous maintainers do not appear to be keeping up with this, and have not got available docker builds, I have updated the references to point to my repositories. +- Fixed updating changelog on release :-) ## [v0.3.2] (2018-10-12)