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

GitHub workflow file. #35

Merged
merged 12 commits into from
Jun 3, 2022
43 changes: 43 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI
pgtgrly marked this conversation as resolved.
Show resolved Hide resolved

on: [push, pull_request]

jobs:
run_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v1

- name: Installing Dredd
run: sudo npm install dredd --global --unsafe-perm=true --allow-root

- name: Installing node-fetch module
run: npm install node-fetch@2

- name: Installing hooks module
run: npm install hooks

- name: Installing https module
run: npm install https

- name: Installing file module
run: npm install fs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend making a package.json, doing npm install and committing a .lock file, or else this will be a moving target and will break continuously.

Copy link
Contributor Author

@SOPHIA2401 SOPHIA2401 Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added package.json and .lock file for all node modules in the commit f58fc02 except the dredd module because of it's broken npm install. I have reached out to the dredd team for the same.


- name: Build the stack
run: docker-compose up -d
shell: bash
working-directory: ./test

- name: Setting up OpenSearch domain
Copy link
Contributor

@pgtgrly pgtgrly May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename it to Waiting for Opensearch Domain to be up

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to "Waiting for OpenSearch domain to be up."

run: python ./.github/workflows/test_url.py

- name: Run script file
run: |
export NODE_TLS_REJECT_UNAUTHORIZED=0
pgtgrly marked this conversation as resolved.
Show resolved Hide resolved
python driver-code.py
shell: bash
working-directory: ./test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add newline to end of file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in latest commit.

11 changes: 11 additions & 0 deletions .github/workflows/test_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os

for i in range(0,6):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the domain is not up when i = 6? we need to throw an error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected in commit 6eb89bc.

command = "curl 'https://admin:admin@localhost:9200' -H 'Content-Type:application/json' --insecure -v"
result = os.system(command)
if result !=0:
os.system("sleep 30s")
else:
os.system("sleep 30s")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding sleep here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another 30 seconds are required for the OpenSearch domain to become operational.

break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be directly written in shell script as part of CI workflow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, It can be added and corrected in commit 6eb89bc.