-
Notifications
You must be signed in to change notification settings - Fork 1k
Ranger-5081: CI: Add check to verify plugin installation in ranger-service containers #583
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
base: master
Are you sure you want to change the base?
Conversation
Increased sleep time to 60 before checking plugin status
I recommend the use of Python language for adding checks that are more readable, maintainable, reusable and extendable. It's also preferable for extensive JSON parsing. Please take a look at below sample code (AI generated) as a starting point, can be further improvised:
|
…in docker build job in maven file
expected_services = ["hdfs", "hbase", "kms", "yarn", "kafka", "ozone", "knox", "hive"] | ||
|
||
|
||
def trigger_knox_activity(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggested function name: init_knox_plugin
def trigger_knox_activity(): | ||
print("\nTriggering Knox activity to ensure plugin status is updated...") | ||
try: | ||
response = requests.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please take a look at apache-ranger
python library, more info: https://pypi.org/project/apache-ranger/
Use RangerClient
do a GET on the knox endpoint instead of using requests
directly.
def fetch_plugin_info(): | ||
print(f"\nFetching plugin info from {ENDPOINT} ...") | ||
try: | ||
response = requests.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use RangerClient
from apache-ranger
python lib to do a GET on the ranger endpoint instead of using requests
directly.
def fetch_plugin_info(): | ||
print(f"\nFetching plugin info from {ENDPOINT} ...") | ||
try: | ||
response = requests.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use RangerClient
from apache-ranger
python lib to do a GET on the ranger endpoint instead of using requests
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I've made these changes please check once
trigger_knox_activity() | ||
|
||
# wait for status update | ||
for i in range(6): # Retry up to 3 minutes total |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping re-try interval and retries configurable is suggested.
… retries configurable
def init_knox_plugin(): | ||
print("\nTriggering Knox activity to ensure plugin status is updated...") | ||
try: | ||
response = ranger.session.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a single line instead
|
||
|
||
def init_knox_plugin(): | ||
print("\nTriggering Knox activity to ensure plugin status is updated...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change log to Initializing Knox plugin
) | ||
print("Knox activity triggered.") | ||
except Exception as e: | ||
print(f"Failed to trigger Knox activity: {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: Failed to initialize Knox plugin
KNOX_USER=admin | ||
KNOX_PASS=admin-password | ||
|
||
PLUGIN_RETRY_COUNT=4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are defined as env variables in maven.yml
so this is unncesssary.
Currently, with GitHub CI, the pipeline brings up all the containers that are supported by dev-support/ranger-docker.
What changes were proposed in this pull request?
Adding a way to verify that the ranger plugin setup succeeded when the containers come up as another check in the CI pipeline.