docs: overhaul the documentation site and how it is published - #405
Merged
Conversation
The site was published by building it in CI and pushing the output to the gh-pages branch with a third-party action, authenticated by a token stored in the GH_TOKEN repository secret. GitHub has since provided a first-party path — upload the build as an artifact and hand it to a deployment authorised through OIDC — which needs no stored token and commits no build output to a branch. Other jenkinsci repositories already publish this way, among them maven-hpi-plugin and wxwork-notification-plugin. npm ci replaces npm install so the tracked lock file is what actually gets installed, the trigger is narrowed to the paths that can change the built site rather than every push to main, and a fork skips the build since it has no Pages site to deploy to. bin/docs-release.sh goes with the old scheme; it was its manual half and has not worked since the VitePress migration moved the build output out of docs-dist/ in September 2022, and AGENTS.md already told contributors not to run local release scripts. Going over every page against the code and checking every link then turned up a fair amount that was simply broken. `[受限的 markdonw](#受限的 markdonw)` never rendered as a link at all: the anchor contains a space, so markdown-it left the whole thing as literal text, which is what the pipeline page has been showing in two of its tables. The target section does not live on that page either, and the word is misspelt. The same page had three anchors written in CamelCase, which never resolved because heading ids are lowercased, and two screenshots hosted in an Alibaba Cloud bucket that now answers 403; those two and three others are replaced by the screenshots this repository already ships. Its syntax block was missing `singleUrl`, `at` was documented as a List when it is a Set, the default title has been `Jenkins 构建通知` rather than `Jenkins 通知` for some time, and its copy of BtnLayoutEnum misspelt horizontal. The install link pointed at plugins.jenkins.io/dingtalk, which is a 404 — the plugin is published as dingding-notifications, as the badge on the home page already had it. An action card example still linked to the previous maintainer's personal site, also gone. The DTMD page had the robot send an insult; the code now says something civil, though the screenshot still shows the old exchange and wants retaking. Two of that page's three references were help-center links that now redirect to the help centre's front page. One example mentioned a twelve-digit number where a mobile has eleven. `环境变量` listed two of the eight variables the plugin injects, and none of the things that make them surprising: `PROJECT_*` is the project while `JOB_*` is the build, `EXECUTOR_NAME` and `EXECUTOR_MOBILE` are read before they are written so they can be overridden, and none of the eight exist in the `dingtalk` step, which `Freestyle 项目高级功能` implied they did. The security policy section warned that the keyword has to appear in the message, when the plugin appends it for you. Nothing documented the raw mode at all, so `自定义消息` is a new page: what the built-in message contains, what disabling it costs (no buttons, MARKDOWN only, hence no tappable mention on mobile), and that the title stays out of your hands. `快速开始` gained the six notice occasions and the boundary of the three security policies, since only two of them need anything on the Jenkins side. The site itself declared `lang="en-US"` while being entirely in Chinese, had no search, and set `lastUpdatedText` without enabling `lastUpdated`; enabling it is why the checkout now needs the full history. The theme's remaining English labels are translated, the logo that was sitting unreferenced in assets/ is now the home page's, and the home page uses the hero layout. Public files move to `docs/public`, VitePress's default, so the explicit `vite.publicDir` can go. CONTRIBUTING told contributors to install yarn although the repository tracks package-lock.json and CI runs npm ci, and pointed at two jenkins-zh.cn articles whose domain no longer resolves and at the retired Confluence wiki. Publishing from main requires the repository's Pages source to be set to GitHub Actions; afterwards the gh-pages branch and the GH_TOKEN secret can both go away. Signed-off-by: BobDu <i@bobdu.cc>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refs #206.
Settings → Pages → Build and deployment → Source has to be switched from the
gh-pagesbranch to GitHub Actions. While the source is still a branch, a deployment originating frommainis rejected, so merging first would just produce one red run. The site keeps serving its current content until the first Actions deployment lands.Once it has deployed successfully, the
gh-pagesbranch and theGH_TOKENrepository secret can both be deleted.Publishing
The site was built in CI and pushed to
gh-pageswithpeaceiris/actions-gh-pages, authenticated by a token kept in theGH_TOKENrepository secret. GitHub's own actions upload the build as an artifact and deploy it through an OIDC-verified deployment instead, so nothing has to be stored and no build output is committed to a branch. This is whatmaven-hpi-plugin,wxwork-notification-plugin,jellyandjob-dsl-pluginalready do.Along with it:
npm cirather thannpm installso the tracked lock file is what gets installed; the trigger narrowed to the paths that can change the built site, instead of rebuilding and redeploying on every push tomainincluding the Java-only ones; and the build skipped on forks, which have no Pages site to deploy to.bin/docs-release.shis removed. It was the manual half of the same scheme and has not worked since the VitePress migration moved the output out ofdocs-dist/in September 2022 —AGENTS.mdalready told contributors not to run local release scripts.I smoke-tested the whole pipeline on my fork before opening this: build → artifact → OIDC deployment, green, serving.
What was broken
[受限的 markdonw](#受限的 markdonw)never rendered as a link — the anchor contains a space, so markdown-it left it as literal text. The pipeline page has been showing that raw markdown in two of its tables. The target section is on another page and the word is misspelt as well.#MsgTypeEnum,#BtnLayoutEnum,#ButtonModelding-doc.oss-cn-beijing.aliyuncs.comscreenshots403 AccessDenied: Access denied by bucket policyplugins.jenkins.io/dingtalkdingding-notifications, which the home page badge already had rightliuweigl.github.io/dingtalk-pluginin an action card exampledingtalk.com/qidian/help-detail-*references on the DTMD pageThe five external screenshots in 效果展示 are replaced with the ones this repository already ships, so the section no longer depends on someone else's bucket. The DTMD example had the robot send an insult — the code says something civil now, though the screenshot still shows the old exchange and should be retaken by someone with a client handy; I only renamed the file to fix its
dtmtspelling and left the pixels alone.What disagreed with the code
The pipeline page's syntax block was missing
singleUrl, documentedatas aListwhen it is aSet, gave the default title asJenkins 通知when it isJenkins 构建通知, and its copy ofBtnLayoutEnummisspelthorizontal.环境变量listed two of the eight variables the plugin injects, and none of the things that make them surprising:PROJECT_*is the project,JOB_*is the buildEXECUTOR_NAMEandEXECUTOR_MOBILEare read before they are written, so a build can override themdingtalkstep — they are written into the notification's own snapshot of the environment. That is the behaviour behind Pipeline 中无法使用插件环境变量 #206, answered in that thread back in 2023 but never written down.Freestyle 项目高级功能implied the opposite.The security policy section warned that the keyword has to appear in the message, when
DingTalkSender.addKeyWordappends it for you on all four message types.What was missing
The raw mode had no documentation at all, so
自定义消息is a new page: what the built-in message contains, what disabling it costs (no buttons,MARKDOWNonly and therefore no tappable mention on mobile), that the title stays out of your hands, and how to rebuild the pieces with environment variables.快速开始gained the six notice occasions and the boundary of the three security policies — only two of them need anything on the Jenkins side.The site itself
It declared
lang="en-US"while being entirely in Chinese, had no search, and setlastUpdatedTextwithout enablinglastUpdated— enabling it is why the checkout now needs the full history. The theme's remaining English labels are translated, the logo that was sitting unreferenced inassets/is now the home page's, and the home page uses the hero layout. Public files move todocs/public, VitePress's default, which lets the explicitvite.publicDirgo.CONTRIBUTING.mdtold contributors to install yarn although the repository trackspackage-lock.jsonand CI runsnpm ci, and pointed at twojenkins-zh.cnarticles whose domain no longer resolves and at the retired Confluence wiki.Verification
npm run docs:buildafter each round, plus a scan of the built output for anchors without a matching id, markdown link syntax surviving outside<code>, and local image targets that do not exist — 16 pages, none left. Every external link in the docs checked individually; the only remaining non-200s are thename.complaceholders inside a syntax example.The three binary changes in this PR are renames at 100% similarity; no image content is modified.