ZenodoCI
Library to manage an upload to Zenodo through its REST API.
Continuous Deployment to Zenodo
The library was developed specifically to perform a deploy stage (to the Zenodo repository) in a GitLab CI pipeline that could be implemented in any external project. It provides a module to handle the upload of specified file(s) to the ESCAPE2020 Zenodo community. Please only upload stable versions/releases of source code and/or image containers!
The deploy
stage in the CI pipeline (see the .gitlab-ci.yml
file) will make use of the zenodoapi
library and
the built Singularity container created in the previous CI stage (check the ESCAPE project template
) to:
- Either upload the desired file(s) to the ESCAPE community in Zenodo.
- Either upload a new version of an existing entry to Zenodo.
The repository_information.json
file must be filled up before pushing to the GitLab repository. This file will be
used to fill up the compulsory information that a Zenodo entry must contain. Also, depending on the case, the
corresponding python script (upload_new_deposit.py
or upload_new_version_of_deposit.py
) must be adapted and
included into the .gitlab-ci.yml
file with its corresponding arguments (examples are shown in the yml file).
Zenodo token & GitLab CI environment variable
To connect the GitLab repository with Zenodo in an autonomous way, a personal access token must be created. This token is assigned to a single Zenodo account, and it will allow the interaction with (sandbox.)zenodo through its API. To create the token:
- Go to (sandbox)zenodo.org
- Account --> Applications --> Personal access token --> New token.
This token will be passed later in the deployment stage of the CI pipeline. For not sharing publicly your personal token, you should create an environment variable in your GitLab repository. This way, the token could be used as a variable without revealing its value. To create an an environment variable:
- Go to your GitLab repository.
- Settings --> CI/CD --> Variables --> Add variable --> Fill the fields --> Mask your variable(s) !!
The environment variable will look like this:
$ python .zenodoci/upload_new_deposit.py -i build -t $ZENODO_TOKEN -s False