Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/init command #273

Open
wants to merge 38 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
398fc8f
Add init command
nheeb Jul 25, 2024
73b2949
Init with or without oauth
nheeb Aug 20, 2024
6c4409a
Testing the workflow
nheeb Aug 29, 2024
8d98335
temporarily storing the ci file here
nheeb Sep 2, 2024
983b170
automated change of github project action workflow settings
nheeb Sep 2, 2024
96553f6
more logging in refresh token usage
nheeb Sep 2, 2024
42aefd9
log as error
nheeb Sep 2, 2024
bddbb27
less prints
nheeb Sep 3, 2024
ec62b74
Merge branch 'develop' into feature/init-command
nheeb Sep 3, 2024
688e17b
Update src/hermes/commands/init/github_permissions.py
nheeb Sep 4, 2024
62a121a
Update src/hermes/commands/init/github_permissions.py
nheeb Sep 4, 2024
38f1b5c
Update src/hermes/commands/init/base.py
nheeb Sep 4, 2024
7e7984a
Update src/hermes/commands/init/github_secrets.py
nheeb Sep 4, 2024
39eb860
Removed Flask, Abstract OAuth Script, Moved CI Template
nheeb Sep 11, 2024
6c23751
Small quotation marks change
nheeb Sep 11, 2024
df7c7f9
trying to satisfy flake8 (but it doesnt understand fstrings)
nheeb Sep 11, 2024
5f1c49b
Added Device Flow as alternative for classic Oauth in Browser
nheeb Sep 12, 2024
f408d3d
Fallback to manual if oauth fails
nheeb Sep 12, 2024
112dc10
Fixed createconsolehyperlinks
nheeb Sep 13, 2024
630ba71
Fixed flake8, ZenodoOauth works without secret, hermestoml created fr…
nheeb Sep 16, 2024
77d87d8
flake8 is never happy
nheeb Sep 16, 2024
f83dd09
Update invenio.py, added a space
nheeb Sep 16, 2024
0651c78
Support for Gitlab (without OAuth)
nheeb Oct 1, 2024
e02fa11
Merged scripts dealing with github
nheeb Oct 9, 2024
8705663
Added auth for gitlab
nheeb Oct 16, 2024
64a5dce
gitlab oauth testing in progress
nheeb Oct 18, 2024
687e804
Fixed fstring
nheeb Oct 18, 2024
6f35a05
raise exception for debugging
nheeb Oct 18, 2024
69037f5
Deactivated Zenodo Oauth for now
nheeb Oct 25, 2024
44e507e
flake8
nheeb Oct 29, 2024
8ee0e50
Fixed gitlab variable creation
nheeb Oct 29, 2024
7ce44d7
Seperated the init process into steps
nheeb Oct 30, 2024
6dfb610
Merge branch 'develop' into feature/init-command
nheeb Oct 30, 2024
395ba09
Renamed scripts + small changes
nheeb Oct 31, 2024
63f5855
hermes init without git possible
nheeb Nov 6, 2024
a37aa33
Init: Choosing files and target branch
nheeb Nov 11, 2024
7ec9887
fixed fstring for flake8
nheeb Nov 22, 2024
bbf9609
removed a space for flake8
nheeb Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 137 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pyparsing = "^3.0.9"
requests = "^2.28.1"
pydantic = "^2.5.1"
pydantic-settings = "^2.1.0"
requests-oauthlib = "^2.0.0"
pynacl = "^1.5.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.1.1"
Expand Down
1 change: 1 addition & 0 deletions src/hermes/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from hermes.commands.base import HermesHelpCommand
from hermes.commands.clean.base import HermesCleanCommand
from hermes.commands.init.base import HermesInitCommand
from hermes.commands.curate.base import HermesCurateCommand
from hermes.commands.harvest.base import HermesHarvestCommand
from hermes.commands.process.base import HermesProcessCommand
Expand Down
3 changes: 2 additions & 1 deletion src/hermes/commands/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from hermes import logger
from hermes.commands import HermesHelpCommand, HermesCleanCommand, HermesHarvestCommand, HermesProcessCommand, \
HermesCurateCommand, HermesDepositCommand, HermesPostprocessCommand
HermesCurateCommand, HermesDepositCommand, HermesPostprocessCommand, HermesInitCommand
from hermes.commands.base import HermesCommand


Expand All @@ -36,6 +36,7 @@ def main() -> None:

for command in (
HermesHelpCommand(parser),
HermesInitCommand(parser),
HermesCleanCommand(parser),
HermesHarvestCommand(parser),
HermesProcessCommand(parser),
Expand Down
15 changes: 15 additions & 0 deletions src/hermes/commands/deposit/invenio.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,21 @@ def __init__(self, command: HermesDepositCommand, ctx: CodeMetaContext, client=N

if client is None:
auth_token = self.config.auth_token

# TODO reactivate this code again, once we use Zenodo OAuth again (once the refresh token works)
# If auth_token is a refresh-token, get the auth-token from that.
# if str(auth_token).startswith("REFRESH_TOKEN:"):
# _log.debug(f"Getting token from refresh_token {auth_token}")
# # TODO How do we know if this targets sandbox or not?
# # Now we assume it's sandbox
# connect_zenodo.setup(True)
# tokens = connect_zenodo.oauth_process() \
# .get_tokens_from_refresh_token(auth_token.split("REFRESH_TOKEN:")[1])
# _log.debug(f"Tokens: {str(tokens)}")
# auth_token = tokens.get("access_token", "")
# _log.debug(f"Auth Token: {auth_token}")
# # TODO Update the secret (github/lab token is needed)

if not auth_token:
raise DepositionUnauthorizedError("No valid auth token given for deposition platform")
self.client = self.invenio_client_class(self.config,
Expand Down
2 changes: 2 additions & 0 deletions src/hermes/commands/init/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SPDX-FileCopyrightText: 2024 Forschungszentrum Jülich
# SPDX-License-Identifier: Apache-2.0
Loading
Loading