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

📖 [Docs] API Reference Doc Generation #1230

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

dtfranz
Copy link
Contributor

@dtfranz dtfranz commented Sep 6, 2024

Adds API reference doc generation via github.com/elastic/crd-ref-docs, and adds make target + dependency to the Makefile so we can ensure the document is always up-to-date.

Closes #1126

Description

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@dtfranz dtfranz requested a review from a team as a code owner September 6, 2024 16:34
Copy link

netlify bot commented Sep 6, 2024

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 587c775
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/66db57f7cd62120008cf076d
😎 Deploy Preview https://deploy-preview-1230--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -299,6 +299,16 @@ quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the installation release man

##@ Docs

.PHONY: crd-ref-docs
API_REFERENCE_FILENAME := operator-controller-api-reference.md
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any strong thoughts on the filename? I prepended with operator-controller on the off-chance we put other APIs in here.

Copy link
Member

Choose a reason for hiding this comment

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

operator-controller-api-reference.md sounds good to me.

API_REFERENCE_FILENAME := operator-controller-api-reference.md
crd-ref-docs: $(CRD_REF_DOCS)
rm -f $(ROOT_DIR)/docs/drafts/$(API_REFERENCE_FILENAME)
$(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/api \
Copy link
Contributor Author

@dtfranz dtfranz Sep 6, 2024

Choose a reason for hiding this comment

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

There are a wealth of options and configuration we can use when we generate these; if there are any that seem interesting or necessary here please let me know! Otherwise for now I'm just dumping the entire API reference into one .md file. We could for instance build a config file to ignore the ClusterExtensionList type if we wanted to.

@dtfranz
Copy link
Contributor Author

dtfranz commented Sep 6, 2024

sanity workflow is currently failing because it's generating a different file than local. I'm investigating...

Just needed to rebase, all good now.

Copy link

codecov bot commented Sep 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.53%. Comparing base (1df52c7) to head (587c775).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1230   +/-   ##
=======================================
  Coverage   76.53%   76.53%           
=======================================
  Files          40       40           
  Lines        2340     2340           
=======================================
  Hits         1791     1791           
  Misses        392      392           
  Partials      157      157           
Flag Coverage Δ
e2e 57.64% <ø> (ø)
unit 52.47% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dtfranz dtfranz changed the title 📖: API Reference Doc Generation 📖 [Docs] API Reference Doc Generation Sep 6, 2024
@@ -1,6 +1,6 @@
module github.com/operator-framework/operator-controller

go 1.22.5
go 1.22.7
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Version bump required by the crd-ref-docs latest version

@michaelryanpeter
Copy link
Contributor

Other than the nits I made in Slack, my only other comments are refinements to try in the future.
LGTM.

@@ -0,0 +1,281 @@
# API Reference
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we change this heading easily?

Suggested change
# API Reference
# Operator Controller API Reference

Makefile Outdated
$(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/api \
--config=$(ROOT_DIR)/config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml \
--renderer=markdown \
--output-path=$(ROOT_DIR)/docs/refs/api/
Copy link
Contributor

@everettraven everettraven Sep 6, 2024

Choose a reason for hiding this comment

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

Nit: I did some digging in the source code and it looks like they support this being a path to a file as well - could you verify if setting --output-path=$(ROOT_DIR)/docs/refs/api/$(API_REFERENCE_FILENAME) would allow us to drop the mv operation after this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah - you're right. I did try that before but I must have formatted it wrong or had some other issue; I assumed it didn't work. Thanks for digging in to find that! I've updated the PR.

everettraven
everettraven previously approved these changes Sep 6, 2024
Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

Just a minor nit - I don't think it should hold this PR. Thanks @dtfranz !

Adds API reference doc generation via github.com/elastic/crd-ref-docs, and adds make target + dependency to the Makefile so we can ensure the document is always up-to-date.

Signed-off-by: dtfranz <dfranz@redhat.com>
@everettraven everettraven added this pull request to the merge queue Sep 6, 2024
Merged via the queue into operator-framework:main with commit eb99236 Sep 6, 2024
19 checks passed
@skattoju skattoju mentioned this pull request Sep 25, 2024
4 tasks
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.

Docs: Operator-Controller API reference
4 participants