Skip to content

Generate json schema #1644

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
merged 4 commits into from
Feb 13, 2019
Merged

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented Feb 12, 2019

Make sure a json schema is generated for each version of the skaffold.yaml

Also check a test time that schema are up to date.

Signed-off-by: David Gageot <[email protected]>
@dgageot dgageot force-pushed the generate-json-schema branch from 77a2282 to 20afeca Compare February 12, 2019 15:40
@codecov-io
Copy link

codecov-io commented Feb 12, 2019

Codecov Report

Merging #1644 into master will increase coverage by 0.8%.
The diff coverage is 69.69%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #1644     +/-   ##
=========================================
+ Coverage   46.95%   47.76%   +0.8%     
=========================================
  Files         119      120      +1     
  Lines        5143     5337    +194     
=========================================
+ Hits         2415     2549    +134     
- Misses       2480     2532     +52     
- Partials      248      256      +8
Impacted Files Coverage Δ
pkg/skaffold/schema/versions.go 65.85% <100%> (ø) ⬆️
schemas/main.go 69.07% <69.07%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c13adb...05f12af. Read the comment docs.

@dgageot dgageot added the wip label Feb 12, 2019
# schema generation

.PHONY: generate-schemas
generate-schemas:
Copy link
Contributor

Choose a reason for hiding this comment

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

How are you going to keep this file up to date?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 we should write a script similar to hack/check-docs.sh that runs the generate-schemas target on schema changes and if there are changes then fails the build.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, there's a unit test. That'll do it for now. Another option would be to generate those files only on a release.

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

it looks good to me, a minor thing though, generating a new config version breaks now, as the schema file doesn't exist yet - either the new_config script should take care of this or I'd rather have the schema generation take it as an empty file and generate a new one:

--- FAIL: TestSchemas (0.01s)
    main_test.go:26: unable to check json schemas: unable to read existing schema for version skaffold/v1beta6: open ../schemas/v1beta6.json: no such file or directory

# schema generation

.PHONY: generate-schemas
generate-schemas:
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 we should write a script similar to hack/check-docs.sh that runs the generate-schemas target on schema changes and if there are changes then fails the build.

@dgageot
Copy link
Contributor Author

dgageot commented Feb 13, 2019

@balopat This should be better now

Signed-off-by: David Gageot <[email protected]>
@balopat balopat merged commit 6544f16 into GoogleContainerTools:master Feb 13, 2019
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.

5 participants