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

Stop auto-commits to website/src/pages/docs/schema-reference.md #997

Closed
jrcheli opened this issue Jun 13, 2022 · 2 comments · Fixed by #998
Closed

Stop auto-commits to website/src/pages/docs/schema-reference.md #997

jrcheli opened this issue Jun 13, 2022 · 2 comments · Fixed by #998
Assignees
Milestone

Comments

@jrcheli
Copy link
Contributor

jrcheli commented Jun 13, 2022

In #880, we added the ability to automatically generate the schema-reference.md file. As the last step of this processing we set up in this ticket, the github pipeline does a git commit and push of the generated schema-reference.md file.

The source *.schema.json files that are used to create schema-reference.md are all controlled in git. With the source schema.json files controlled in git, and since the creation of schema-reference.md is automated, (via make docs-generate) I don't see a reason to control the generated schema-reference.md file in git too. I'd prefer to just run the make docs-generate every time we run the "Deploy Website" workflow. This then would mean that we could depreciate the "JSON Schema Markdown website update" workflow.

Why is this my preference? @abetones' git workflow looks like this:

1) make local edits
2) commit them
3) push them
4) make more edits
5) commit them
6) push them

But with the auto-commit to website/src/pages/docs/schema-reference.md, he’s having troubles in step 6) because he has merge conflicts. He could just wait a couple of minutes (for the github pipeline to finish its update), then do a git fetch and git sync after each commit. However, it feels to me like this shouldn't be needed... So, at the risk of circular reasoning, I'd prefer to just remove the git commit and push that's done automatically by the github pipeline in the "JSON Schema Markdown website update" workflow.

@jrcheli jrcheli self-assigned this Jun 13, 2022
@jrcheli
Copy link
Contributor Author

jrcheli commented Jun 13, 2022

To do this I:

  1. git rm website/src/pages/docs/schema-reference.md
  2. edited .github/workflows/website.yml to
  • add a step to run make docs-generate before the "Website Deploy"
  • add docker/docs/layout.js and docs/schemas/** to the list of triggers for the "Deploy Website" workflow
  1. git rm .github/workflows/schema.yml

michalbiesek added a commit that referenced this issue Jun 14, 2022
- `json-dereference` always return 0, even in case of
  syntax error
- to overcome this limitation we check if temporary
  schema.json file is generated
@ghost ghost added this to the Backlog milestone Jun 17, 2022
jrcheli added a commit that referenced this issue Jul 5, 2022
* (#997) stop automatic git commits of schema-reference.md.

* (#997) Add validation for `json-dereference` operation

- `json-dereference` always return 0, even in case of
  syntax error
- to overcome this limitation we check if temporary
  schema.json file is generated

* (#997) Add schema2md.js to the list of triggers for github workflow.

Co-authored-by: michalbiesek <mbiesek@cribl.io>
@jrcheli
Copy link
Contributor Author

jrcheli commented Jul 5, 2022

Since this ticket was affecting github, after merging this PR, I did some additional testing, aimed at verifying that the changes made here were having the appropriate effect in github.

To test that the file has been removed from git:

rm -rf appscope3
git clone git@github.com:criblio/appscope.git appscope3
cd appscope3
ls -al website/src/pages/docs/schema-reference.md

returned this for the ls -al command:

ubuntu@ip-10-8-107-159:~/jrc/appscope3$ ls -al website/src/pages/docs/schema-reference.md
ls: cannot access 'website/src/pages/docs/schema-reference.md': No such file or directory

This confirms that the schema-reference.md is no longer controlled in git.

To make sure that the website schema generation still works end-to-end, I looked at https://appscope.dev/docs/schema-reference/#eventhttpresp after @seanvaleo published a new tag web-1.1.0-update2. This tells me that the website is still fully functional, despite the fact that schema-reference.md is no longer in git. This also implies that the make docs-generate is successfully doing its job, because the schema-reference endpoint has changes that went in after schema-reference.md has stopped being under direct control. (Specifically, the changes from #1021)

With this much working, I chose to not explicitly test that we have the right set of triggers for website.yml:
image
I think the risk here is minimal. If we make changes to docs/schemas/** and do not see them reflected in the website after pushing them to master or throwing down a "web*" tag, then I'll have to revisit this.

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 a pull request may close this issue.

1 participant