-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Latest ec3 withouth k8s
- Loading branch information
Showing
5 changed files
with
288 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/python3 | ||
|
||
import argparse | ||
import json | ||
import requests | ||
|
||
|
||
def get_input_args(): | ||
parser = argparse.ArgumentParser(description=( | ||
'Prepare requests for FAIR assessment tool' | ||
)) | ||
parser.add_argument( | ||
'-OID', | ||
metavar='object_identifier', | ||
type=str, | ||
help='Object Persistent Identifier. I.e.: DOI, Handle, LandingPage ' | ||
'URL, etc.', | ||
required=True | ||
) | ||
parser.add_argument( | ||
'--tool_endpoint', | ||
metavar='tool_endpoint', | ||
type=str, | ||
help='Tool endpoint to perform HTTP request. Example: ' | ||
'http://localhost:1071/fuji/api/v1/evaluate', | ||
required=True | ||
) | ||
parser.add_argument( | ||
'-T', | ||
metavar='metadata_service_type', | ||
choices=['oai_pmh', 'sparql', 'ogc_csw'], | ||
type=str, | ||
help='Type of the Metadata service. One of: "oai_pmh", "sparql" or ' | ||
'"ogc_csw".' | ||
) | ||
parser.add_argument( | ||
'-E', | ||
metavar='metadata_service_endpoint', | ||
type=str, | ||
help='Metadata service endpoint URL.' | ||
) | ||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
args = get_input_args() | ||
url = args.tool_endpoint | ||
headers = {'Content-Type': 'application/json'} | ||
data = { | ||
"object_identifier": args.OID, | ||
"metadata_service_endpoint": args.E, | ||
"metadata_service_type": args.T, | ||
"test_debug": True, | ||
"use_datacite": True | ||
} | ||
r = requests.post(url, data=json.dumps(data), headers=headers) | ||
return json.dumps(r.text) | ||
|
||
|
||
print(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM python:3.9-alpine | ||
LABEL maintainer="Pablo Orviz <[email protected]>" | ||
RUN apk --no-cache add build-base git | ||
RUN python3 -m pip install GitPython==3.1.27 | ||
COPY get_git_tags.py /usr/bin | ||
RUN chmod +x /usr/bin/get_git_tags.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
import git | ||
|
||
|
||
def get_input_args(): | ||
parser = argparse.ArgumentParser(description=( | ||
'Get git release tags associated with the current commit ID.' | ||
)) | ||
parser.add_argument( | ||
'--repo-path', | ||
type=str, | ||
default='.', | ||
help='Path to the git repository' | ||
) | ||
|
||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
args = get_input_args() | ||
|
||
repo = git.Repo(args.repo_path) | ||
try: | ||
tags = repo.git.describe('--exact-match', 'HEAD') | ||
tag_list = tags.split('\n') | ||
except git.exc.GitCommandError as e: | ||
tag_list = [] | ||
|
||
return tag_list | ||
|
||
|
||
print(main()) |
Oops, something went wrong.