GitLab to Zenodo

This page details the steps needed to automatise the publication to the ESCAPE OSSR from a gitlab project.

You would need to follow these steps just once! After this, every time you create a new release of your project, it will be automatically uploaded and published to the OSSR.

Note that you can test the upload first using the Zenodo sandbox.

Upload from GitLab in 4 steps

1. Include an ESCAPE CodeMeta metadata file

See the metadata description and place the codemeta.json file in the root directory of your repository (it replaces completely the .zenodo.json file that should therefore be removed). Check the conformity to our standards! If required fields in the file are missing, the upload will not work.

3. Into your .gitlab-ci.yml file

Add the following code snippet.

Important note. Please read the full documentation of the page !

  • The first time the CI is run, remove -id $ZENODO_PROJECT_ID to create a new record.

  • After that, you need to create the CI variable $ZENODO_PROJECT_ID (or $SANDBOX_ZENODO_PROJECT_ID) using the newly created record ID.

  • If you don’t, the next release will either create a new record instead of updating the existing one, or fail.

To recover and save the project ID:

  • Go to https://zenodo.org/deposit (or https://sandbox.zenodo.org/deposit)

  • Click into your just uploaded project

  • From your browser search bar, just copy the number (your deposit id) that it is included in the https direction - ex: https://zenodo.org/record/3884963 –> just copy 3884963

  • Save it as a new environment variable in your GitLab project: Go to your GitLab project. Click on Settings –> CI/CD –> Variables –> Add variable –> KEY=ZENODO_DEPOSIT_ID or SANDBOX_ZENODO_PROJECT_ID and fill the value with the deposit id.

4. ‘One-click-build-and-publish’

  1. Go to your GitLab project.

  2. Click on Project overview –> Releases –> New release

  3. In order to see your project on zenodo, make sure the pipeline is run.

What happens during the GitLab-Zenodo CI process

OSSR-CI-diagram

Trigger the GitLabCI and publish your project to Zenodo.

  • If you have included the deploy stage into your .gitlab-ci.yml file, the gitlab runner will download and use a Docker container specifically created for this purpose.

  • The Docker container is available at the GitLab in2p3 container registry.

  • This container contains the eOSSR library installed in order to process your upload to the OSSR

  • The GitLab runner will perform the following stages:

    1. Search for the last release / commit of your project.

    2. Search for a CodeMeta metadata file and convert it to the Zenodo compliant format.

    3. Upload a new record version to the OSSR. The entry will contain the information within the metadata files.