Skip to content

Commit

Permalink
Merge branch 'automatic-highlight-update' of github.com:giantswarm/do…
Browse files Browse the repository at this point in the history
…cs into automatic-highlight-update
  • Loading branch information
pipo02mix committed Dec 13, 2024
2 parents 153a569 + e43c3c8 commit c2922d7
Show file tree
Hide file tree
Showing 896 changed files with 4,567 additions and 21,085 deletions.
5 changes: 5 additions & 0 deletions .abs/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
generate-metadata: true
chart-dir: ./helm/docs-app
destination: ./build
catalog-base-url: https://giantswarm.github.io/giantswarm-operations-platform-catalog/
replace-chart-version-with-git: true
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
command: |
container_tag=$(architect project version)
echo "$container_tag"
docker run -d --rm --name docs -p 8080:8080 gsoci.azurecr.io/giantswarm/docs:$container_tag
docker run -d --rm --name docs-app -p 8080:8080 gsoci.azurecr.io/giantswarm/docs:$container_tag
CURL_OUTPUT=$(docker run --link docs gsoci.azurecr.io/giantswarm/curl:7.81.0 curl --no-buffer http://docs:8080)
CURL_OUTPUT=$(docker run --link docs-app gsoci.azurecr.io/giantswarm/curl:7.81.0 curl --no-buffer http://docs-app:8080)
echo $CURL_OUTPUT | grep -q "Giant Swarm"
workflows:
Expand All @@ -43,6 +43,7 @@ workflows:
- master
- architect/push-to-app-catalog:
context: architect
executor: app-build-suite
name: push-to-app-catalog
app_catalog: giantswarm-operations-platform-catalog
app_catalog_test: giantswarm-operations-platform-test-catalog
Expand Down
142 changes: 130 additions & 12 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: Validate

# This is supposed to run on all pull requests to ensure
# formal sanity of content, formatting, front matter, and structure.
on:
pull_request:
branches:
Expand All @@ -9,30 +12,36 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install dependencies
run: pip3 install click colored==1.4.4
run: pip3 install click colored

- name: Validate front matter for changed files
run: |
git fetch --no-tags origin "${GITHUB_BASE_REF}":"${GITHUB_BASE_REF}"
git diff --name-only "refs/heads/${GITHUB_BASE_REF}" -- . | tee files.txt
cat files.txt | python3 scripts/validate-front-matter/script.py
- name: Print front matter annotations
run: cat ./annotations.json
if [ -s files.txt ]; then
cat files.txt | python3 scripts/validate-front-matter/script.py
# Print for debugging
printf "\nAnnotations JSON:\n"
cat ./annotations.json
# Save as environment variable for next step
echo "found_front_matter_issues=true" >> $GITHUB_ENV
fi
rm files.txt
- name: Send front matter annotations
uses: giantswarm/annotations-action@8028d6604d2db401d4dcd30c21a99fa26e662544
if: ${{ env.found_front_matter_issues == 'true' }}
uses: yuzutech/annotations-action@0e061a6e3ac848299310b6429b60d67cafd4e7f8 # v0.5.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
title: Front matter problems
input: ./annotations.json

- name: markdownlint
run: |
make RUNNING_IN_CI=true lint || true
make RUNNING_IN_CI=true lint-markdown || true
# Only fail if the run didn't work for technical reasons
if [ ! -e markdownlint.out ]; then
Expand All @@ -44,12 +53,17 @@ jobs:
cat markdownlint.out \
| jq -nR '[inputs | (. | capture("(?<filename>[^:]+):(?<line>[0-9]+)(:(?<col>[0-9]+))?\\s+(?<description>.+)") | {"file": .filename, "line": (.line | tonumber), "end_line": (.line | tonumber), "title": "markdownlint problem", "message": .description, "annotation_level": "error"})]' \
> markdownlint-annotations.json
- name: Print markdownlint annotations
run: cat ./markdownlint-annotations.json
# Print for debugging
printf "\nAnnotations JSON:\n"
cat ./markdownlint-annotations.json
# Save as environment variable for next step
echo "found_markdown_issues=true" >> $GITHUB_ENV
- name: Send markdownlint annotations
uses: giantswarm/annotations-action@8028d6604d2db401d4dcd30c21a99fa26e662544
if: ${{ env.found_markdown_issues == 'true' }}
uses: yuzutech/annotations-action@0e061a6e3ac848299310b6429b60d67cafd4e7f8 # v0.5.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
title: markdownlint problems
Expand All @@ -62,3 +76,107 @@ jobs:
echo "ERROR: See markdownlint findings (annotated as errors in the PR when you click on 'Files changed')"
exit 1
fi
- name: Check for moved or deleted files
run: |
git --no-pager diff --name-status --diff-filter=RD "refs/heads/${GITHUB_BASE_REF}" -- . | tee files.txt
if [ -s files.txt ]; then
# Creat annotations JSON, as one object per line first
while read line; do
parts=($line)
mode=${parts[0]}
filename=${parts[1]}
if [ "$mode" == "D" ]; then
echo "{\"file\": \"$filename\", \"line\": 1, \"end_line\": 1, \"title\": \"File deleted\", \"message\": \"File deleted\", \"annotation_level\": \"warning\"}" >> mvdel-annotations-lines.json
else
newFilename=${parts[2]}
echo "{\"file\": \"$newFilename\", \"line\": 1, \"end_line\": 1, \"title\": \"File moved\", \"message\": \"File moved/renamed\", \"annotation_level\": \"warning\"}" >> mvdel-annotations-lines.json
fi
done <files.txt
# Convert JSON lines to array
jq --slurp '.' mvdel-annotations-lines.json > mvdel-annotations.json
rm mvdel-annotations-lines.json
# Print for debugging
printf "\nAnnotations JSON:\n"
cat ./mvdel-annotations.json
# Save as environment variable for next step
echo "deletes_or_moves_files=true" >> $GITHUB_ENV
else
echo "deletes_or_moves_files=false" >> $GITHUB_ENV
fi
rm files.txt
- name: Send annotations for moved or deleted files
if: ${{ env.deletes_or_moves_files == 'true' }}
uses: yuzutech/annotations-action@0e061a6e3ac848299310b6429b60d67cafd4e7f8 # v0.5.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
input: ./mvdel-annotations.json
title: "Files moved or deleted"


- name: Add/update comment about moved/deleted files
if: ${{ env.deletes_or_moves_files == 'true' }}
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
comment-tag: files-deleted-or-moved
message: |
This PR moves/renames or deletes some files. Please make sure to
- maintain references (also important for images)
- Maintain `aliases` in the front matter of moved markdown files
- name: Delete comment about moved/deleted files
if: ${{ env.deletes_or_moves_files == 'false' }}
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
comment-tag: files-deleted-or-moved
mode: delete

- name: Setup Hugo
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
with:
hugo-version: "0.125.5"
extended: true

- id: hugobuild
name: Build Hugo site
run: |
hugo --source ./src --printPathWarnings --printUnusedTemplates --renderToMemory | tee hugo.out
grep "WARN" hugo.out > hugo-warnings.out || true
if [ -s hugo-warnings.out ]; then
echo "hugo_warnings=true" >> $GITHUB_ENV
{
echo 'hugo-warnings<<EOF'
cat hugo-warnings.out
echo EOF
} >> $GITHUB_OUTPUT
else
echo "hugo_warnings=false" >> $GITHUB_ENV
fi
- name: Add/update comment about Hugo warnings
if: ${{ env.hugo_warnings == 'true' }}
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
comment-tag: hugo-warnings
message: |
Hugo yielded some warnings. Please [check](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) whether they require action.
```nohighlight
${{ steps.hugobuild.outputs.hugo-warnings }}
```
- name: Delete comment about Hugo warnings
if: ${{ env.hugo_warnings == 'false' }}
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
comment-tag: hugo-warnings
mode: delete
3 changes: 3 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ MD051: false
# We use the Hugo functionality such as `[1]: {{< relref "..." >}}` which markdownlint recognizes as undefined reference,
# so the lint is not helpful.
MD052: false

MD046:
style: fenced
62 changes: 31 additions & 31 deletions .vale/styles/Microsoft/Contractions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,47 @@ link: https://docs.microsoft.com/en-us/style-guide/word-choice/use-contractions
level: error
ignorecase: true
action:
name: replace
name: suggest
swap:
are not: aren't
cannot: can't
could not: couldn't
did not: didn't
do not: don't
does not: doesn't
has not: hasn't
have not: haven't
how is: how's
is not: isn't
# are not: aren't
# cannot: can't
# could not: couldn't
# did not: didn't
# do not: don't
# does not: doesn't
# has not: hasn't
# have not: haven't
# how is: how's
# is not: isn't

'it is(?!\.)': it's
'it''s(?=\.)': it is
# 'it is(?!\.)': it's
# 'it''s(?=\.)': it is

should not: shouldn't
# should not: shouldn't

"that is(?![.,])": that's
'that''s(?=\.)': that is
# "that is(?![.,])": that's
# 'that''s(?=\.)': that is

'they are(?!\.)': they're
'they''re(?=\.)': they are
# 'they are(?!\.)': they're
# 'they''re(?=\.)': they are

was not: wasn't
# was not: wasn't

'we are(?!\.)': we're
'we''re(?=\.)': we are
# 'we are(?!\.)': we're
# 'we''re(?=\.)': we are

'we have(?!\.)': we've
'we''ve(?=\.)': we have
# 'we have(?!\.)': we've
# 'we''ve(?=\.)': we have

were not: weren't
# were not: weren't

'what is(?!\.)': what's
'what''s(?=\.)': what is
# 'what is(?!\.)': what's
# 'what''s(?=\.)': what is

'when is(?!\.)': when's
'when''s(?=\.)': when is
# 'when is(?!\.)': when's
# 'when''s(?=\.)': when is

'where is(?!\.)': where's
'where''s(?=\.)': where is
# 'where is(?!\.)': where's
# 'where''s(?=\.)': where is

will not: won't
# will not: won't
7 changes: 7 additions & 0 deletions .vale/styles/config/vocabularies/docs/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ firewalling
freely
Grafana
gsctl
Honeybadger
HTTP
IP[s]?
IPAM
JSON
k8s
Keybase
keyless
Kinvolk
krew
Kustomize
Expand All @@ -52,17 +55,21 @@ NLB[s]?
onboarding
passthrough
perfectly
Planeteers
Promtail
quickly
randomly
rapidly
really
relref
rulesets
runbook[s]?
SemVer
separately
Sigstore
SLA[s]?
Spotify
SRE[s]?
SSL
subnet
Trivy
Expand Down
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,19 @@ RUN find /public \
-delete

FROM gsoci.azurecr.io/giantswarm/nginx:1.25-alpine
EXPOSE 8080
USER 0

# Delete default config (which we have no control over)
RUN rm -r /etc/nginx/conf.d && rm /etc/nginx/nginx.conf

COPY nginx.conf /etc/nginx/nginx.conf

RUN nginx -t -c /etc/nginx/nginx.conf && \
rm -rf /tmp/nginx.pid
# Ensure tmp dir exists and has right ownership
RUN mkdir -p /tmp/nginx && chown -R 101 /tmp/nginx

EXPOSE 8080
RUN nginx -t -c /etc/nginx/nginx.conf && \
rm -rf /tmp/nginx/nginx.pid

COPY --from=build --chown=101 /public /usr/share/nginx/html

USER 101
5 changes: 4 additions & 1 deletion helm/docs-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ apiVersion: v1
annotations:
application.giantswarm.io/team: "sig-docs"
appVersion: 0.0.1
engine: gotpl
description: Giant Swarm documentation published at https://docs.giantswarm.io/
home: https://github.com/giantswarm/docs/
icon: https://s.giantswarm.io/app-icons/giantswarm/1/light.svg
name: docs-app
version: "[[.Version]]"
sources:
- https://github.com/giantswarm/docs
version: 2.2.1327-dev
Loading

0 comments on commit c2922d7

Please sign in to comment.