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

feat: install and use tools at project scope level #850

Merged

Conversation

miguelsorianod
Copy link
Contributor

@miguelsorianod miguelsorianod commented Oct 6, 2023

Currently, in the project some tools are used to generate Go types and the OpenAPI specs from the OCM API model.

This tools are used by some Makefile targets of the project.

However, the project assumes that the tools are installed in the user's environment. This leads to errors when trying to use the Makefile targets and the user being confused as to why.

Aside from that, even if the user has those tools in the environment, the version used by those tools might be different than the version that was used to generate the Go types and OpenAPI specs in the repository's content, which might lead to differences in the autogenerated code with respect to what's commited in the repository and between users.

This set of changes ensures that the tools used by the Makefile are the ones installed by it. This ensures that anyone that used the project and generates the code sing the Makefile targets will use the same version of the tools

The tools are now always installed in the bin directory of the project's path.

Users of the project that want to directly use the installed tools manually should run them using the binaries installed at project level to ensure that there are no differences in the tool versions.

This set of changes also ensures that goimports is also installed as a project-level binary it as it is a requirement to run the metamodel tool. If the user didn't have it installed this ended up in errors.

Finally, it removes the explicit install of the goimports binary as it is now automatically installed when running make generate

Testing

To test it make sure that you can run make generate successfully even if you don't have metamodel nor goimports in your PATH. Also verify that the binaries are installed in the bin directory of the project's root path

Currently, in the project some tools are used to generate Go
types and the OpenAPI specs from the OCM API model.

This tools are used by some Makefile targets of the project.

However, the project assumes that the tools are installed in the
user's environment. This leads to errors when trying to use
the Makefile targets and the user being confused as to why.

Aside from that, even if the user has those tools in the environment, the
version used by those tools might be different than the version that was
used to generate the Go types and OpenAPI specs in the repository's
content, which might lead to differences in the autogenerated
code with respect to what's commited in the repository and between users.

This set of changes ensures that the tools used by the Makefile are the
ones installed by it. This ensures that anyone that used the project
and generates the code sing the Makefile targets will use the same
version of the tools

The tools are now always installed in the `bin` directory
of the project's path.

Users of the project that want to directly use the installed tools
manually should run them using the binaries installed at project
level to ensure that there are no differences in the tool versions.

This set of changes also ensures that `goimports` is also installed
as a project-level binary it as it is a requirement to run
the `metamodel` tool. If the user didn't have it installed this ended
up in errors.

Finally, it removes the explicit install of the `goimports` binary as
it is now automatically installed when running `make generate`
Copy link
Contributor

@tzvatot tzvatot left a comment

Choose a reason for hiding this comment

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

LGTM

@tzvatot tzvatot merged commit 8e0a745 into openshift-online:main Oct 16, 2023
5 checks passed
@miguelsorianod miguelsorianod deleted the tools-projectlevel-install branch October 16, 2023 15:47
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.

2 participants