Deployment#

This page explains how to deploy code from source shelves to the deployment repository.

As explained in project structure, Code Shelf is split into two main parts, the source shelves that are named according to instruments or other categories (e.g., SciCat) and the deployment repository “deploy”. The main branch of the latter can be considered a staging ground. To mark code as ready for use, it needs to be tagged with a tag matching our CalVer format YY.MM.DD.micro.

Users should only download code from “deploy” and VISA will also pull code from that repository at a tag.

Note

Please note that only project maintainers are allowed to push and merge to main and create tags. The list of maintainers is deliberately kept short. Please contact a “maintainer” or “owner” from the list of project members to help you out.

Staging code#

When staging code, i.e., copying it to “deploy”, we need to insert some additional tracking metadata. This is handled by the shelf deploy command.

Follow these steps:

  1. Clone the deploy repo if not already done:

    git clone https://git.esss.dk/dram/code-shelf/deploy.git
    

    This guide assumes that “deploy” is cloned next to your source shelves, e.g.:

    code-shelf
    |- deploy
    |- nmx
    |- odin
    
  2. cd into the instrument folder you want to deploy.

  3. Make sure your local instrument folder is checked out at the main branch and that the folder is clean with

    git status
    

    This is required to properly annotate the notebooks and scripts with metadata.

  4. Run

    pixi run shelf deploy ../deploy
    

    This should fill in the required metadata and copy all files to ../deploy.

  5. Commit and push the changes:

    cd ../deploy
    git status
    

    Make sure only there are no unintentional changes.

    git commit -am'<COMMIT-MESSAGE>'
    git push
    

This example pushes directly to main which should be fine as long as you coordinate with your colleagues. But of course, you may use a branch and open a merge request instead. This is necessary if you are not a maintainer.

Tagging code#

Create a new tag at git.esss.dk/dram/code-shelf/deploy/-/tags Use the same CalVer format as for notebooks and scripts:

YY.MM.DD.micro

Note that all tags are protected.

Details for developers#

The shelf deploy command copies more than just notebooks and scripts. It also copies the files in bibliotekar/src/bibliotekar/resources. So please check that you do not accidentally overwrite changes to those files in the output repo. If you want to change, e.g., the README of the deployment repo, please do so in the corresponding resource in the Bibliotekar repo.