Skip to content

Commit

Permalink
Merge pull request #140 from ror-community/index-es-7
Browse files Browse the repository at this point in the history
add option to index ES 6 or 7
  • Loading branch information
lizkrznarich authored Apr 19, 2023
2 parents 9b40020 + fc83f9d commit 4acf15b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/dev_manual_index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ on:
type: string
required: true
description: Name of the directory you would like to deploy to DEV
es-version:
description: Elastic search version to deploy to
required: true
default: 7
type: choice
options:
- 6
- 7
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down Expand Up @@ -105,7 +113,7 @@ jobs:
cd .github/workflows
python -m pip install --upgrade pip
pip install requests==2.23.0
python index_files.py -u ${{ secrets.INDEX_DEV_API_URL }} -d ${{ github.event.inputs.directory-name }} -he ${{ secrets.INDEX_DEV_API_HEADERS }}
python index_files.py -u ${{ secrets.INDEX_DEV_API_URL }} -d ${{ github.event.inputs.directory-name }} -es -d ${{ github.event.inputs.es-version }} -he ${{ secrets.INDEX_DEV_API_HEADERS }}
- name: Notify Slack
if: always()
uses: edge/simple-slack-notify@master
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/index_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def set_args():
description="Send request to index files")
parser.add_argument('-u', '--url', help='URL to index files', required=True)
parser.add_argument('-d', '--dir', help='directory in S3 bucket that is to be indexed', required=True)
parser.add_argument('-es', '--esversion', help='Elastic search version to index', 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
Expand All @@ -24,8 +25,9 @@ def main():
args = set_args()
url = args.url
dir = args.dir
esversion = args.esversion
headers = args.headers
full_url = os.path.join(url, dir)
full_url = os.path.join(url, dir, esversion)
response = send_request(full_url, headers)
if not(response.ok):
print(response.text)
Expand Down

0 comments on commit 4acf15b

Please sign in to comment.