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

Add nightly check for Product and Community registries #15

Merged
merged 35 commits into from
Aug 1, 2023

Conversation

thepetk
Copy link
Contributor

@thepetk thepetk commented Jul 27, 2023

What does this PR do?

This PR creates a new workflow check_registry.yaml which will be scheduled for every day at 03.00 UTC. In this workflow we are trying to run an E2E test by running alizer against a stack's starterprojects. We expect that the devfile of this stack will be inside the list of alizer's matchings.

The registries we are checking are:

func getRegistries() []DevfileRegistry {
	return []DevfileRegistry{
		{
			Name:   "Community Registry",
			Url:    "https://registry.devfile.io",
			Filter: model.DevfileFilter{},
		},
		{
			Name:   "Product Registry",
			Url:    "https://devfile-registry.redhat.com",
			Filter: model.DevfileFilter{},
		},
	}
}

In order to create a complete JSON for all registry entries we are running the check_registry.go file which is responsible to gather all details from the given registries:

  • First it GETs the <registryUrl>/v2index response and for each stack/sample fetched tries to getch the devfile details:
starterProjects, err := getStarterProjects(fmt.Sprintf("%s/devfiles/%s", registry.Url, devfileType.Name))
  • If a stack has different layout and we don't have available the git.remote.origin we are using the getProjectReplacements method.

  • After the JSON is generated the script checks every entry, clones the given repo, runs alizer against it and checks the results.

  • If the expected devfile is not inside the list then the process exit 1.

Which issue(s) does this PR fix

fixes devfile/api#1165

PR acceptance criteria

Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened.

  • Unit/Functional tests

  • Documentation

How to test changes / Special notes to the reviewer

Locally you can try to run

bash test/check_registry/check_registry.sh

There is also a test run here: https://github.com/thepetk/devfile-alizer/actions/runs/5681161565

@thepetk thepetk requested a review from mike-hoang July 27, 2023 13:39
@thepetk thepetk self-assigned this Jul 27, 2023
thepetk and others added 24 commits July 27, 2023 14:40
* Add release yaml to workflows

Signed-off-by: thepetk <thepetk@gmail.com>

* Remove autogeneration of release notes

Signed-off-by: thepetk <thepetk@gmail.com>

* Update readme

Signed-off-by: thepetk <thepetk@gmail.com>

* Update Readme.md

Signed-off-by: thepetk <thepetk@gmail.com>

---------

Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: Michael Hoang <mhoang@redhat.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: Michael Hoang <mhoang@redhat.com>
Signed-off-by: thepetk <thepetk@gmail.com>
* Update test paths

Signed-off-by: thepetk <thepetk@gmail.com>

* Update angular test resource

Signed-off-by: thepetk <thepetk@gmail.com>

* Remove projectAngularjs

Signed-off-by: thepetk <thepetk@gmail.com>

* Update containerfile test

Signed-off-by: thepetk <thepetk@gmail.com>

* Update django test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update docker compose test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update tests for docker compose with ports

Signed-off-by: thepetk <thepetk@gmail.com>

* Update test project dockerfile

Signed-off-by: thepetk <thepetk@gmail.com>

* Update express js port tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Update flask port tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Update golang test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update jboss test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update laravel test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update test micronaut resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update container docker file nested tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Update nuxt and next js tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Update port test for quarkus

Signed-off-by: thepetk <thepetk@gmail.com>

* Update reactjs tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Remove port test project quarkus

Signed-off-by: thepetk <thepetk@gmail.com>

* Update rest of port tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Fix issue with ip host go format

Signed-off-by: thepetk <thepetk@gmail.com>

* Update test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Finalize new component detection format

Signed-off-by: thepetk <thepetk@gmail.com>

---------

Signed-off-by: thepetk <thepetk@gmail.com>
* Create dependabot.yml

Signed-off-by: thepetk <thepetk@gmail.com>

* Update dependabot.yml

Signed-off-by: thepetk <thepetk@gmail.com>

* Update realease.yaml (#2)

Signed-off-by: thepetk <thepetk@gmail.com>

* adding proposal for dockerfile components (#3)

Signed-off-by: Michael Hoang <mhoang@redhat.com>
Signed-off-by: thepetk <thepetk@gmail.com>

* Merge all test resources (#6)

* Update test paths

Signed-off-by: thepetk <thepetk@gmail.com>

* Update angular test resource

Signed-off-by: thepetk <thepetk@gmail.com>

* Remove projectAngularjs

Signed-off-by: thepetk <thepetk@gmail.com>

* Update containerfile test

Signed-off-by: thepetk <thepetk@gmail.com>

* Update django test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update docker compose test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update tests for docker compose with ports

Signed-off-by: thepetk <thepetk@gmail.com>

* Update test project dockerfile

Signed-off-by: thepetk <thepetk@gmail.com>

* Update express js port tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Update flask port tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Update golang test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update jboss test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update laravel test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update test micronaut resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Update container docker file nested tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Update nuxt and next js tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Update port test for quarkus

Signed-off-by: thepetk <thepetk@gmail.com>

* Update reactjs tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Remove port test project quarkus

Signed-off-by: thepetk <thepetk@gmail.com>

* Update rest of port tests

Signed-off-by: thepetk <thepetk@gmail.com>

* Fix issue with ip host go format

Signed-off-by: thepetk <thepetk@gmail.com>

* Update test resources

Signed-off-by: thepetk <thepetk@gmail.com>

* Finalize new component detection format

Signed-off-by: thepetk <thepetk@gmail.com>

---------

Signed-off-by: thepetk <thepetk@gmail.com>

* Run tidy

Signed-off-by: thepetk <thepetk@gmail.com>

* Update devfile_recognizer and models

Signed-off-by: thepetk <thepetk@gmail.com>

* Update cli

Signed-off-by: thepetk <thepetk@gmail.com>

* Update docs

Signed-off-by: thepetk <thepetk@gmail.com>

* Add test cases for versions cli args

Signed-off-by: thepetk <thepetk@gmail.com>

* Fix sec alert

Signed-off-by: thepetk <thepetk@gmail.com>

* Fix typo

Signed-off-by: thepetk <thepetk@gmail.com>

---------

Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: Michael Hoang <mhoang@redhat.com>
Co-authored-by: Michael Hoang <35011707+mike-hoang@users.noreply.github.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk@gmail.com

Signed-off-by: thepetk@gmail.com
Signed-off-by: thepetk <thepetk@gmail.com>
* Remove dependabot

Signed-off-by: thepetk@gmail.com
Signed-off-by: thepetk <thepetk@gmail.com>

* Add versions to alizer devfile response

Signed-off-by: thepetk <thepetk@gmail.com>

* Update readme.md

Signed-off-by: thepetk <thepetk@gmail.com>

* Update naming and devfile models in the proposal

Signed-off-by: thepetk <thepetk@gmail.com>

* Update code naming

Signed-off-by: thepetk <thepetk@gmail.com>

* Update tests after renaming

Signed-off-by: thepetk <thepetk@gmail.com>

---------

Signed-off-by: thepetk@gmail.com
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: Michael Hoang <mhoang@redhat.com>
Signed-off-by: thepetk <thepetk@gmail.com>
* Add test coverage workflow

Signed-off-by: thepetk <thepetk@gmail.com>

* Update ci.yaml

Signed-off-by: thepetk <thepetk@gmail.com>

* Add separate check for code coverage

Signed-off-by: thepetk <thepetk@gmail.com>

* Move code report in ci file

Signed-off-by: thepetk <thepetk@gmail.com>

* Add .codecov.yaml

Signed-off-by: thepetk <thepetk@gmail.com>

* Update workflow

Signed-off-by: thepetk <thepetk@gmail.com>

* Bump up setup-go

Signed-off-by:thepetk <thepetk@gmail.com>

---------

Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: Michael Hoang <mhoang@redhat.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by:thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Patch coverage: 45.77% and project coverage change: +28.64% 🎉

Comparison is base (7f521b2) 37.91% compared to head (9f73689) 66.56%.

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #15       +/-   ##
===========================================
+ Coverage   37.91%   66.56%   +28.64%     
===========================================
  Files           9       10        +1     
  Lines        1221     1358      +137     
===========================================
+ Hits          463      904      +441     
+ Misses        729      394      -335     
- Partials       29       60       +31     
Files Changed Coverage Δ
pkg/apis/recognizer/devfile_recognizer.go 53.62% <20.00%> (+53.62%) ⬆️
test/check_registry/check_registry.go 46.71% <46.71%> (ø)

... and 2 files with indirect coverage changes

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

thepetk added 5 commits July 27, 2023 16:58
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Copy link
Contributor

@mike-hoang mike-hoang left a comment

Choose a reason for hiding this comment

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

Nice! Overall looks good, just a few nits that I think should be addressed

test/check_registry/check_registry.sh Show resolved Hide resolved
.github/workflows/check_registry.yaml Outdated Show resolved Hide resolved
alizer Outdated Show resolved Hide resolved
thepetk added 3 commits July 31, 2023 16:58
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
Signed-off-by: thepetk <thepetk@gmail.com>
@thepetk thepetk requested a review from mike-hoang July 31, 2023 16:00
@thepetk
Copy link
Contributor Author

thepetk commented Jul 31, 2023

Nice! Overall looks good, just a few nits that I think should be addressed

All items have been addressed @mike-hoang :)

@openshift-ci openshift-ci bot added the lgtm label Jul 31, 2023
Signed-off-by: thepetk <thepetk@gmail.com>
@openshift-ci openshift-ci bot removed the lgtm label Aug 1, 2023
@thepetk
Copy link
Contributor Author

thepetk commented Aug 1, 2023

@mike-hoang I've gone through again the workflow (I had in mind what you said about the cleaning process) and I made some further fixes:

  1. Clean dir in case of failure
  2. In case of failure print the alizer output and command used
  3. Fix the loop for for raw_selected_devfile_name in $(echo $alizer_output | jq -c '.[].Name') in order to skip check if found_matching is already 1.
  4. Excluded the java-maven (too generic) and the websphere stacks (they use the same projects as open-liberty.

For the websphere stacks I've created this item devfile/api#1206

@thepetk thepetk requested a review from mike-hoang August 1, 2023 10:09
@openshift-ci openshift-ci bot added the lgtm label Aug 1, 2023
@openshift-ci
Copy link

openshift-ci bot commented Aug 1, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mike-hoang, thepetk

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@thepetk thepetk merged commit bef6b03 into devfile:main Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement nightly E2E test on alizer for community devfile registry and product registry
3 participants