Skip to main content

ostree-push

Background

ostree-push uses ssh to push commits from a local OSTree repo to a remote OSTree repo. This is to fill a gap where currently you can only pull commits in core ostree. To publish commits to a remote repository, you either have to pull from the local repo to the remote repo or use an out of band mechanism like rsync.

Both approaches have significant limitations. To pull over the network, only http is supported. So, in addition to having to login on the remote machine and run ostree pull, the local repository needs to be served over http. This means your build machine needs to be an http server with appropriate configuration in addition to simply making commits. This pushes the builds to be done on the public repository server, which prevents reasonable separation of duties and makes multiarch repositories impossible.

Using rsync for publishing has some major benefits since only updated objects are published. However, it has no concept of the OSTree object store or refs structures. There are a few problems deriving from this issue. First, objects are published in sort order, but this means that objects can be published before their children. In the most extreme case, a commit object could be published before it's complete. The remote repo would assume this commit object was valid even though some children might be missing. Second, the refs might get updated before the commit objects are in place. If a client pulls while rsync is publishing, it may attempt to pull an incomplete or entirely missing commit. Finally, rsync will push the objects directly into the store rather than using a staging directory like pull or commit do. If rsync is interrupted, it could leave partial objects in the store.

ostree-push tries to offer functionality like git where commits can be pushed over ssh to avoid these issues.

Operation

When ostree-push is started, it first starts a local HTTP server providing the contents of the local ostree repo. It then connects to the remote host with ssh and tunnels the HTTP server port through the SSH connection. Finally, it runs ostree-receive on the remote host with the URL of the tunneled HTTP server. ostree-receive then creates a temporary remote using this URL and pulls the desired refs from it.

In essence, ostree-push and ostree-receive coordinate to pull from the local repo to a remote repo while avoiding the limitations described above. Namely, no HTTP server needs to be running and no port needs to be exposed on the local host. Both resources are created temporarily and only exposed to the remote host through the secure SSH connection.

Installation

Use pip to install the otpush package and the ostree-push and ostree-receive scripts. From a git checkout, run:

pip install .

If ostree-receive is not in a default PATH location, it may not be located when run in the environment spawned by the SSH server. As a workaround, make a symbolic link in a standard location:

sudo ln -s /path/to/ostree-receive /usr/bin/ostree-receive

In order to restrict SSH usage to only running ostree-receive, the ostree-receive-shell script can be used as a login shell. This way someone with SSH access to the remote machine cannot run arbitrary commands as the user owning the repositories. To use it, set the login shell of the repo owner to ostree-receive-shell:

sudo chsh -s /path/to/ostree-receive-shell <user>

ostree-receive-shell will also append the directory it's installed in to PATH to allow ostree-receive to be found in non-standard locations. In that scenario, the symbolic link to ostree-receive described above is not needed.

Both ostree-push and ostree-receive require the OSTree GObject Introspection bindings. Typically these would be installed from the host distro. On Debian systems the package is gir1.2-ostree-1.0 while on RedHat systems they are in the ostree-libs package.

ostree-push relies on the connection sharing and port forwarding features of OpenSSH and is unlikely to work with another SSH client. Similarly, ostree-receive has only be tested with the OpenSSH server, but it might work correctly with other SSH servers.

Configuration

ostree-receive can be configured from YAML formatted files. It will load ~/.config/ostree/ostree-receive.conf and /etc/ostree/ostree-receive.conf or a file specified in the OSTREE_RECEIVE_CONF environment variable. See the example ostree-receive.conf file for available options.

Testing

A test suite is provided using pytest. Most of the time simply running pytest from a git checkout will run it correctly. tox can also be used to automate running the test suite in a prepared Python environment.

In addition to the ostree-push dependencies, many of the tests depend on using OpenSSH sshd locally. On both Debian and RedHat systems this is available in the openssh-server package.

Metadata

Release files for ostree-push 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ostree-push 1.2.0
File Size Uploaded
ostree-push-1.2.0.tar.gz 61.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ostree-push 1.2.0
File Interpreter ABI Platform
ostree_push-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 93.2 kB

Release files / ostree-push-1.2.0.tar.gz

Download URL ostree-push-1.2.0.tar.gz
Size 61.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bb113587f9190b50e8af89523cf1611d650194d390ee50ab10a136db8af1117a
BLAKE2b-256 checksum
How to use checksums
b516afdb4a31c82ac1917d57f2e513b385829cc614360f73dcf8f32e4b43958e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / ostree_push-1.2.0-py3-none-any.whl

Download URL ostree_push-1.2.0-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
377a611f3b142240f81d7f2dc4a50159e6113955a8e79892e3a5eade039056f2
BLAKE2b-256 checksum
How to use checksums
672ba52ddc282122305ed681ac07a694d5ab1b93787b9f50436e7e8a24837842
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page