Improve linting (#2148)

- We now detect text blocks that are incorrectly indented.

- We now detect image captions that end in a period.

- We now detect page descriptions that don't end in a period.

- CircleCi now runs linting without minifying HTML first, improving perf and
improving error output.

- In CircleCi, we now have a per-build cache for HTML proofer output. This
helps reduce the frequency of link timeout errors.

- Fix errors flagged by the above new lint checks.
This commit is contained in:
Martin Taillefer 2018-08-04 08:44:06 -07:00 committed by GitHub
parent 75baef98ec
commit fd290dc73e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 86 additions and 61 deletions

View File

@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: gcr.io/istio-testing/website-builder:2018-07-14
- image: gcr.io/istio-testing/website-builder:2018-07-14
working_directory: ~/site
@ -11,18 +11,23 @@ jobs:
- run:
name: Generating Site
command: scripts/gen_site.sh ""
command: scripts/gen_site.sh "" -no_minify
# We have a cache of URLs to help improve the chances of htmlproofer not hitting a timeout
# when probing links for validity. Alas, this cache is only for a given pull request due to
# the key. Ideally, this key would be using today's date as part of the key instead, such that
# a single daily build would need to update the cache, and it would then it reused for the
# subsequent builds for that day. Alas, I can't figure out how to get the current date and use it
# as a component of the key.
- restore_cache:
keys:
- htmlproofer-cache-v5
- htmlproofer-cache-{{ .Environment.CIRCLE_PULL_REQUEST }}
- run:
name: Running Linters
command: scripts/lint_site.sh
# save the external URLs cache
- save_cache:
key: htmlproofer-cache-v5
key: htmlproofer-cache-{{ .Environment.CIRCLE_PULL_REQUEST }}
paths:
- .htmlproofer

View File

@ -435,7 +435,7 @@ For example
{{< text plain >}}
---
title: Frequently Asked Questions
description: Questions Asked Frequently
description: Questions Asked Frequently.
weight: 12
aliases:
- /faq
@ -450,7 +450,7 @@ You can also add many redirects like so:
{{< text plain >}}
---
title: Frequently Asked Questions
description: Questions Asked Frequently
description: Questions Asked Frequently.
weight: 12
aliases:
- /faq

View File

@ -1,6 +1,6 @@
---
title: Introducing Istio
description: Istio 0.1 announcement
description: Istio 0.1 announcement.
publishdate: 2017-05-24
subtitle: A robust service mesh for microservices
attribution: The Istio Team

View File

@ -1,6 +1,6 @@
---
title: Using Istio to Improve End-to-End Security
description: Istio Auth 0.1 announcement
description: Istio Auth 0.1 announcement.
publishdate: 2017-05-25
subtitle: Secure by default service to service communications
attribution: The Istio Team

View File

@ -1,6 +1,6 @@
---
title: Canary Deployments using Istio
description: Using Istio to create autoscaled canary deployments
description: Using Istio to create autoscaled canary deployments.
publishdate: 2017-06-14
attribution: Frank Budinsky
weight: 98

View File

@ -1,6 +1,6 @@
---
title: Using Network Policy with Istio
description: How Kubernetes Network Policy relates to Istio policy
description: How Kubernetes Network Policy relates to Istio policy.
publishdate: 2017-08-10
subtitle:
attribution: Spike Curtis

View File

@ -1,6 +1,6 @@
---
title: Announcing Istio 0.2
description: Istio 0.2 announcement
description: Istio 0.2 announcement.
publishdate: 2017-10-10
subtitle: Improved mesh and support for multiple environments
attribution: The Istio Team

View File

@ -1,6 +1,6 @@
---
title: 2017 Posts
description: Blog posts for 2017
description: Blog posts for 2017.
weight: 20
type: section-index
page_icon: /img/blog.svg

View File

@ -1,6 +1,6 @@
---
title: Mixer Adapter Model
description: Provides an overview of the Mixer plug-in architecture
description: Provides an overview of Mixer's plug-in architecture.
publishdate: 2017-11-03
subtitle: Extending Istio to integrate with a world of infrastructure backends
attribution: Martin Taillefer

View File

@ -1,6 +1,6 @@
---
title: Mixer and the SPOF Myth
description: Improving availability and reducing latency
description: Improving availability and reducing latency.
publishdate: 2017-12-07
subtitle: Improving availability and reducing latency
attribution: Martin Taillefer

View File

@ -1,6 +1,6 @@
---
title: 2018 Posts
description: Blog posts for 2018
description: Blog posts for 2018.
weight: 10
type: section-index
page_icon: /img/blog.svg

View File

@ -1,6 +1,6 @@
---
title: Configuring Istio Ingress with AWS NLB
description: Describes how to configure Istio ingress with a network load balancer on AWS
description: Describes how to configure Istio ingress with a network load balancer on AWS.
publishdate: 2018-04-20
subtitle: Ingress AWS Network Load Balancer
attribution: Julien SENON

View File

@ -1,6 +1,6 @@
---
title: Delayering Istio with AppSwitch
description: Automatic application onboarding and latency optimizations using AppSwitch
description: Automatic application onboarding and latency optimizations using AppSwitch.
publishdate: 2018-07-30
subtitle:
attribution: Dinesh Subhraveti (AppOrbit and Columbia University)

View File

@ -1,6 +1,6 @@
---
title: Consuming External Web Services
description: Describes a simple scenario based on Istio Bookinfo sample
description: Describes a simple scenario based on Istio's Bookinfo example.
publishdate: 2018-01-31
subtitle: Egress Rules for HTTPS traffic
attribution: Vadim Eisenberg

View File

@ -1,6 +1,6 @@
---
title: Consuming External TCP Services
description: Describes a simple scenario based on Istio Bookinfo sample
description: Describes a simple scenario based on Istio's Bookinfo example.
publishdate: 2018-02-06
subtitle: Mesh-external Service Entries for TCP traffic
attribution: Vadim Eisenberg

View File

@ -1,7 +1,7 @@
---
title: All Day Istio Twitch Stream
subtitle:
description: Istio hosting an all day twitch stream to celebrate the 1.0 release
description: Istio hosting an all day Twitch stream to celebrate the 1.0 release.
publishdate: 2018-08-03
attribution: Spencer Krum, IBM
weight: 83

View File

@ -1,6 +1,6 @@
---
title: Istio Soft Multi-tenancy Support
description: Using Kubernetes namespace and RBAC to create an Istio soft multi-tenancy environment
description: Using Kubernetes namespaces and RBAC to create an Istio soft multi-tenancy environment.
publishdate: 2018-04-19
subtitle: Using multiple Istio control planes and RBAC to create multi-tenancy
attribution: John Joyce and Rich Curran

View File

@ -1,6 +1,6 @@
---
title: Traffic Mirroring with Istio for Testing in Production
description: An introduction to safer, lower-risk deployments and release to production
description: An introduction to safer, lower-risk deployments and release to production.
publishdate: 2018-02-08
subtitle: Routing rules for HTTP traffic
attribution: Christian Posta

View File

@ -1,6 +1,6 @@
---
title: Concepts
description: Concepts help you learn about the different parts of the Istio system and the abstractions it uses.
description: Learn about the different parts of the Istio system and the abstractions it uses.
weight: 10
type: section-index
page_icon: /img/concepts.svg

View File

@ -431,7 +431,7 @@ The following example shows the `peers:` section enabling transport
authentication using mutual TLS.
{{< text yaml >}}
peers:
peers:
- mtls: {}
{{< /text >}}

View File

@ -1,6 +1,6 @@
---
title: Configure an Egress Gateway
description: Describes how to configure Istio to direct traffic to external services through a dedicated gateway service
description: Describes how to configure Istio to direct traffic to external services through a dedicated gateway.
weight: 43
keywords: [traffic-management,egress]
---

View File

@ -1,6 +1,6 @@
---
title: TLS Origination for Egress Traffic
description: Describes how to configure Istio to perform TLS origination for traffic to external services
description: Describes how to configure Istio to perform TLS origination for traffic to external services.
keywords: [traffic-management,egress]
weight: 42
---

View File

@ -1,6 +1,6 @@
---
title: Reference
description: The Reference section contains detailed authoritative reference material such as command-line options, configuration options, and API calling parameters.
description: Detailed authoritative reference material such as command-line options, configuration options, and API calling parameters.
weight: 60
type: section-index
page_icon: /img/reference.svg

View File

@ -1,6 +1,6 @@
---
title: Quick Start with Google Kubernetes Engine
description: Quick Start instructions to setup the Istio service using Google Kubernetes Engine (GKE)
description: How to quickly setup Istio using Google Kubernetes Engine (GKE).
weight: 20
keywords: [kubernetes,gke,google]
---

View File

@ -1,6 +1,6 @@
---
title: Tasks
description: Tasks show you how to do a single specific targeted activity with the Istio system.
description: How to do single specific targeted activities with the Istio system.
weight: 20
type: section-index
page_icon: /img/tasks.svg

View File

@ -1,6 +1,6 @@
---
title: Authorization
description: Shows how to set up role-based access control for services in Istio mesh.
description: Shows how to set up role-based access control for services in the mesh.
weight: 40
keywords: [security,access-control,rbac,authorization]
---

View File

@ -1,6 +1,6 @@
---
title: Distributed Tracing
description: How to configure the proxies to send tracing requests to Zipkin or Jaeger
description: How to configure the proxies to send tracing requests to Zipkin or Jaeger.
weight: 10
keywords: [telemetry,tracing]
aliases:

View File

@ -1,6 +1,6 @@
---
title: Logging with Fluentd
description: This task shows you how to configure Istio to log to a Fluentd daemon
description: This task shows you how to configure Istio to log to a Fluentd daemon.
weight: 60
keywords: [telemetry,logging]
---

View File

@ -88,10 +88,10 @@ still expect the end-to-end flow to continue without any errors.
7 seconds. However, there is a problem: the Reviews section displays an error
message:
{{< text plain >}}
Error fetching product reviews!
Sorry, product reviews are currently unavailable for this book.
{{< /text >}}
{{< text plain >}}
Error fetching product reviews!
Sorry, product reviews are currently unavailable for this book.
{{< /text >}}
1. View the web page response times:
1. Open the *Developer Tools* menu in you web browser.

View File

@ -1,6 +1,6 @@
---
title: Reporting Bugs
description: What to do when you find a bug
description: What to do if you find a bug.
weight: 35
aliases:
- /bugs.html

View File

@ -1,7 +1,7 @@
---
title: General FAQ
linktitle: General
description: General Q & A
description: General Q & A.
weight: 10
type: faq
page_icon: /img/faq.svg

View File

@ -1,7 +1,7 @@
---
title: Mixer FAQ
linktitle: Mixer
description: Mixer Q & A
description: Mixer Q & A.
weight: 40
type: faq
page_icon: /img/faq.svg

View File

@ -1,7 +1,7 @@
---
title: Security FAQ
linktitle: Security
description: Security Q & A
description: Security Q & A.
weight: 30
type: faq
page_icon: /img/faq.svg

View File

@ -1,7 +1,7 @@
---
title: Setup FAQ
linktitle: Setup
description: Setup Q & A
description: Setup Q & A.
weight: 20
type: faq
page_icon: /img/faq.svg

View File

@ -1,7 +1,7 @@
---
title: Telemetry FAQ
linktitle: Telemetry
description: Telemetry Q & A
description: Telemetry Q & A.
weight: 45
type: faq
page_icon: /img/faq.svg

View File

@ -1,7 +1,7 @@
---
title: Traffic Management FAQ
linktitle: Traffic Management
description: Traffic Management Q & A
description: Traffic Management Q & A.
weight: 50
type: faq
page_icon: /img/faq.svg

View File

@ -1,6 +1,6 @@
---
title: Deployment and Configuration Guidelines
description: Provides specific deployment or configuration guidelines or issue avoidance
description: Provides specific deployment and configuration guidelines.
weight: 5
---

View File

@ -1,6 +1,6 @@
---
title: Observing Traffic Management
description: Describes tools and techniques to observe traffic management or issues related to traffic management
description: Describes tools and techniques to observe traffic management or issues related to traffic management.
weight: 5
---

View File

@ -1,6 +1,6 @@
---
title: Troubleshooting Networking Issues
description: Describes tools and techniques that can be used to root cause networking issues
description: Describes tools and techniques that can be used to root cause networking issues.
weight: 5
---

View File

@ -239,7 +239,7 @@ Istio 为服务选择策略的时候,按照 **服务级 > 命名空间级 >
下面的代码段展示了使用 `peers` 启用基于双向 TLS 进行传输认证的方法:
{{< text yaml >}}
peers:
peers:
- mtls: {}
{{< /text >}}

View File

@ -215,7 +215,7 @@ $ kubectl describe pod --namespace kube-system $(kubectl get pods --namespace ku
您应该可以看到 `MutatingAdmissionWebhook``ValidatingAdmissionWebhook` 标志:
{{< text plain >}}
--admission-control=...,MutatingAdmissionWebhook,...,ValidatingAdmissionWebhook,...
--admission-control=...,MutatingAdmissionWebhook,...,ValidatingAdmissionWebhook,...
{{< /text >}}
## 下载和准备安装

View File

@ -621,7 +621,7 @@ $ istioctl delete destinationrule set-sni-for-egress-gateway
## 故障排除
1. 检查您是否在 Istio 中启用了[双向 TLS 认证](/zh/docs/tasks/security/mutual-tls/),然后执行以下步骤:[验证 Istio 的双向 TLS 认证设置](/docs/tasks/security/mutual-tls/#verifying-istio-s-mutual-tls-authentication-setup)。如果启用了双向 TLS请确保创建相应的项目配置请注意备注 _如果您在 Istio 中启用了双向 TLS 认证,则必须创建..._ )。
1. 检查您是否在 Istio 中启用了[双向 TLS 认证](/zh/docs/tasks/security/mutual-tls/),然后执行以下步骤:[验证 Istio 的双向 TLS 认证设置](/docs/tasks/security/mutual-tls/#verify-mutual-tls-configuration)。如果启用了双向 TLS请确保创建相应的项目配置请注意备注 _如果您在 Istio 中启用了双向 TLS 认证,则必须创建..._ )。
1. 如果[双向 TLS 认证](/zh/docs/tasks/security/mutual-tls/)启用后, 验证 egress 网关的证书:

View File

@ -6,6 +6,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#466BB0"/>
{{ with .Page.Description }}
{{ if not (or (strings.HasSuffix . ".") (strings.HasSuffix . "。")) }}
{{ end }}
{{ end }}
{{ define "description" }}{{ with .Page.Description }}{{ . }}{{ else }}Connect, secure, control, and observe services.{{ end }}{{ end }}
<meta name="title" content="{{ .Title }}">

View File

@ -31,6 +31,12 @@ parameter.
{{ $title := or (.Get "title") (.Get "caption") }}
{{ $alt := or (.Get "alt") (.Get "title") (.Get "caption") }}
{{ with $caption }}
{{ if (strings.HasSuffix . ".") }}
MARKDOWN ERROR: image caption ends with a period.
{{ end }}
{{ end }}
{{/* Turn relative values for $link into absolute URLs */}}
{{ .Scratch.Set "link" $link }}

View File

@ -30,19 +30,24 @@ be invalid HTML
{{ $scratch.Set "syntax" (.Get 0) }}
{{ $scratch.Set "output" (.Get 1) }}
{{ else }}
{{ $scratch.Set "syntax" "plain" }}
{{ $scratch.Set "text" "ERROR: markdown content did not indicate syntax" }}
{{ $scratch.Set "syntax" "error" }}
{{ $scratch.Set "text" "MARKDOWN ERROR: text block does not specify syntax" }}
{{ end }}
{{ if (hasPrefix ($scratch.Get "text") " ") }}
{{ $scratch.Set "syntax" "error" }}
{{ $scratch.Set "text" "MARKDOWN ERROR: text blocks need to not be indented, or indented by a multiple of 4 spaces" }}
{{ end }}
{{ if eq ($scratch.Get "syntax") "bash" }}
{{ if not (hasPrefix ($scratch.Get "text") "$") }}
{{ $scratch.Set "syntax" "plain" }}
{{ $scratch.Set "text" "ERROR: markdown specified a bash syntax, but first line didn't start with $" }}
{{ end }}
{{ $scratch.Set "syntax" "error" }}
{{ $scratch.Set "text" "MARKDOWN ERROR: text block specifies a bash syntax, but first line does not start with $" }}
{{ else }}
{{ if hasPrefix (trim ($scratch.Get "text") " ") "$ cat <<EOF " }}{{ $scratch.Set "text" (replace ($scratch.Get "text") "$ cat" "cat") }}
{{ else }}{{ $scratch.Set "syntax" "command" }}
{{ if ($scratch.Get "output") }}{{ $scratch.Set "syntax" (printf "command-output-as-%s" ($scratch.Get "output")) }}{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ if $scratch.Get "downloadas"}}
<pre><code class='language-{{ $scratch.Get "syntax" }}' data-downloadas='{{ $scratch.Get "downloadas" }}'>{{ $scratch.Get "text" }}</code></pre>
{{ else }}

View File

@ -6,4 +6,8 @@ echo -ne "html-minifier "
html-minifier --version
hugo --baseURL "$1"
if [ "$2" == "-no_minify" ]
then
html-minifier --input-dir public --output-dir public --file-ext html --collapse-whitespace --minify-js --minify-css --sort-attributes --sort-class-name --remove-attribute-quotes --remove-comments
fi

View File

@ -59,12 +59,12 @@ check_content() {
}
check_content content --en-us
check_content content_zh --zh-cn
#check_content content_zh --zh-cn
grep -nr -e "ERROR: markdown" ./public
grep -nr -e "MARKDOWN ERROR:" ./public
if [ "$?" == "0" ]
then
echo "Ensure text blocks are either not indented, or indented by a multiple of 4 spaces"
echo "Errors found in the markdown content"
FAILED=1
fi