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

Merge v1.43 to production #142

Merged
merged 8 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
43 changes: 43 additions & 0 deletions .github/workflows/index_dump.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import argparse
import os
import requests
import json
import sys

def set_args():
parser = argparse.ArgumentParser(
description="Send request to index data dump")
parser.add_argument('-u', '--url', help='URL to index dump file', required=True)
parser.add_argument('-f', '--file', help='name of dump file to be indexed', required=True)
parser.add_argument('-e', '--dataenv', help='data env to retrieve dump file from', required=True)
parser.add_argument('-he', '--headers', help='key:value json string; headers to authenticate request', required=True, type=json.loads)
args = parser.parse_args()
return args

def send_request(url, headers):
try:
response = requests.get(url,headers=headers)
except requests.exceptions.RequestException as e:
raise e
return response

def main():
args = set_args()
url = args.url
filename = args.file
dataenv = args.dataenv
headers = args.headers
full_url = os.path.join(url, filename, dataenv)
print(full_url)
response = send_request(full_url, headers)
if not(response.ok):
print(response.text)
sys.exit(1)
elif response.ok:
print(response.text)
sys.exit(0)


if __name__ == "__main__":
main()

78 changes: 78 additions & 0 deletions .github/workflows/prod_index_dump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: PROD index full data dump
on:
workflow_dispatch:
inputs:
release-dump:
type: string
description: Name of existing release dump file to index, without .zip extension (ex v1.41-2024-02-13-ror-data)
schema-version:
required: true
description: Schema version to index
default: 'test'
type: choice
options:
- v1
- v2
data-env:
required: true
description: ROR data env (test uses ror-data-test repo, prod uses ror-data)
default: 'test'
type: choice
options:
- test
- prod


env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}

jobs:
check_permission:
runs-on: ubuntu-latest
if: github.event.ref == 'refs/heads/master'
steps:
- name: Get Permission
uses: octokit/[email protected]
id: get_permission
with:
route: GET /repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: output
run: |
export role_name=${{ fromJson(steps.get_permission.outputs.data).role_name }}
if [[ "$role_name" == "admin" ]]; then
exit 0
else
exit 1
fi
index-dump:
runs-on: ubuntu-latest
if: github.event.ref == 'refs/heads/master'
needs: check_permission
steps:
- name: checkout
uses: actions/checkout@v2
- name: Index dump file
id: indexdatadump
run: |
cd .github/workflows
python -m pip install --upgrade pip
pip install requests==2.23.0
if [[ ${{ github.event.inputs.schema-version }} == "v1" ]]; then
python index_dump.py -u ${{ secrets.INDEX_DUMP_PROD_API_URL }} -f ${{ github.event.inputs.release-dump }} -e ${{ github.event.inputs.data-env }} -he ${{ secrets.INDEX_PROD_API_HEADERS }}
else
python index_dump.py -u ${{ secrets.INDEX_DUMP_PROD_API_URL_V2 }} -f ${{ github.event.inputs.release-dump }} -e ${{ github.event.inputs.data-env }} -he ${{ secrets.INDEX_PROD_API_HEADERS }}
fi
- name: Notify Slack
if: always()
uses: edge/simple-slack-notify@master
env:
SLACK_WEBHOOK_URL: ${{ secrets.CURATOR_SLACK_WEBHOOK_URL }}
with:
channel: '#ror-curation-releases'
color: 'good'
text: 'PROD full index from dump status: ${{ steps.indexdatadump.outcome }}. From file: ${{ github.event.inputs.release-dump }}. Schema version: ${{ github.event.inputs.schema-version }}. Data env: ${{ github.event.inputs.data-env }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}'

78 changes: 78 additions & 0 deletions .github/workflows/staging_index_dump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: STAGING index full data dump
on:
workflow_dispatch:
inputs:
release-dump:
type: string
description: Name of existing release dump file to index, without .zip extension (ex v1.41-2024-02-13-ror-data)
schema-version:
required: true
description: Schema version to index
default: 'test'
type: choice
options:
- v1
- v2
data-env:
required: true
description: ROR data env (test uses ror-data-test repo, prod uses ror-data)
default: 'test'
type: choice
options:
- test
- prod


env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}

jobs:
check_permission:
runs-on: ubuntu-latest
if: github.event.ref == 'refs/heads/staging'
steps:
- name: Get Permission
uses: octokit/[email protected]
id: get_permission
with:
route: GET /repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: output
run: |
export role_name=${{ fromJson(steps.get_permission.outputs.data).role_name }}
if [[ "$role_name" == "admin" ]]; then
exit 0
else
exit 1
fi
index-dump:
runs-on: ubuntu-latest
if: github.event.ref == 'refs/heads/staging'
needs: check_permission
steps:
- name: checkout
uses: actions/checkout@v2
- name: Index dump file
id: indexdatadump
run: |
cd .github/workflows
python -m pip install --upgrade pip
pip install requests==2.23.0
if [[ ${{ github.event.inputs.schema-version }} == "v1" ]]; then
python index_dump.py -u ${{ secrets.INDEX_DUMP_STAGING_API_URL }} -f ${{ github.event.inputs.release-dump }} -e ${{ github.event.inputs.data-env }} -he ${{ secrets.INDEX_STAGING_API_HEADERS }}
else
python index_dump.py -u ${{ secrets.INDEX_DUMP_STAGING_API_URL_V2 }} -f ${{ github.event.inputs.release-dump }} -e ${{ github.event.inputs.data-env }} -he ${{ secrets.INDEX_STAGING_API_HEADERS }}
fi
- name: Notify Slack
if: always()
uses: edge/simple-slack-notify@master
env:
SLACK_WEBHOOK_URL: ${{ secrets.CURATOR_SLACK_WEBHOOK_URL }}
with:
channel: '#ror-curation-releases'
color: 'good'
text: 'STAGING full index from dump status: ${{ steps.indexdatadump.outcome }}. From file: ${{ github.event.inputs.release-dump }}. Schema version: ${{ github.event.inputs.schema-version }}. Data env: ${{ github.event.inputs.data-env }}. Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}'

108 changes: 108 additions & 0 deletions v1.43/0000n5x09.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"id": "https://ror.org/0000n5x09",
"name": "Agropolymerpolymer Engineering and Emerging Technologies",
"email_address": null,
"ip_addresses": [],
"established": null,
"types": [
"Facility"
],
"relationships": [
{
"label": "Biochemistry and Plant Molecular Physiology",
"type": "Parent",
"id": "https://ror.org/05r332y60"
},
{
"label": "Centre de Coopération Internationale en Recherche Agronomique pour le Développement",
"type": "Parent",
"id": "https://ror.org/05kpkpg04"
},
{
"label": "Institut Agro Montpellier",
"type": "Parent",
"id": "https://ror.org/03rnk6m14"
},
{
"label": "University of Montpellier",
"type": "Parent",
"id": "https://ror.org/051escj72"
}
],
"addresses": [
{
"lat": 43.61093,
"lng": 3.87635,
"state": null,
"state_code": null,
"city": "Montpellier",
"geonames_city": {
"id": 2992166,
"city": "Montpellier",
"geonames_admin1": {
"name": "Occitanie",
"id": 11071623,
"ascii_name": "Occitanie",
"code": "FR.76"
},
"geonames_admin2": {
"name": "Hérault",
"id": 3013500,
"ascii_name": "Hérault",
"code": "FR.76.34"
},
"license": {
"attribution": "Data from geonames.org under a CC-BY 3.0 license",
"license": "http://creativecommons.org/licenses/by/3.0/"
},
"nuts_level1": {
"name": null,
"code": null
},
"nuts_level2": {
"name": null,
"code": null
},
"nuts_level3": {
"name": null,
"code": null
}
},
"postcode": null,
"primary": false,
"line": null,
"country_geonames_id": 3017382
}
],
"links": [
"http://umr-iate.cirad.fr/en"
],
"aliases": [],
"acronyms": [
"IATE"
],
"status": "active",
"wikipedia_url": "",
"labels": [
{
"label": "Ingénierie des Agropolymères et Technologies Emergentes",
"iso639": "fr"
}
],
"country": {
"country_name": "France",
"country_code": "FR"
},
"external_ids": {
"ISNI": {
"preferred": null,
"all": [
"0000 0004 0373 6662"
]
},
"GRID": {
"preferred": "grid.463886.7",
"all": "grid.463886.7"
}
}
}
Loading
Loading