CNTRLPLANE-3997: add workflow to publish docs to Cloudflare Pages on merge - #9221
Conversation
Add a GitHub Actions workflow that deploys HyperShift documentation to Cloudflare Pages production when docs changes are merged to main. This eliminates the current workaround of using the celebdor/hypershift fork to trigger production doc updates. The implementation adds two files: - docs-publish.yaml: triggers on push to main, orchestrates build and deploy using reusable workflows - docs-deploy-reusable.yaml: parameterized deploy workflow supporting both production (--production) and preview (--branch=<name>) modes Ref: CNTRLPLANE-3997 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@celebdor: This pull request references CNTRLPLANE-3997 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a reusable workflow for deploying the Sequence Diagram(s)sequenceDiagram
participant GitHub
participant DocsBuild
participant DocsDeploy
participant CloudflarePages
GitHub->>DocsBuild: build documentation on qualifying main push
DocsBuild->>DocsDeploy: provide docs-site artifact
DocsDeploy->>CloudflarePages: deploy production site with Wrangler
Suggested reviewers: 🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/docs-deploy-reusable.yaml:
- Around line 11-15: Update the workflow input definition for branch in
docs-deploy-reusable.yaml so preview deployments cannot proceed with an omitted
or empty branch when production is false or unset. Add validation or make branch
required for preview callers, while preserving production deployments that do
not need a branch.
- Around line 24-25: Update the job’s environment selection in the reusable
workflow so it uses docs-production when inputs.production is true and
docs-preview otherwise. Create and configure the docs-production environment
with the required protection rules, while preserving docs-preview for preview
deployments.
In @.github/workflows/docs-publish.yaml:
- Line 20: Pin the reusable workflow references in
.github/workflows/docs-publish.yaml at lines 20 and 27, and
.github/workflows/docs-build.yaml at line 14, to reviewed full commit SHAs
instead of `@main`. Preserve the existing workflow targets while ensuring all
referenced revisions are immutable.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: db99d299-9a02-45d4-a400-d5f15b9abd48
📒 Files selected for processing (2)
.github/workflows/docs-deploy-reusable.yaml.github/workflows/docs-publish.yaml
- Use docs-production environment (restricted to main) for production deploys, docs-preview for previews - Add concurrency group to docs-publish to prevent stale deploys from racing merges - Guard preview deploy step against empty branch input Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@celebdor: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/approve |
|
Pipeline controller notification No second-stage tests were triggered for this PR. This can happen when:
Use |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: celebdor, csrwng The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| runs-on: arc-runner-set | ||
| timeout-minutes: 5 | ||
| environment: | ||
| name: ${{ inputs.production && 'docs-production' || 'docs-preview' }} |
There was a problem hiding this comment.
This references a docs-production GitHub Environment that doesn't exist yet (the existing preview workflow uses docs-preview). If the environment or its secrets (CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID) aren't created before this PR merges, the first push to main touching docs/ will fail silently (the deploy job will be blocked waiting for environment approval, or fail on missing secrets).
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
| command: pages deploy site --project-name=hypershift --production --commit-dirty=true | ||
| - name: Deploy to Cloudflare Pages (Preview) | ||
| if: ${{ !inputs.production && inputs.branch != '' }} |
There was a problem hiding this comment.
The workflow supports two modes — production (inputs.production) and preview (!inputs.production && inputs.branch). But the existing PR preview deployment in docs-deploy.yaml does not call this reusable workflow. That means:
- The preview path in
docs-deploy-reusable.yamlhas no caller today - The existing
docs-deploy.yamlhas richer preview functionality (PR number extraction, GitHub deployment status creation with environment URL) that the reusable version lacks - There are now two deploy mechanisms:
docs-deploy.yamlfor previews anddocs-deploy-reusable.yamlfor production
Is the plan to migrate docs-deploy.yaml to use docs-deploy-reusable.yaml in a follow-up? If not, the preview path in the reusable workflow is dead code that could drift. If yes, the reusable version will need the deployment status logic from docs-deploy.yaml lines 45-77.
| - main | ||
| paths: | ||
| - 'docs/**' | ||
| - '.github/workflows/docs-publish.yaml' |
There was a problem hiding this comment.
Nit: paths doesn't include docs-build-reusable.yaml or docs-deploy-reusable.yaml. Probably fine since infrastructure changes alone don't warrant a content redeploy. But if a build fix needs to trigger redeployment, someone would need to make a no-op change to docs/. Worth noting in a comment?
Summary
docs-publish.yaml) that deploys HyperShift documentation to Cloudflare Pages production when docs changes are merged to maindocs-deploy-reusable.yaml) that supports both production (--production) and preview (--branch=<name>) deployment modescelebdor/hypershiftfork to trigger production doc updatesTest plan
hypershift.pages.devdocs-build.yaml→docs-deploy.yaml) is unaffectedRef: CNTRLPLANE-3997
🤖 Generated with Claude Code
Summary by CodeRabbit