Personal-files request for liquibase

Liquibase is a database schema management tool.

It supports multiple database systems but needs to be provided with a .jar file of the driver for the database system to connect to.

Maven is a very popular build automation tool for java projects, it stores fetched dependencies at $HOME/.m2/repository. As such it would make it simple for a lot of users to simply use the .jar at that location instead of copying it to a non-dotdirectory manually.

I would like to request permission to use this slot and to have it auto-connect.

Thank you :slight_smile:

It sounds like only read access is required?

Yes, read-only is all it needs, to read the .jar file with the driver.

There might be other common places for .jar files, I’m only familiar with how Maven does it, is there a way for the user to give access to a specific file in a top-level dot directory?

The snapcraft.yaml file is here, it’s the first I’ve made and it’s very simple, if you want to give some suggestions I’d certainly appreciate it :slight_smile:

snapd is designed such that the policies are mediated and granted by snapd, not the user.

The read-only access is perhaps suitable for your snap, but since liquibase needs access to a particular jar file, it actually sounds like a more suitable location would be within liquibase’s normal snap directories, such as SNAP_USER_COMMON. In this manner, you could do something like the following pseudo-code:

if 'SNAP_USER_COMMON' in os.environ and jarfile in os.environ['SNAP_USER_COMMON']/*:
    liquibase uses os.path.join(os.environ['SNAP_USER_COMMON'], jarfile)
    print("Please copy jar of database driver to %s" % os.environ['SNAP_USER_COMMON'])

In this manner your snap will work for any user, not just maven users.

I’d like to avoid having to copy the driver .jar file someplace else when possible, but a user can already do that anyway if needed because I’m also requesting the home plug (which is needed to read the files processed by liquibase to apply changes to the desired database).

I’d prefer to get read access to all common locations for auto-downloaded .jar files than to force all users to copy the file manually, it seems like a worse experience (how do you then deal with updates, for example?).

I’m ‘ok’ with granting the use of personal-files for read-only access provided the snap uses:

    interface: personal-files
    - $HOME/.m2/repository

but since this path is understood to not be owned by this snap, I’m disinclined to allow auto-connection. I suggest instead users be encouraged to put files in an area that is already allowed by the snap.

+1 for use of personal-files as per above, -1 for auto-connection.

@reviewers - can others vote on this?

1 Like

@jdstrand, I also vote: +1 for use of personal-files as per above, -1 for auto-connection.

2 votes for, 0 against for use of personal-files using the dot-m2-repository reference

0 votes for, 2 against auto-connection of personal-files. This is now live.

@ric2b - for your snap to pass automated review, please adjust to use ’ dot-m2-repository’ instead of ‘maven-repos’.

Please note that this currently also requires a change to the review-tools, which I’ve done, but it is not in production yet. Feel free to upload but a reviewer will need to manually approve until it is.

Thank you for the approval, pushed to devel channels :slight_smile: