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 min max cli args #5

Merged
merged 12 commits into from
Jul 6, 2023
Merged

Conversation

thepetk
Copy link
Contributor

@thepetk thepetk commented Jun 30, 2023

What does this PR do?

As part of devfile/api#1170 we are introducing the two first cli args in order to support specific versions of devfiles. Those two are min-version and max-version.

If this argument is passed in the cli we are updating the URL for the download of the devfiles from the registry (following this link). This way we are filtering the list of devfiles we are getting from the registry.

Some edge cases:

  • If min-version is higher than max-version an error is raised.
  • If min-version and/or max-version is lower than 2.0.0 (the lowest accepted version from the registry API) then an error is raised.

A slight addition is also made to the model.DevfileType in order to include information for versions. For backwards compatibility reasons we are no longer using SelectDevFilesFromRegistry but MatchDevfiles.

A new model.DevfileFilter is created in order to include all future filters inside the devfile API and ensure scalability.

Updates are made inside the documentation of the project to include all changes introduced and test cases regarding the URL update are added.

Which issue(s) does this PR fix

fixes devfile/api#1171

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

@thepetk thepetk requested a review from mike-hoang June 30, 2023 18:51
@thepetk thepetk self-assigned this Jun 30, 2023
@@ -133,6 +135,100 @@ func TestDetectLaravelDevfile(t *testing.T) {
detectDevFiles(t, "laravel", []string{"php-laravel"})
}

func TestGetUrlWithVersions(t *testing.T) {
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 when the min and max version are both the same or when they're both empty

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If they are both empty we are back in normal so all versions are used and if they have the same version they fetch a specific version.

pkg/apis/recognizer/devfile_recognizer.go Outdated Show resolved Hide resolved
@openshift-ci
Copy link

openshift-ci bot commented Jul 5, 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 force-pushed the feature/add_min_max_cli_args branch from b5cf743 to 1c7b579 Compare July 6, 2023 13:18
@openshift-ci openshift-ci bot removed the lgtm label Jul 6, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jul 6, 2023

New changes are detected. LGTM label has been removed.

thepetk and others added 12 commits July 6, 2023 14:19
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: Michael Hoang <[email protected]>
Signed-off-by: thepetk <[email protected]>
* Update test paths

Signed-off-by: thepetk <[email protected]>

* Update angular test resource

Signed-off-by: thepetk <[email protected]>

* Remove projectAngularjs

Signed-off-by: thepetk <[email protected]>

* Update containerfile test

Signed-off-by: thepetk <[email protected]>

* Update django test resources

Signed-off-by: thepetk <[email protected]>

* Update docker compose test resources

Signed-off-by: thepetk <[email protected]>

* Update tests for docker compose with ports

Signed-off-by: thepetk <[email protected]>

* Update test project dockerfile

Signed-off-by: thepetk <[email protected]>

* Update express js port tests

Signed-off-by: thepetk <[email protected]>

* Update flask port tests

Signed-off-by: thepetk <[email protected]>

* Update golang test resources

Signed-off-by: thepetk <[email protected]>

* Update jboss test resources

Signed-off-by: thepetk <[email protected]>

* Update laravel test resources

Signed-off-by: thepetk <[email protected]>

* Update test micronaut resources

Signed-off-by: thepetk <[email protected]>

* Update container docker file nested tests

Signed-off-by: thepetk <[email protected]>

* Update nuxt and next js tests

Signed-off-by: thepetk <[email protected]>

* Update port test for quarkus

Signed-off-by: thepetk <[email protected]>

* Update reactjs tests

Signed-off-by: thepetk <[email protected]>

* Remove port test project quarkus

Signed-off-by: thepetk <[email protected]>

* Update rest of port tests

Signed-off-by: thepetk <[email protected]>

* Fix issue with ip host go format

Signed-off-by: thepetk <[email protected]>

* Update test resources

Signed-off-by: thepetk <[email protected]>

* Finalize new component detection format

Signed-off-by: thepetk <[email protected]>

---------

Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>
@thepetk thepetk force-pushed the feature/add_min_max_cli_args branch from 1c7b579 to 3af83a4 Compare July 6, 2023 13:19
@thepetk thepetk merged commit e1434c1 into devfile:main Jul 6, 2023
@thepetk thepetk mentioned this pull request Jul 6, 2023
2 tasks
thepetk added a commit that referenced this pull request Aug 1, 2023
* Add binaries to every new release (#237)

* Add release yaml to workflows

Signed-off-by: thepetk <[email protected]>

* Remove autogeneration of release notes

Signed-off-by: thepetk <[email protected]>

* Update readme

Signed-off-by: thepetk <[email protected]>

* Update Readme.md

Signed-off-by: thepetk <[email protected]>

---------

Signed-off-by: thepetk <[email protected]>

* flattening go dir (#1)

Signed-off-by: Michael Hoang <[email protected]>
Signed-off-by: thepetk <[email protected]>

* Update realease.yaml (#2)

Signed-off-by: thepetk <[email protected]>

* adding proposal for dockerfile components (#3)

Signed-off-by: Michael Hoang <[email protected]>
Signed-off-by: thepetk <[email protected]>

* Merge all test resources (#6)

* Update test paths

Signed-off-by: thepetk <[email protected]>

* Update angular test resource

Signed-off-by: thepetk <[email protected]>

* Remove projectAngularjs

Signed-off-by: thepetk <[email protected]>

* Update containerfile test

Signed-off-by: thepetk <[email protected]>

* Update django test resources

Signed-off-by: thepetk <[email protected]>

* Update docker compose test resources

Signed-off-by: thepetk <[email protected]>

* Update tests for docker compose with ports

Signed-off-by: thepetk <[email protected]>

* Update test project dockerfile

Signed-off-by: thepetk <[email protected]>

* Update express js port tests

Signed-off-by: thepetk <[email protected]>

* Update flask port tests

Signed-off-by: thepetk <[email protected]>

* Update golang test resources

Signed-off-by: thepetk <[email protected]>

* Update jboss test resources

Signed-off-by: thepetk <[email protected]>

* Update laravel test resources

Signed-off-by: thepetk <[email protected]>

* Update test micronaut resources

Signed-off-by: thepetk <[email protected]>

* Update container docker file nested tests

Signed-off-by: thepetk <[email protected]>

* Update nuxt and next js tests

Signed-off-by: thepetk <[email protected]>

* Update port test for quarkus

Signed-off-by: thepetk <[email protected]>

* Update reactjs tests

Signed-off-by: thepetk <[email protected]>

* Remove port test project quarkus

Signed-off-by: thepetk <[email protected]>

* Update rest of port tests

Signed-off-by: thepetk <[email protected]>

* Fix issue with ip host go format

Signed-off-by: thepetk <[email protected]>

* Update test resources

Signed-off-by: thepetk <[email protected]>

* Finalize new component detection format

Signed-off-by: thepetk <[email protected]>

---------

Signed-off-by: thepetk <[email protected]>

* Add min max cli args (#5)

* Create dependabot.yml

Signed-off-by: thepetk <[email protected]>

* Update dependabot.yml

Signed-off-by: thepetk <[email protected]>

* Update realease.yaml (#2)

Signed-off-by: thepetk <[email protected]>

* adding proposal for dockerfile components (#3)

Signed-off-by: Michael Hoang <[email protected]>
Signed-off-by: thepetk <[email protected]>

* Merge all test resources (#6)

* Update test paths

Signed-off-by: thepetk <[email protected]>

* Update angular test resource

Signed-off-by: thepetk <[email protected]>

* Remove projectAngularjs

Signed-off-by: thepetk <[email protected]>

* Update containerfile test

Signed-off-by: thepetk <[email protected]>

* Update django test resources

Signed-off-by: thepetk <[email protected]>

* Update docker compose test resources

Signed-off-by: thepetk <[email protected]>

* Update tests for docker compose with ports

Signed-off-by: thepetk <[email protected]>

* Update test project dockerfile

Signed-off-by: thepetk <[email protected]>

* Update express js port tests

Signed-off-by: thepetk <[email protected]>

* Update flask port tests

Signed-off-by: thepetk <[email protected]>

* Update golang test resources

Signed-off-by: thepetk <[email protected]>

* Update jboss test resources

Signed-off-by: thepetk <[email protected]>

* Update laravel test resources

Signed-off-by: thepetk <[email protected]>

* Update test micronaut resources

Signed-off-by: thepetk <[email protected]>

* Update container docker file nested tests

Signed-off-by: thepetk <[email protected]>

* Update nuxt and next js tests

Signed-off-by: thepetk <[email protected]>

* Update port test for quarkus

Signed-off-by: thepetk <[email protected]>

* Update reactjs tests

Signed-off-by: thepetk <[email protected]>

* Remove port test project quarkus

Signed-off-by: thepetk <[email protected]>

* Update rest of port tests

Signed-off-by: thepetk <[email protected]>

* Fix issue with ip host go format

Signed-off-by: thepetk <[email protected]>

* Update test resources

Signed-off-by: thepetk <[email protected]>

* Finalize new component detection format

Signed-off-by: thepetk <[email protected]>

---------

Signed-off-by: thepetk <[email protected]>

* Run tidy

Signed-off-by: thepetk <[email protected]>

* Update devfile_recognizer and models

Signed-off-by: thepetk <[email protected]>

* Update cli

Signed-off-by: thepetk <[email protected]>

* Update docs

Signed-off-by: thepetk <[email protected]>

* Add test cases for versions cli args

Signed-off-by: thepetk <[email protected]>

* Fix sec alert

Signed-off-by: thepetk <[email protected]>

* Fix typo

Signed-off-by: thepetk <[email protected]>

---------

Signed-off-by: thepetk <[email protected]>
Signed-off-by: Michael Hoang <[email protected]>
Co-authored-by: Michael Hoang <[email protected]>
Signed-off-by: thepetk <[email protected]>

* Remove dependabot (#10)

Signed-off-by: [email protected]

Signed-off-by: [email protected]
Signed-off-by: thepetk <[email protected]>

* Minor update on devfiles versioning (#11)

* Remove dependabot

Signed-off-by: [email protected]
Signed-off-by: thepetk <[email protected]>

* Add versions to alizer devfile response

Signed-off-by: thepetk <[email protected]>

* Update readme.md

Signed-off-by: thepetk <[email protected]>

* Update naming and devfile models in the proposal

Signed-off-by: thepetk <[email protected]>

* Update code naming

Signed-off-by: thepetk <[email protected]>

* Update tests after renaming

Signed-off-by: thepetk <[email protected]>

---------

Signed-off-by: [email protected]
Signed-off-by: thepetk <[email protected]>

* fixing gosec alerts (#12)

Signed-off-by: Michael Hoang <[email protected]>
Signed-off-by: thepetk <[email protected]>

* Add test coverage check to CI.yaml (#13)

* Add test coverage workflow

Signed-off-by: thepetk <[email protected]>

* Update ci.yaml

Signed-off-by: thepetk <[email protected]>

* Add separate check for code coverage

Signed-off-by: thepetk <[email protected]>

* Move code report in ci file

Signed-off-by: thepetk <[email protected]>

* Add .codecov.yaml

Signed-off-by: thepetk <[email protected]>

* Update workflow

Signed-off-by: thepetk <[email protected]>

* Bump up setup-go

Signed-off-by:thepetk <[email protected]>

---------

Signed-off-by: thepetk <[email protected]>

* adding support for dockerfile components (#14)

Signed-off-by: Michael Hoang <[email protected]>
Signed-off-by: thepetk <[email protected]>

* Add test coverage workflow

Signed-off-by: thepetk <[email protected]>

* Update ci.yaml

Signed-off-by: thepetk <[email protected]>

* Add separate check for code coverage

Signed-off-by: thepetk <[email protected]>

* Move code report in ci file

Signed-off-by: thepetk <[email protected]>

* Update workflow

Signed-off-by: thepetk <[email protected]>

* Bump up setup-go

Signed-off-by:thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>

* Make DownloadDevFileTypesFromRegistry public

Signed-off-by: thepetk <[email protected]>

* Add devfile.yaml schema

Signed-off-by: thepetk <[email protected]>

* Add go script for generating registry entries json

Signed-off-by: thepetk <[email protected]>

* Implement nightly run script and workflow

Signed-off-by: thepetk <[email protected]>

* Update go mod

Signed-off-by: thepetk <[email protected]>

* Add new schedule to registry check

signed-off-by: thepetk <[email protected]>
Signed-off-by: thepetk <[email protected]>

* Update workflow name

Signed-off-by: thepetk <[email protected]>

* Update go mod

Signed-off-by: thepetk <[email protected]>

* Update funcs in order to be mockable

Signed-off-by: thepetk <[email protected]>

* Move devfile_recognizer_test.go to recognizer dir

Signed-off-by: thepetk <[email protected]>

* Update docstring of script

Signed-off-by: thepetk <[email protected]>

* Add tests for check_registry.go

Signed-off-by: thepetk <[email protected]>

* Fix test paths

Signed-off-by: thepetk <[email protected]>

* Remove unecessary logging

Signed-off-by: thepetk <[email protected]>

* Remove binary

Signed-off-by: thepetk <[email protected]>

* Use make build instead of go command

Signed-off-by: thepetk <[email protected]>

* Further fixes on the workflow

Signed-off-by: thepetk <[email protected]>

---------

Signed-off-by: thepetk <[email protected]>
Signed-off-by: Michael Hoang <[email protected]>
Signed-off-by: [email protected]
Co-authored-by: Michael Hoang <[email protected]>
@thepetk thepetk deleted the feature/add_min_max_cli_args branch November 9, 2023 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add min-version and max-version params to alizer CLI
2 participants