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
Authorization: Users are redirected to Zenodo for OAuth2 authentication. To create new OAuth Application go to New OAuth Application.
Token Retrieval: After successful login, an access token is retrieved and stored in the session.
File Preparation: Files and folders are processed, zipped if necessary, and prepared for upload. The manifest.rdmc file is included if available.
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:
Go to the GitLab project:
Navigate to the project in GitLab.
Navigate to CI/CD Settings:
In the left sidebar, click on Settings > CI / CD.
Expand the Variables Section:
Scroll down to the Variables section and click to expand it.
Add a New Variable:
Click the Add Variable button.
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.
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:
Go to the GitHub repository:
Navigate to the repository in GitHub.
Navigate to Repository Settings:
Click on the Settings tab of the repository.
Navigate to Secrets:
In the left sidebar, click on Secrets and variables > Actions.
Add a New Secret:
Click on the New repository secret button.
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
.
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.