Merge branch 'azure-pipelines'

This commit is contained in:
Adrien Ferrand 2020-08-13 18:43:53 +02:00
commit 6d14e836ff
8 changed files with 275 additions and 46 deletions

View File

@ -0,0 +1,5 @@
trigger:
- master
jobs:
- template: templates/integration-jobs.yml

View File

@ -0,0 +1,17 @@
trigger:
branches:
exclude:
- "*"
tags:
include:
- "4.*"
pr: none
stages:
- stage: Build-And-Test
jobs:
- template: templates/integration-jobs.yml
- stage: Release
jobs:
- template: templates/release-jobs.yml

View File

@ -0,0 +1,48 @@
jobs:
- job: build
pool:
vmImage: ubuntu-18.04
steps:
- script: |
docker pull adferrand/backuppc || true
docker build --pull --cache-from adferrand/backuppc -t adferrand/backuppc .
docker save adferrand/backuppc | gzip -c -1 > $(Build.ArtifactStagingDirectory)/docker-backuppc.tar.gz
displayName: Build container
- task: PublishPipelineArtifact@1
inputs:
path: $(Build.ArtifactStagingDirectory)
artifact: docker
displayName: Store Docker artifact
- job: unit-tests
dependsOn: build
pool:
vmImage: ubuntu-18.04
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: docker
path: $(Build.SourcesDirectory)
displayName: Retrieve Docker artifact
- script: |
docker load < docker-backuppc.tar.gz
mkdir -p ./bin
curl -fsSL https://goss.rocks/install | GOSS_DST=./bin sh
GOSS_PATH=./bin/goss GOSS_SLEEP=2 GOSS_FILES_PATH=./tests ./bin/dgoss run adferrand/backuppc
- job: integration-tests
dependsOn: build
pool:
vmImage: ubuntu-18.04
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: docker
path: $(Build.SourcesDirectory)
displayName: Retrieve Docker artifact
- script: |
docker load < docker-backuppc.tar.gz
docker run --name backuppc-integration --detach -p 8080:8080 adferrand/backuppc
sleep 5
output=`curl http://backuppc:password@localhost:8080/BackupPC_Admin`
echo "Expect the backupp configuration page without errors"
grep "The servers PID is" <(echo $output)
docker rm -f backuppc-integration

View File

@ -0,0 +1,45 @@
jobs:
- job: docker
pool:
vmImage: ubuntu-18.04
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: docker
path: $(Build.SourcesDirectory)
displayName: Retrieve Docker artifact
- task: Docker@2
inputs:
command: login
containerRegistry: docker-hub
displayName: Login to DockerHub
- script: |
docker load < docker-backuppc.tar.gz
VERSION=`cat VERSION`
echo "Docker tag is: ${VERSION}"
docker tag adferrand/backuppc adferrand/backuppc:4
docker tag adferrand/backuppc "adferrand/backuppc:${VERSION}"
displayName: Tag and push Docker images to DockerHub
- job: github
pool:
vmImage: ubuntu-18.04
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: 3.8
addToPath: true
displayName: Install Python
- script: |
VERSION=`cat VERSION`
echo "Version is: $version"
echo "##vso[task.setvariable variable=ReleaseVersion;]${VERSION}"
displayVersion: Get version
- script: |
python utils/extract_changelog.py $(ReleaseVersion) > release_$(ReleaseVersion).md
- task: GithubRelease@0
inputs:
gitHubConnection: github.com_adferrand
title: Docker BackupPC $(ReleaseVersion)
releaseNotesFile: $(Build.SourcesDirectory)/release_$(ReleaseVersion).md
addChangeLog: false
displayName: Create GitHub Release

View File

