Skip to content

Link to Latest CNCF CoC Instead of Commit Hash #50850

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

avanish23
Copy link
Contributor

Description

Right now, the Kubernetes CoC inherits the CNCF CoC. We place the content of the CNCF CoC in a static folder and source it from there, which means that every time the CNCF CoC is updated, we need to raise a PR updating the CoC on the Kubernetes side in the static folders.

Issue

Now using the hugo function resources.GetRemote we can get the CNCF CoC content during the hugo build. No need to create new PRs everytime CNCF CoC is updated.

Closes: #49595

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/localization General issues or PRs related to localization size/M Denotes a PR that changes 30-99 lines, ignoring generated files. language/en Issues or PRs related to English language labels May 9, 2025
@k8s-ci-robot k8s-ci-robot added language/es Issues or PRs related to Spanish language language/fr Issues or PRs related to French language language/id Issues or PRs related to Indonesian language language/it Issues or PRs related to Italian language language/ja Issues or PRs related to Japanese language language/ko Issues or PRs related to Korean language language/pt Issues or PRs related to Portuguese language language/ru Issues or PRs related to Russian language sig/docs Categorizes an issue or PR as relevant to SIG Docs. labels May 9, 2025
Copy link

netlify bot commented May 9, 2025

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit 6f26b33
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-io-main-staging/deploys/681e05f6fc4d860008dfd433
😎 Deploy Preview https://deploy-preview-50850--kubernetes-io-main-staging.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.

@shurup
Copy link
Member

shurup commented May 9, 2025

@avanish23 thank you for your work! Following the workflow we have here for website localisations, we'll need to separate all localisation-specific changes into individual PRs, each for the corresponding language. Please, leave the English-related changes only for this PR 🙏 You (or someone else) can create the follow-up PRs for each localisation after this PR is merged.

@avanish23
Copy link
Contributor Author

Thanks for reviewing the PR @shurup
Also, I wanted to test the changes for this PR. The build failed for my laptop when I tried to run make container-serve
I will edit this PR keeping only the changes for en. Will raise follow-up PRs post this PR is merged.

@shurup
Copy link
Member

shurup commented May 9, 2025

The build failed for my laptop when I tried to run make container-serve

I think we can also help you with this, so that it'll be easier for you to preview the changes before bringing them to the PR. Feel free to open a relevant issue where you can provide your output with the failing build, and mention me there.

@lmktfy
Copy link
Contributor

lmktfy commented May 9, 2025

Thanks for this work.

We need a different approach before we should merge the change:

  • abstract the common code (common across localizations) into a new shortcode. Look at how the include shortcode works for a hint
  • initially, only change English to the new approach
    • try to write the change so that localizations can switch over one by one
  • for a production website build, a failed fetch is a build failure. but for local development (with eg make container-serve) a failed fetch should only be a warning

Look at the warnf and errorf functions (and for layouts that already call the right one depending on context) for a hint about how to do this

/area web-development

@k8s-ci-robot k8s-ci-robot added the area/web-development Issues or PRs related to the kubernetes.io's infrastructure, design, or build processes label May 9, 2025
@avanish23
Copy link
Contributor Author

Thanks @lmktfy for your feedback, I will look into your suggestions.

@avanish23 avanish23 closed this May 9, 2025
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 9, 2025
@avanish23 avanish23 reopened this May 9, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign dipesh-rawat for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

1 similar comment
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign dipesh-rawat for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 9, 2025
@avanish23
Copy link
Contributor Author

avanish23 commented May 9, 2025

Thanks @lmktfy for your feedback, I will look into your suggestions.

@avanish23
Copy link
Contributor Author

@shurup @lmktfy
I have made changes to the PR and checked the preview, which seems okay to me.
https://deploy-preview-50850--kubernetes-io-main-staging.netlify.app/community/code-of-conduct/

Attached screenshot
Screenshot 2025-05-09 at 7 06 12 PM

Kindly review the PR again.
Thanks.

@shurup
Copy link
Member

shurup commented May 13, 2025

Thank you for your fixes! LGTM now. However, I wonder why @lmktfy mentioned:

Please don't link directly to https://github.com/cncf/foundation/blob/main/code-of-conduct.md

… in the related issue #49595 (comment). Currently, we have this link, despite the content of this document is inserted below. Perhaps we're still missing something, so I'd prefer to wait for him to give the final approval.

/remove-language es fr id it ja ko pt ru

@k8s-ci-robot k8s-ci-robot removed language/es Issues or PRs related to Spanish language language/fr Issues or PRs related to French language language/id Issues or PRs related to Indonesian language language/it Issues or PRs related to Italian language language/ja Issues or PRs related to Japanese language language/ko Issues or PRs related to Korean language language/pt Issues or PRs related to Portuguese language language/ru Issues or PRs related to Russian language labels May 13, 2025
Copy link
Contributor

@lmktfy lmktfy left a comment

Choose a reason for hiding this comment

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

I'm afraid to say that I think the website will be better, overall, if we do not merge this change.

• The PR title is wrong; this is transfusion, not hyperlinking.

• I have significant doubts that the change, as it stands, leaves the site easy enough to maintain. Some of what I see looks "fragile": small changes in other places could have bigger consequences.

• The error handling isn't right for our pridui website.

Copy link
Contributor

Choose a reason for hiding this comment

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

For a production website build, a failed fetch is a build failure, but for local development (with eg make container-serve) a failed fetch should only be a warning.

Please change this code to achieve that.

Look at the warnf and errorf functions (and for layouts that already call the right one depending on context) for a hint about how to do this

remote-coc shortcode: Fetches remote Markdown, cleans up 'Other languages' section, renders as HTML
*/}}

{{ $url := "https://raw.githubusercontent.com/cncf/foundation/main/code-of-conduct.md" }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work for all locales (is not just English)? Will it work reliably?

{{ $url := "https://raw.githubusercontent.com/cncf/foundation/main/code-of-conduct.md" }}
{{ with resources.GetRemote $url }}
{{ $raw := .Content }}
{{ $clean := replaceRE "(?ms)^Other languages available:\\s*\\n(?:- .+\\n)*- \\[Vietnamese/Tiếng Việt\\]\\(code-of-conduct-languages/vi\\.md\\)\\n*" "" $raw }}
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we know that these are the right strings to match on? If we aren't sure, this change may make the Kubernetes website harder to maintain.

{{ $html := $clean | markdownify }}
{{ $html }}
{{ else }}
{{ warnf "remote-coc shortcode: Failed to fetch remote resource from %s" $url }}
Copy link
Contributor

Choose a reason for hiding this comment

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

For a production build, this failure needs to be an outright error.

{{ $html }}
{{ else }}
{{ warnf "remote-coc shortcode: Failed to fetch remote resource from %s" $url }}
<p><em>Content temporarily unavailable. Please try again later.</em></p>
Copy link
Contributor

Choose a reason for hiding this comment

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

This text should be localized, even if is kinky used for local previews.

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 confident that we can accept this change, but if we do, I think we could omit:

If you notice that this page is out of date, please [file an issue](https://github.com/kubernetes/website/issues/new/choose).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/localization General issues or PRs related to localization area/web-development Issues or PRs related to the kubernetes.io's infrastructure, design, or build processes cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language sig/docs Categorizes an issue or PR as relevant to SIG Docs. 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.

Link to Latest CNCF CoC Instead of Commit Hash
4 participants