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

Support new distribution-validations and add few enhancements to validation workflow #4447

Merged
merged 6 commits into from
Feb 20, 2024

Conversation

Divyaasm
Copy link
Collaborator

@Divyaasm Divyaasm commented Feb 13, 2024

Description

  1. Support Zip and Deb validations.
  2. Move the download_artifacts method from child classes(except docker) to parent class - validation.py.
  3. Changes to validation_args.py to fix the bug [Bug]: Validation run with file-path silently skips tests for incorrect product name #4441
  4. Cluster readiness is checked by requesting the api's instead of adding sleep().
  5. Changes to docker-validation:
    1. Add security strong password changes before running the container.
    2. Bring up the services opensearchnode1 and opensearchnode2 only when OS is validated, bringup all the services in
      compose file when both OS and OSD are provided.
    3. Pull and validate the latest staging docker image in the given version if build number is not provided.

Addresses #4424 and #4423

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9ecf30a) 91.55% compared to head (9e94a9e) 91.99%.
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4447      +/-   ##
==========================================
+ Coverage   91.55%   91.99%   +0.44%     
==========================================
  Files         190      192       +2     
  Lines        6214     6284      +70     
==========================================
+ Hits         5689     5781      +92     
+ Misses        525      503      -22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Divyaasm Divyaasm force-pushed the adddist branch 5 times, most recently from 949582b to 3261601 Compare February 15, 2024 01:12
@@ -61,7 +61,7 @@ def start_cluster(self) -> bool:
def validation(self) -> bool:
# STEP 2 . inspect image digest between opensearchproject(downloaded/local) and opensearchstaging(dockerHub)
if not self.args.using_staging_artifact_only:
self.image_names_list = [self.args.OS_image, self.args.OSD_image]
self.image_names_list = ['opensearchproject/' + project for project in self.args.projects]
self.image_names_list = [x for x in self.image_names_list if (os.path.basename(x) in self.args.projects)]
Copy link
Contributor

@jordarlu jordarlu Feb 15, 2024

Choose a reason for hiding this comment

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

what does these two lines of self.image_names_list do?

Copy link
Member

Choose a reason for hiding this comment

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

Second this.

Copy link
Collaborator Author

@Divyaasm Divyaasm Feb 15, 2024

Choose a reason for hiding this comment

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

I have unassigned the args self.args.OS_image, self.args.OSD_image in args.py and declared a list which stores the images names based on projects=["opensearch", "opensearchdashboards"]
FYI: self.OS_image = 'opensearchproject/opensearch'
self.OSD_image = 'opensearchproject/opensearch-dashboards'

Copy link
Contributor

@jordarlu jordarlu Feb 16, 2024

Choose a reason for hiding this comment

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

thanks, Divya, I just feel a bit redundant here becasue you constructed the image_names_list from args.projects on the first line of code, and then you do a filtering from the same args.projects on the next line of code. Could you give me an exmaple of expected output from the 2nd line of code assuming the image_names_list has ["opensearchproject/opensearch", "opensearchproject/opensearchdashboards"] at the first line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I get it now. Sorry missed this line while editing. It's of no use. Will remove it Thanks for pointing.

execute(f'sudo {set_password} dpkg -i {os.path.basename(self.args.file_path.get(project))}', str(self.tmp_dir.path))
time.sleep(80)
except:
raise Exception("Failed to install Opensearch")
Copy link
Member

Choose a reason for hiding this comment

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

I believe the product might be anything? OpenSearch or Dashboards? Recommending to make the error message generic.

Copy link
Member

Choose a reason for hiding this comment

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

^^

src/validation_workflow/rpm/validation_rpm.py Show resolved Hide resolved
src/validation_workflow/tar/validation_tar.py Show resolved Hide resolved

if args.distribution == "docker":
if args.osd_build_number != "latest" and "opensearch-dashboards" not in args.projects:
raise Exception("Provide opensearch-dashboards in projects argument to validate OSD")
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
raise Exception("Provide opensearch-dashboards in projects argument to validate OSD")
raise Exception("Provide opensearch-dashboards in projects argument to validate OpenSearch-Dashboards")

@gaiksaya
Copy link
Member

Hi Divya, can you please add more details in the PR description explaining what changes are being made. Looks like it is doing a lot more than debian and zip validation.
Also please attach the issue number related to this PR change.

Thanks!

Copy link
Member

@peterzhuamazon peterzhuamazon left a comment

Choose a reason for hiding this comment

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

Hi @Divyaasm ,

As @gaiksaya also pointed out here, the PR is huge with a lot of information but little comments or descriptions on what is happening.