@ -1,16 +1,16 @@
# Changelog # Changelog
## Unreleased ## master - CURRENT
## [4.4.2 - 13/08/2020] ## 4.4.0-2 - 13/08/2020
# Modified # Modified
* Fixed an error about docker instance failing to restart after first run (thanks @tadr0 and @csibbitt with #40) * Fixed an error about docker instance failing to restart after first run (thanks @tadr0 and @csibbitt with #40)
## [4.4.1 - 24/07/2020] ## 4.4.0-1 - 24/07/2020
# Modified # Modified
* Conditionnally create the symlink /bin/bzip2 to prevent regressions * Conditionnally create the symlink /bin/bzip2 to prevent regressions
## [4.4.0 - 21/06/2020] ## 4.4.0 - 21/06/2020
# Added # Added
* Add JSON::RS perl dependency to allow BackupPC metrics in JSON format * Add JSON::RS perl dependency to allow BackupPC metrics in JSON format
* Update documentation about metrics * Update documentation about metrics
@ -20,53 +20,53 @@
* Update perl lib BackupPC::XS to 0.62 * Update perl lib BackupPC::XS to 0.62
* Update rsync-bpc to 3.1.2.2 * Update rsync-bpc to 3.1.2.2
## [4.3.2-6 - 01/06/2020] ## 4.3.2-6 - 01/06/2020
### Changed ### Changed
* Update base docker to Alpine 3.12 * Update base docker to Alpine 3.12
* Update perl lib BackupPC::XS to 0.60 * Update perl lib BackupPC::XS to 0.60
## [4.3.2-5 - 12/04/2020] ## 4.3.2-5 - 12/04/2020
### Added ### Added
* Introduce the Active Directory / LDAP authentication for the BackupPC Web UI. Authentication method * Introduce the Active Directory / LDAP authentication for the BackupPC Web UI. Authentication method
is controlled with the `AUTHENTICATION_METHOD` environment variable, that can be `file` or `ldap` is controlled with the `AUTHENTICATION_METHOD` environment variable, that can be `file` or `ldap`
(@christianuhlmann #23). (@christianuhlmann #23).
## [4.3.2-4 - 01/03/2020] ## 4.3.2-4 - 01/03/2020
### Added ### Added
* Store mails generated by backuppc in /var/log/msmtp.log, and to supervisor stdout * Store mails generated by backuppc in /var/log/msmtp.log, and to supervisor stdout
### Changed ### Changed
* Do not override `EMailFromUserName` parameter in BackupPC when `SMTP_MAIL_DOMAIN` is not set * Do not override `EMailFromUserName` parameter in BackupPC when `SMTP_MAIL_DOMAIN` is not set
## [4.3.2-3 - 01/03/2020] ## 4.3.2-3 - 01/03/2020
### Added ### Added
* Provide GNU tar * Provide GNU tar
### Removed ### Removed
* Remove BusyBox tar * Remove BusyBox tar
## [4.3.2-2 - 01/03/2020] ## 4.3.2-2 - 01/03/2020
### Changed ### Changed
* Switch from circus to supervisor to handle the container processes * Switch from circus to supervisor to handle the container processes
* Install par2cmdline from Alpine packages * Install par2cmdline from Alpine packages
* Clean build dependencies * Clean build dependencies
* Align tests * Align tests
## [4.3.2-1 - 24/02/2020] ## 4.3.2-1 - 24/02/2020
### Changed ### Changed
* Fallback to circus 0.15.0 since 0.16.x is consuming 100% of a CPU in current environment * Fallback to circus 0.15.0 since 0.16.x is consuming 100% of a CPU in current environment
## [4.3.2] - 18/02/2020 ## 4.3.2 - 18/02/2020
### Changed ### Changed
* Update to BackupPC 4.3.2 * Update to BackupPC 4.3.2
* Update base image to Alpine 3.11.3 * Update base image to Alpine 3.11.3
* Update Par2Cmdline to 0.8.1 * Update Par2Cmdline to 0.8.1
## [4.3.1-1] - 07/12/2019 ## 4.3.1-1 - 07/12/2019
### Changed ### Changed
* Update base image to Alpine 3.10.3 * Update base image to Alpine 3.10.3
## [4.3.1] - 17/07/2019 ## 4.3.1 - 17/07/2019
### Added ### Added
* Proper Docker signal handling (eg. SIGINT) by making Circus be the PID 1 * Proper Docker signal handling (eg. SIGINT) by making Circus be the PID 1
* Support TLS in msmtp (thanks to @belaytzev in adferrand/docker-backuppc#22) * Support TLS in msmtp (thanks to @belaytzev in adferrand/docker-backuppc#22)
@ -76,19 +76,19 @@
* Update to rsync-bpc 3.1.2.1 * Update to rsync-bpc 3.1.2.1
* Update perl lib BackupPC::XS to 0.59 * Update perl lib BackupPC::XS to 0.59
## [4.3.0-6] - 18/03/2019 ## 4.3.0-6 - 18/03/2019
### Added ### Added
* Install DejaVu font for a better look and readability of generated RRD graphs in BackupPC UI (#21 from @jkroepke) * Install DejaVu font for a better look and readability of generated RRD graphs in BackupPC UI (#21 from @jkroepke)
## [4.3.0-5] - 10/03/2019 ## 4.3.0-5 - 10/03/2019
### Changed ### Changed
* Use a passphrase of 4 characters (instead of 1) when generating self-signed certificates (`USE_SSL=true`) to be accepted by newest versions of OpenSSL. * Use a passphrase of 4 characters (instead of 1) when generating self-signed certificates (`USE_SSL=true`) to be accepted by newest versions of OpenSSL.
## [4.3.0-4] - 09/03/2019 ## 4.3.0-4 - 09/03/2019
### Changed ### Changed
* Update Alpine base image to 3.9 * Update Alpine base image to 3.9
## [4.3.0-3] - 06/12/2018 ## 4.3.0-3 - 06/12/2018
### Added ### Added
* Hostname in BackupPC instance is now in sync with the container hostname, and can be set using `--hostname` at container start (#12 @Alveel) * Hostname in BackupPC instance is now in sync with the container hostname, and can be set using `--hostname` at container start (#12 @Alveel)
* Add basic integration tests during the CI * Add basic integration tests during the CI
@ -97,33 +97,33 @@
* Update perl lib BackupPC::XS to 0.58 * Update perl lib BackupPC::XS to 0.58
* Update rsync-bpc to 3.1.2.0 * Update rsync-bpc to 3.1.2.0
## [4.3.0-2] - 27/11/2018 ## 4.3.0-2 - 27/11/2018
### Changed ### Changed
* Bugfix: fallback to rsync-bpc to 3.0.9.12 and BackupPC::XS 0.57 because upstream is broken * Bugfix: fallback to rsync-bpc to 3.0.9.12 and BackupPC::XS 0.57 because upstream is broken
* Versions 4.3.0-1 and 4.3.0 are also patched with this bugfix * Versions 4.3.0-1 and 4.3.0 are also patched with this bugfix
## [4.3.0-1] - 26/11/2018 ## 4.3.0-1 - 26/11/2018
### Added ### Added
* Allow to use a pre-existing `server.pem` file mounted into the container to serve the BackupPC UI over https * Allow to use a pre-existing `server.pem` file mounted into the container to serve the BackupPC UI over https
## [4.3.0] - 26/11/2018 ## 4.3.0 - 26/11/2018
### Changed ### Changed
* Update BackupPC to 4.2.0 * Update BackupPC to 4.2.0
* Update perl lib BackupPC::XS to 0.58 * Update perl lib BackupPC::XS to 0.58
* Update rsync-bpc to 3.0.9.13 * Update rsync-bpc to 3.0.9.13
## [4.2.1-3] - 26/11/2018 ## 4.2.1-3 - 26/11/2018
### Added ### Added
* Add support for ACL to rsync-bpc (from @JoelLinn in #9) * Add support for ACL to rsync-bpc (from @JoelLinn in #9)
## [4.2.1-2] - 09/10/2018 ## 4.2.1-2 - 09/10/2018
### Added ### Added
* Set up a complete CI/CD system for this Docker, using CircleCI: docker is now automatically packaged, tested and deployed to Docker Hub * Set up a complete CI/CD system for this Docker, using CircleCI: docker is now automatically packaged, tested and deployed to Docker Hub
### Changed ### Changed
* Hotfix for BZIP2 binary, due to latest Alpine layout modifications, is now applied when the container is created, removing the error `n: /bin/bzip2: File exists` when container is restarted. * Hotfix for BZIP2 binary, due to latest Alpine layout modifications, is now applied when the container is created, removing the error `n: /bin/bzip2: File exists` when container is restarted.
## [4.2.1-1] - 12/09/2018 ## 4.2.1-1 - 12/09/2018
### Added ### Added
* Add and configure circus, an alternative to supervisor, compatible with Python 3, with better control over environment variables propagation, and network sockets supervision (not used yet here) * Add and configure circus, an alternative to supervisor, compatible with Python 3, with better control over environment variables propagation, and network sockets supervision (not used yet here)
* Mandatory perl modules for Backuppc are now installed as pre-compiled binaries from Alpine repos * Mandatory perl modules for Backuppc are now installed as pre-compiled binaries from Alpine repos
@ -138,104 +138,104 @@
* Remove supervisor and its configuration * Remove supervisor and its configuration
* Remove build logic used to compile the mandatory perl modules * Remove build logic used to compile the mandatory perl modules
## [4.2.1] - 14/05/2018 ## 4.2.1 - 14/05/2018
### Changed ### Changed
* Update BackupPC to 4.2.1 * Update BackupPC to 4.2.1
## [4.2.0] - 22/04/2018 ## 4.2.0 - 22/04/2018
### Changed ### Changed
* Update BackupPC to 4.2.0 * Update BackupPC to 4.2.0
## [4.1.5-2] - 02/02/2018 ## 4.1.5-2 - 02/02/2018
### Changed ### Changed
* Update Alpine base image to 3.7 * Update Alpine base image to 3.7
* Update rsync-bpc to 3.0.9.12 * Update rsync-bpc to 3.0.9.12
## [4.1.5-1] - 28/12/2017 ## 4.1.5-1 - 28/12/2017
### Changed ### Changed
* Update rsync-bpc to 3.0.9.11 * Update rsync-bpc to 3.0.9.11
* Update par2cmdline to 0.8.0 * Update par2cmdline to 0.8.0
## [4.1.5] - 04/12/2017 ## 4.1.5 - 04/12/2017
### Changed ### Changed
* Update BackupPC to 4.1.5 * Update BackupPC to 4.1.5
* Update perl lib BackupPC::XS to 0.57 * Update perl lib BackupPC::XS to 0.57
* Update rsync-bpc to 3.0.9.9 * Update rsync-bpc to 3.0.9.9
## [4.1.4] - 29/11/2017 ## 4.1.4 - 29/11/2017
### Changed ### Changed
* Update BackupPC to 4.1.4 * Update BackupPC to 4.1.4
## [4.1.3-10] - 15/11/2017 ## 4.1.3-10 - 15/11/2017
### Added ### Added
* Extends possibilities of `BACKUPPC_UUID`/`BACKUPPC_GUID`: previously existing `UUID`/`GUID` (like 100) in container could not be reused without error. This version now handles it: any `UUID`/`GUID` can be used. * Extends possibilities of `BACKUPPC_UUID`/`BACKUPPC_GUID`: previously existing `UUID`/`GUID` (like 100) in container could not be reused without error. This version now handles it: any `UUID`/`GUID` can be used.
* Extended supervisord logging capabilities over backuppc and lighttpd instances. * Extended supervisord logging capabilities over backuppc and lighttpd instances.
## [4.1.3-9] - 01/10/2017 ## 4.1.3-9 - 01/10/2017
### Added ### Added
* Add missing runtime libraries mandatory for par2 * Add missing runtime libraries mandatory for par2
### Changed ### Changed
* Update par2cmdline to 0.7.4 * Update par2cmdline to 0.7.4
## [4.1.3-8] - 02/09/2017 ## 4.1.3-8 - 02/09/2017
### Changed ### Changed
* TimeZone: fix inverted check of TZ, from PR #5 of @merikz * TimeZone: fix inverted check of TZ, from PR #5 of @merikz
## [4.1.3-7] - 13/08/2017 ## 4.1.3-7 - 13/08/2017
### Changed ### Changed
* Correct MIME types provided by the lighttpd server (issue #4 by @vb4life) * Correct MIME types provided by the lighttpd server (issue #4 by @vb4life)
* Update par2cmdline to 0.7.3 * Update par2cmdline to 0.7.3
## [4.1.3-6] - 02/08/2017 ## 4.1.3-6 - 02/08/2017
### Changed ### Changed
* Add env variable driven timezone * Add env variable driven timezone
## [4.1.3-5] - 23/07/2017 ## 4.1.3-5 - 23/07/2017
### Changed ### Changed
* Disabling strict hostkey checking. As per the comment this should be the intended behavior. * Disabling strict hostkey checking. As per the comment this should be the intended behavior.
## [4.1.3-4] - 26/06/2017 ## 4.1.3-4 - 26/06/2017
### Added ### Added
* Persist log dirs files in /data/backuppc * Persist log dirs files in /data/backuppc
## [4.1.3-3] - 12/06/2017 ## 4.1.3-3 - 12/06/2017
### Changed ### Changed
* Update perl lib BackupPC::XS to 0.56 * Update perl lib BackupPC::XS to 0.56
* Update rsync-bpc to 3.0.9.8 * Update rsync-bpc to 3.0.9.8
## [4.1.3-2] - 08/06/2017 ## 4.1.3-2 - 08/06/2017
### Added ### Added
* Persist htpasswd config for admin access * Persist htpasswd config for admin access
## [4.1.3-1] - 07/06/2017 ## 4.1.3-1 - 07/06/2017
### Changed ### Changed
* Update Alpine base image to 3.6 * Update Alpine base image to 3.6
## [4.1.3] - 06/06/2017 ## 4.1.3 - 06/06/2017
### Changed ### Changed
* Update BackupPC to 4.1.3 * Update BackupPC to 4.1.3
* Update perl lib BackupPC::XS to 0.55 * Update perl lib BackupPC::XS to 0.55
* Update par2cmdline to 0.7.2 * Update par2cmdline to 0.7.2
## [4.1.2-1] - 26/05/2017 ## 4.1.2-1 - 26/05/2017
### Changed ### Changed
* Update perl lib BackupPC::XS to 0.54 * Update perl lib BackupPC::XS to 0.54
* Update rsync-bpc to 3.0.9.7 * Update rsync-bpc to 3.0.9.7
* Disable strict host key checking * Disable strict host key checking
## [4.1.2] - 21/05/2017 ## 4.1.2 - 21/05/2017
### Changed ### Changed
* Update BackupPC to 4.1.2 * Update BackupPC to 4.1.2
## [4.1.1] - 22/04/2017 ## 4.1.1 - 22/04/2017
### Changed ### Changed
* Update BackupPC to 4.1.1 * Update BackupPC to 4.1.1
## [4.1.0] - 22/04/2017 ## 4.1.0 - 22/04/2017
### Changed ### Changed
* Update BackupPC to 4.1.0 * Update BackupPC to 4.1.0
## [4.0.0] - 22/04/2017 ## 4.0.0 - 22/04/2017
### Added ### Added
* Create this docker and its core principles. * Create this docker and its core principles.

View File

@ -1,5 +1,5 @@
# &nbsp;![](https://raw.githubusercontent.com/adferrand/docker-backuppc/master/images/logo_200px.png) adferrand/backuppc # &nbsp;![](https://raw.githubusercontent.com/adferrand/docker-backuppc/master/images/logo_200px.png) adferrand/backuppc
![](https://img.shields.io/badge/tags-4%20latest-lightgrey.svg) [![](https://images.microbadger.com/badges/version/adferrand/backuppc:4.4.0-2.svg) ![](https://images.microbadger.com/badges/image/adferrand/backuppc:4.4.0-2.svg)](https://microbadger.com/images/adferrand/backuppc:4.4.0-2) [![CircleCI](https://circleci.com/gh/adferrand/docker-backuppc/tree/master.svg?style=shield)](https://circleci.com/gh/adferrand/docker-backuppc/tree/master) ![](https://img.shields.io/badge/tags-4%20latest-lightgrey.svg) [![](https://img.shields.io/github/v/release/adferrand/docker-backuppc) ![](https://images.microbadger.com/badges/image/adferrand/backuppc.svg)](https://microbadger.com/images/adferrand/backuppc) [![CircleCI](https://circleci.com/gh/adferrand/docker-backuppc/tree/master.svg?style=shield)](https://circleci.com/gh/adferrand/docker-backuppc/tree/master)
* [Container functionalities](#container-functionalities) * [Container functionalities](#container-functionalities)
* [About BackupPC](#about-backuppc) * [About BackupPC](#about-backuppc)

68
utils/create_release.py Normal file
View File

@ -0,0 +1,68 @@
#!/usr/bin/env python3
import datetime
import os
import subprocess
import sys
from distutils.version import StrictVersion
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
def main():
git_clean = subprocess.check_output(
"git status --porcelain", shell=True, universal_newlines=True,
).strip()
if git_clean:
raise RuntimeError("Error, git workspace is not clean: \n{0}".format(git_clean))
with open(os.path.join(PROJECT_ROOT, "VERSION")) as file_h:
current_version = file_h.read().strip()
print("Current version is: {0}".format(current_version))
print("Please insert new version:")
new_version = str(input())
if StrictVersion(new_version) <= StrictVersion(current_version):
raise RuntimeError(
"Error new version is below current version: {0} < {1}".format(
new_version, current_version
)
)
try:
with open(os.path.join(PROJECT_ROOT, "CHANGELOG.md")) as file_h:
changelog = file_h.read()
today = datetime.datetime.today()
changelog = changelog.replace(
"## master - CURRENT\n",
"""\
## master - CURRENT
## {0} - {1}
""".format(
new_version, today.strftime("%d/%m/%Y")
),
)
with open(os.path.join(PROJECT_ROOT, "CHANGELOG.md"), "w") as file_h:
file_h.write(changelog)
with open(os.path.join(PROJECT_ROOT, "VERSION"), "w") as file_h:
file_h.write(new_version)
subprocess.check_call(
'git commit -a -m "Version {0}"'.format(new_version), shell=True
)
subprocess.check_call("git tag v{0}".format(new_version), shell=True)
subprocess.check_call("git push --tags", shell=True)
subprocess.check_call("git push", shell=True)
except subprocess.CalledProcessError as e:
print("Error detected, cleaning state.")
subprocess.call("git tag -d v{0}".format(new_version), shell=True)
subprocess.check_call("git reset --hard", shell=True)
raise e
if __name__ == "__main__":
main()

View File

@ -0,0 +1,46 @@
#!/usr/bin/env python3
from __future__ import print_function
import os
import re
import sys
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
NEW_SECTION_PATTERN = re.compile(r"^\s*##\s*[\d.-]+\s*-\s*[\d/]+\s*$")
def main():
version = sys.argv[1]
if version == "latest":
section_pattern = NEW_SECTION_PATTERN
else:
section_pattern = re.compile(
r"^\s*##\s*{0}\s*-\s*[\d/]+\s*$".format(version.replace(".", "\\."))
)
with open(os.path.join(ROOT, "CHANGELOG.md")) as file_h:
lines = file_h.read().splitlines()
changelog = []
i = 0
while i < len(lines):
if section_pattern.match(lines[i]):
i = i + 1
while i < len(lines):
if NEW_SECTION_PATTERN.match(lines[i]):
break
changelog.append(lines[i])
i = i + 1
break
i = i + 1
changelog = [entry for entry in changelog if entry]
print("\n".join(changelog))
if __name__ == "__main__":
main()