Skip to content

Run check in CI for generated docs #783

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 2 commits into from
Jun 7, 2019

Conversation

lilic
Copy link
Member

@lilic lilic commented Jun 7, 2019

What this PR does / why we need it:

The generated docs were out of date, so I reran the make generate. Also added a check for the generated docs, which will be now run as part of doc travis job.

The docs were out of date.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 7, 2019
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 7, 2019
--logtostderr log to standard error instead of files (default true)
--metric-blacklist string Comma-separated list of metrics not to be enabled. The whitelist and blacklist are mutually exclusive.
--metric-whitelist string Comma-separated list of metrics to be exposed. The whitelist and blacklist are mutually exclusive.
--namespace string Comma-separated list of namespaces to be enabled. Defaults to ""
--port int Port to expose metrics on. (default 80)
--skip_headers If true, avoid header prefixes in the log messages
--stderrthreshold severity logs at or above this threshold go to stderr
--skip_log_headers If true, avoid headers when openning log files
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--skip_log_headers If true, avoid headers when openning log files
--skip_log_headers If true, avoid headers when opening log files.

Copy link
Member Author

@lilic lilic Jun 7, 2019

Choose a reason for hiding this comment

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

Ah I see, it (make generate) was using the latest release, instead of master, let me fix this!

Copy link
Member Author

Choose a reason for hiding this comment

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

@tariq1890 Actually! I take that back, it's correct, it comes from klog, it's a typo there. If you do kube-state-metrics --help you will see it there :)

So if we want to use the make generate to update these docs, we need to keep it as is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks !

--logtostderr log to standard error instead of files (default true)
--metric-blacklist string Comma-separated list of metrics not to be enabled. The whitelist and blacklist are mutually exclusive.
--metric-whitelist string Comma-separated list of metrics to be exposed. The whitelist and blacklist are mutually exclusive.
--namespace string Comma-separated list of namespaces to be enabled. Defaults to ""
--port int Port to expose metrics on. (default 80)
--skip_headers If true, avoid header prefixes in the log messages
--stderrthreshold severity logs at or above this threshold go to stderr
--skip_log_headers If true, avoid headers when openning log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
--stderrthreshold severity logs at or above this threshold go to stderr (default 2).

| kube_hpa_labels | Gauge | `hpa`=&lt;hpa-name&gt; <br> `namespace`=&lt;hpa-namespace&gt; | STABLE |
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not able to determine what this change exactly is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Think it's a space, but these docs are generated so it's correct. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool! Thanks

Makefile Outdated
@@ -122,7 +124,7 @@ generate: build-local embedmd
@$(GOPATH)/bin/embedmd -w `find . -path ./vendor -prune -o -name "*.md" -print`

embedmd:
go get github.com/campoy/[email protected]
GO111MODULE=on go get github.com/campoy/[email protected]
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if this is desirable. This changes the go mod artifacts and will affect the go mod verify checks in the CI.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep you are right. But otherwise, go get fails.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure we want to add this @go mod tidy to the doccheck target. Can we try this with GO111MODULE=off instead? I don't see why this needs to be added to the go mod artifacts, assuming we are using embdedmd as a a CLI convenience in CI.

Copy link
Member Author

Choose a reason for hiding this comment

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

Interestingly enough with "off" hit this problem locally: cannot use path@version syntax in GOPATH mode

golang/go#29415

Copy link
Member Author

Choose a reason for hiding this comment

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

But I agree that was a hack, doing go mod tidy, I am sure there is a better way! :)

@lilic lilic force-pushed the fix-doc-args branch 4 times, most recently from 7f915a7 to ee2efae Compare June 7, 2019 18:55
@lilic lilic changed the title Fix doc args Run check in CI for generated docs Jun 7, 2019
@@ -122,7 +124,7 @@ generate: build-local embedmd
@$(GOPATH)/bin/embedmd -w `find . -path ./vendor -prune -o -name "*.md" -print`

embedmd:
go get github.com/campoy/embedmd@v1.0.0
GO111MODULE=off go get github.com/campoy/embedmd
Copy link
Contributor

Choose a reason for hiding this comment

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

Yup I was going to suggest this. This go mod limitation is very annoying. You can see what the prometheus team had to do in order to get around this issue:

https://github.com/prometheus/prometheus/blob/a5d39361ab0b53081fef5bdc6c722148716f175d/Makefile.common#L187-L201

Copy link
Contributor

Choose a reason for hiding this comment

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

^ That's just an FYI btw. I am definitely okay with go getting the embedmd without the versionedPath. Hopefully it works :)

Copy link
Member Author

Choose a reason for hiding this comment

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

That looks interesting 😄

I removed the version restrain, test pass now, tbh the embedmd project does not change much. But up to you?

Copy link
Contributor

Choose a reason for hiding this comment

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

Fine by me.

Makefile Outdated
doccheck:
doccheck: generate
@echo "- Checking if the generated documentation is up to date..."
@git diff --exit-code --
@echo "- Checking if the documentation is 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.

Can we change this to something like Checking if the documentation is in sync with the code" ? Do you agree that this would perhaps add more clarity on what's going on ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, done ✔️

Copy link
Contributor

@tariq1890 tariq1890 Jun 7, 2019

Choose a reason for hiding this comment

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

Whoops, I actually meant changing this "- Checking if the documentation is up to date..." to "-Checking if the documentation is in sync with the code"

The informational line that you had added in this PR was fine IMO.

Copy link
Member Author

Choose a reason for hiding this comment

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

ha, fixed and unfixed. Should be good now.

This way we will catch when we need to regenerate the docs, as the
doccheck make target is run as part of CI.
Copy link
Contributor

@tariq1890 tariq1890 left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks @lilic for your contribution. Your patience is appreciated :).

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 7, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: LiliC, tariq1890

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 7, 2019
@k8s-ci-robot k8s-ci-robot merged commit 2626cb5 into kubernetes:master Jun 7, 2019
@lilic lilic deleted the fix-doc-args branch June 7, 2019 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants