Zenodo Integration

Overview

This section provides an overview of the Zenodo integration functionality, detailing how to implement and manage the upload of artifacts to Zenodo, along with the associated metadata and manifest.rdmc file.

Pre-requisites

  • For settings, see Zenodo Integration in the Settings.

Workflow Overview

  1. Authorization: Users are redirected to Zenodo for OAuth2 authentication. To create new OAuth Application go to New OAuth Application.

  2. Token Retrieval: After successful login, an access token is retrieved and stored in the session.

  3. File Preparation: Files and folders are processed, zipped if necessary, and prepared for upload. The manifest.rdmc file is included if available.

  4. Upload: Files are uploaded to Zenodo using the Zenodo API, and metadata is associated with the deposition.

Zenodo Credentials Configuration (locally)

In order to use Zenodo integration, create a .env file in the root directory. The .env file looks like:

ZENODO_CLIENT_ID=your_client_id
ZENODO_CLIENT_SECRET=your_client_secret
  • ZENODO_CLIENT_ID: The client ID used to authenticate with Zenodo.

  • ZENODO_CLIENT_SECRET: The client secret associated with the ZENODO_CLIENT_ID.

Zenodo Credentials Configuration (CI/CD)

To configure Zenodo configurations into the CI/CD environment, need to set the following environment variables:

  • ZENODO_CLIENT_ID: The client ID for Zenodo.

  • ZENODO_CLIENT_SECRET: The client secret for Zenodo.

These environment variables can be set in GitLab CI/CD and GitHub Actions as described below.

1. GitLab CI/CD: Setting Environment Variables

To configure Zenodo credentials as environment variables in GitLab CI/CD, follow these steps:

  1. Go to the GitLab project:

    Navigate to the project in GitLab.

  2. Navigate to CI/CD Settings:

    In the left sidebar, click on Settings > CI / CD.

  3. Expand the Variables Section:

    Scroll down to the Variables section and click to expand it.

  4. Add a New Variable:

    Click the Add Variable button.

  5. Configure the Variable:

    • Key: Enter the name ZENODO_CLIENT_ID for the Zenodo client ID.

    • Value: Enter the value for the variable, e.g., 123456789 for the Zenodo client ID.

    • Type: Leave it as Variable.

    • Environments: Leave as * to apply the variable to all environments.

    • Visibility: Check this box to mask the variable in the job logs.

  6. Repeat for ZENODO_CLIENT_SECRET:

    Add another variable for ZENODO_CLIENT_SECRET following the same process.

After setting these variables, GitLab will securely use them during the CI/CD pipelines.

2. GitHub Actions: Setting Environment Variables

To configure Zenodo credentials as environment variables in GitHub Actions, follow these steps:

  1. Go to the GitHub repository:

    Navigate to the repository in GitHub.

  2. Navigate to Repository Settings:

    Click on the Settings tab of the repository.

  3. Navigate to Secrets:

    In the left sidebar, click on Secrets and variables > Actions.

  4. Add a New Secret:

    Click on the New repository secret button.

  5. Configure the Secret ZENODO_CLIENT_ID:

    • Name: Enter ZENODO_CLIENT_ID in the name field.

    • Value: Enter the value for the Zenodo client ID, e.g., 123456789.

  6. Configure the Secret ZENODO_CLIENT_SECRET:

    • Name: Enter ZENODO_CLIENT_SECRET in the name field.

    • Value: Enter the value for the Zenodo client secret, e.g., 123456789.

After setting these secrets, GitHub Actions will securely use them during the CI/CD workflows.

Error Handling

  • If the access token is not received, an error message is displayed, and the upload process is halted.

  • The Zenodo API responds with errors if the files cannot be uploaded or if there are authentication issues.