Skip to main content

Enables powerful automation from a subversion repository.

Project description

Welcome to svnpublish, a tool to enable automated publishing (and any other arbitrary commands to be executed) when updates are made to a subversion version control repository.

Publishing configurations are tied to either the entire repository or restricted to subdirectories, referred to as a publishing point in svnpublish-speak.

Project

TL;DR

Install:

$ easy_install svnpublish
$ mkdir -p /etc/svnpublish
$ svnpublish --init-options > /etc/svnpublish/myrepos.yaml

# edit the self-documenting configuration file:
$ vi /etc/svnpublish/myrepos.yaml

Put in your REPOSITORY/hooks/post-commit:

#!/bin/sh
svnpublish --options /etc/svnpublish/myrepos.yaml "$@"

If running in asynchronous mode (recommended):

$ apt-get install daemontools-run

# create the service directory with the user:group that runs svnpublish
$ svnpublishd --init-service --service-dir /etc/service/svnpublishd --user www-data:www-data

# review the output and adjust the service configuration:
$ vi /etc/service/svnpublishd/run /etc/service/svnpublishd/log/run

# grant the user running svnpublish access to HUP the service
# (this assumes that "#includedir /etc/sudoers.d" is in "/etc/sudoers.d",
#  that the user is www-data, and that svc is located in /usr/bin)
$ echo "www-data ALL = NOPASSWD: /usr/bin/svc -h /etc/service/svnpublishd" > /etc/sudoers.d/svnpublishd

# start the service
$ rm -f /etc/service/svnpublishd/down
$ svc -u /etc/service/svnpublishd

Overview

TODO: add docs

Global Configuration

The best way to set the initial svnpublish options is to use the --init-options flag, which outputs a list of all available options accompanied with documentation. The recommended approach is to create a per-repository configuration in /etc/svnpublish/ which can be done as follows:

$ sudo mkdir -p /etc/svnpublish
$ svnpublish --init-options | sudo tee /etc/svnpublish/REPOSITORY.yaml > /dev/null
$ sudo vi /etc/svnpublish/REPOSITORY.yaml

And then modifying all of the options as needed. At a minimum, the following options should be set:

  • admin

  • label

  • name

  • reposUrl

  • genemail.default.headers.from

Publishing Point Configuration

TODO: add docs

publish:

  ENGINE:

    ATTRIBUTE: VALUE

Example:

publish:

  # send an email notification
  - engine:       email
    mailfrom:     noreply@example.com
    recipients:
                  - user1@example.com
                  - user2@example.com

  # update an RSS (atom) feed
  - engine:       rss
    window:       50
    label:        Repository Feed
    output:       /var/www/rss/output.xml
    feedUrl:      https://svn.example.com/rss/output.xml

  # export the repository to the file system
  - engine:       export
    path:         /var/www/example.com
    fixate:
                  - { engine: fingerprint }
                  - { engine: fingerprint, path: htdocs/fingerprint }

  # export the repository to a remote host
  - engine:       export
    remote:       svnpublish@example.com
    keychain:     /home/svnpublish/.keychain
    path:         /var/www/example.com
    fixate:
                  - { engine: fingerprint }
                  - { engine: fingerprint, path: htdocs/fingerprint }

Encrypted Email

SvnPublish can be configured to send PGP-encrypted email, which protects the contents of the emails from being read by unintended recipients. Follow the instructions in https://pypi.python.org/pypi/genemail to setup a GPG-home directory, then adjust the svnpublish “options.yaml” file to include the PgpModifier. For example:

# ... other configurations ...

genemail:
  modifier:
    class:   'genemail.PgpModifier'
    sign:    'noreply@example.com'
    gpg_options:
      gnupghome: '/path/to/gpghome'

Asynchronous Operation

Svnpublish can run in asynchronous mode (the recommended approach), which means that commits happen quickly, and an asynchronous process then takes care of executing the publishing. This asynchronous process, svnpublishd, has been geared at being run by DJB’s daemontools. On debian-based systems, daemontools can be easily installed with:

$ apt-get install daemontools-run

The svnpublishd service directory can be created automatically by a call to svnpublishd --init-service OPTIONS, which creates all of the directories, “run” scripts, and default logging options necessary to run svnpublishd, tailored for the specified user:group that svnpublish runs as. It is important to ensure this user:group setting is correct, as otherwise svnpublish and svnpublishd cannot communicate. The user:group that svnpublish runs as is usually the owner of the subversion repository. For example, if your svnpublish runs as www-data:www-data, then something like this should work:

$ svnpublishd --init-service --service-dir /etc/service/svnpublishd --user www-data:www-data

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

svnpublish-2.0.6.tar.gz (66.8 kB view details)

Uploaded Source

File details

Details for the file svnpublish-2.0.6.tar.gz.

File metadata

  • Download URL: svnpublish-2.0.6.tar.gz
  • Upload date:
  • Size: 66.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for svnpublish-2.0.6.tar.gz
Algorithm Hash digest
SHA256 f3f6e480c38d04fd96a9a4b347efad04f795216c65d8dd3fbff08248aeace115
MD5 88c4e5da4484cff65b771d60d7b83e6b
BLAKE2b-256 79c91a06a4dbbd09633730099088cadf83e8a7352df251d6ba7dc558e361c2d0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page