I would suggest you separate this PR into two separate ones, lets review and get deb merge and we understand your approach before going back on win zip, as you can also avoid duplicate changes.

You are also missing tests on the PR. With a big PR like this I am hesitate to just merge through without any tests.

Please take a look at the comments and let us know. 😄

Thanks.

src/validation_workflow/deb/validation_deb.py Show resolved Hide resolved
src/validation_workflow/deb/validation_deb.py Show resolved Hide resolved
execute(f'sudo {set_password} dpkg -i {os.path.basename(self.args.file_path.get(project))}', str(self.tmp_dir.path))
time.sleep(80)
except:
raise Exception("Failed to install Opensearch")
Copy link
Member

Choose a reason for hiding this comment

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

^^

src/validation_workflow/deb/validation_deb.py Outdated Show resolved Hide resolved
@@ -61,7 +61,7 @@ def start_cluster(self) -> bool:
def validation(self) -> bool:
# STEP 2 . inspect image digest between opensearchproject(downloaded/local) and opensearchstaging(dockerHub)
if not self.args.using_staging_artifact_only:
self.image_names_list = [self.args.OS_image, self.args.OSD_image]
self.image_names_list = ['opensearchproject/' + project for project in self.args.projects]
self.image_names_list = [x for x in self.image_names_list if (os.path.basename(x) in self.args.projects)]
Copy link
Member

Choose a reason for hiding this comment

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

Second this.

src/validation_workflow/rpm/validation_rpm.py Show resolved Hide resolved
src/validation_workflow/tar/validation_tar.py Show resolved Hide resolved
@Divyaasm
Copy link
Collaborator Author

Hi Divya, can you please add more details in the PR description explaining what changes are being made. Looks like it is doing a lot more than debian and zip validation. Also please attach the issue number related to this PR change.

Thanks!

Sure Sayali

@Divyaasm Divyaasm force-pushed the adddist branch 4 times, most recently from 6efda2d to 6817dfc Compare February 16, 2024 01:42
Signed-off-by: Divya Madala <divyaasm@amazon.com>

Add changes to docker

Signed-off-by: Divya Madala <divyaasm@amazon.com>

Add requested changes

Signed-off-by: Divya Madala <divyaasm@amazon.com>

Add testcases

Signed-off-by: Divya Madala <divyaasm@amazon.com>
@Divyaasm Divyaasm force-pushed the adddist branch 2 times, most recently from 3ba53cf to ce41e97 Compare February 16, 2024 16:36
Signed-off-by: Divya Madala <divyaasm@amazon.com>
Copy link
Member

@peterzhuamazon peterzhuamazon left a comment

Choose a reason for hiding this comment

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

More questions.

src/validation_workflow/validation.py Outdated Show resolved Hide resolved
src/validation_workflow/validation_args.py Outdated Show resolved Hide resolved
src/validation_workflow/validation_args.py Outdated Show resolved Hide resolved
Signed-off-by: Divya Madala <divyaasm@amazon.com>
Signed-off-by: Divya Madala <divyaasm@amazon.com>
@Divyaasm Divyaasm changed the title Add Debian and Zip distributions to validation workflow Support new distributions and add few enhancements to validation workflow Feb 19, 2024
@Divyaasm Divyaasm changed the title Support new distributions and add few enhancements to validation workflow Support new distribution-validations and add few enhancements to validation workflow Feb 19, 2024
Copy link
Member

@peterzhuamazon peterzhuamazon left a comment

Choose a reason for hiding this comment

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

Thanks @Divyaasm .

Add a few nitpiks but those are more for the further improvements later.

As for now we just need to address the parameter name change to be more inline with the behavior.

Thanks.

f"{self.args.arch}/{self.args.distribution}/dist/{project}/{project}-{self.args.version}-{self.args.platform}-"
f"{self.args.arch}.{file_name_suffix}"
)
if self.args.distribution == "yum":
Copy link
Member

Choose a reason for hiding this comment

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

TODO: APT will be added in a future PR, so probably need to think about how to use generic function instead of having a if statement specifically on yum.

src/validation_workflow/validation.py Outdated Show resolved Hide resolved
src/validation_workflow/validation_args.py Outdated Show resolved Hide resolved
src/validation_workflow/validation_args.py Outdated Show resolved Hide resolved
src/validation_workflow/validation_args.py Outdated Show resolved Hide resolved
Signed-off-by: Divya Madala <divyaasm@amazon.com>
@peterzhuamazon
Copy link
Member

Thanks @Divyaasm for addressing these comments.
Approved now.

Thanks.

@peterzhuamazon
Copy link
Member

Hi @Divyaasm you need to address the python test failure.

Signed-off-by: Divya Madala <divyaasm@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants