-
Notifications
You must be signed in to change notification settings - Fork 151
add rhec source & pull rhec models using graphql #1330
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
Merged
google-oss-prow
merged 13 commits into
kubeflow:main
from
adysenrothman:get-rhec-models
Jul 22, 2025
Merged
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
36b2099
add rhec source & pull rhec models using graphql
adysenrothman 8ec5b8e
replace graphql client & update source.yaml
adysenrothman 18e5a1a
add testing
adysenrothman 48356d9
cleanup logs and todo
adysenrothman ff914b0
rm temp placeholder
adysenrothman 5fa2504
add graphql gen code to makefile
adysenrothman 8c378fc
add makefule targets
adysenrothman fb27929
resolve deps
adysenrothman 679114f
Merge branch 'main' into get-rhec-models
adysenrothman 2bf5e30
add context to genqlient and rhec sources
adysenrothman 9dca8b5
Merge branch 'get-rhec-models' of https://github.com/adysenrothman/mo…
adysenrothman f32c6d5
Merge branch 'main' into get-rhec-models
adysenrothman 3d2b082
work vendor
adysenrothman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -226,6 +226,10 @@ GOLANG_MIGRATE ?= ${PROJECT_BIN}/migrate | |
| bin/golang-migrate: | ||
| GOBIN=$(PROJECT_PATH)/bin ${GO} install -tags 'mysql,postgres' github.com/golang-migrate/migrate/v4/cmd/[email protected] | ||
|
|
||
| GENQLIENT ?= ${PROJECT_BIN}/genqlient | ||
| bin/genqlient: | ||
| GOBIN=$(PROJECT_PATH)/bin ${GO} install github.com/Khan/[email protected] | ||
|
|
||
| OPENAPI_GENERATOR ?= ${PROJECT_BIN}/openapi-generator-cli | ||
| NPM ?= "$(shell which npm)" | ||
| bin/openapi-generator-cli: | ||
|
|
@@ -249,7 +253,7 @@ clean/deps: | |
| rm -Rf bin/* | ||
|
|
||
| .PHONY: deps | ||
| deps: bin/protoc bin/protoc-gen-go bin/protoc-gen-go-grpc bin/golangci-lint bin/goverter bin/openapi-generator-cli bin/envtest | ||
| deps: bin/protoc bin/protoc-gen-go bin/protoc-gen-go-grpc bin/golangci-lint bin/goverter bin/openapi-generator-cli bin/envtest bin/genqlient | ||
|
|
||
| .PHONY: vendor | ||
| vendor: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| ## Using Genqlient with the Red Hat Ecosystem Catalog | ||
|
|
||
| This directory contains the necessary files to generate a type-safe Go GraphQL client for the Red Hat Ecosystem Catalog using [genqlient](https://github.com/Khan/genqlient). | ||
|
|
||
| ### File Structure | ||
|
|
||
| - `genqlient.yaml`: The configuration file for `genqlient`. It specifies the location of the GraphQL schema, the directory containing the GraphQL queries, and the output file for the generated code. | ||
| - `queries/`: This directory contains the GraphQL schema and query files. | ||
| - `schema.graphql`: The GraphQL schema for the Red Hat Ecosystem Catalog API. | ||
| - `*.graphql`: Files containing the GraphQL queries. | ||
|
|
||
| ### Generating the Client | ||
|
|
||
| To regenerate the client, you will first need to ensure the required tools are installed by running `make deps` from the project root. Once the tools are installed, you can generate the client by running the following command from the `catalog` directory: | ||
|
|
||
| ```bash | ||
| make gen/graphql | ||
| ``` | ||
|
|
||
| This will generate the `generated.go` file in the current directory. | ||
|
|
||
| ### Downloading the Schema | ||
|
|
||
| The `schema.graphql` file can be updated by downloading the latest version from the Red Hat Ecosystem Catalog API. You can do this by running the following command from the `catalog` directory: | ||
|
|
||
| ```bash | ||
| make download/graphql-schema | ||
| ``` | ||
|
|
||
| This will download the schema and save it to the correct location. After updating the schema, you should regenerate the client to ensure it is up to date. | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # genqlient.yaml | ||
| schema: queries/schema.graphql | ||
| operations: | ||
| - "queries/find_repository_images.graphql" | ||
| - "queries/get_repository.graphql" | ||
| generated: generated.go | ||
| package: genqlient | ||
| bindings: | ||
| DateTime: | ||
| type: time.Time |
29 changes: 29 additions & 0 deletions
29
catalog/internal/catalog/genqlient/queries/find_repository_images.graphql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| query FindRepositoryImages($registry: String!, $repository: String!) { | ||
| find_repository_images_by_registry_path( | ||
| registry: $registry | ||
| repository: $repository | ||
| sort_by: [{ field: "creation_date", order: DESC }] | ||
| ) { | ||
| error { | ||
| detail | ||
| status | ||
| } | ||
| total | ||
| data { | ||
| creation_date | ||
| last_update_date | ||
| repositories { | ||
| registry | ||
| tags { | ||
| name | ||
| } | ||
| } | ||
| parsed_data { | ||
| labels { | ||
| name | ||
| value | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
21 changes: 21 additions & 0 deletions
21
catalog/internal/catalog/genqlient/queries/get_repository.graphql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| query GetRepository($registry: String!, $repository: String!) { | ||
| get_repository_by_registry_path( | ||
| registry: $registry | ||
| repository: $repository | ||
| ) { | ||
| error { | ||
| detail | ||
| status | ||
| } | ||
| data { | ||
| creation_date | ||
| last_update_date | ||
| release_categories | ||
| vendor_label | ||
| display_data { | ||
| short_description | ||
| long_description | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.