Skip to content

Commit c0ef747

Browse files
committed
Merge branch 'release-rs-fuya-fuya' into DOC-3944
2 parents cb86993 + f1471c9 commit c0ef747

File tree

450 files changed

+35270
-2022
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

450 files changed

+35270
-2022
lines changed

.github/workflows/k8s_apis_sync.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,30 @@ jobs:
5555
crdoc --resources crds/reaadb_crd.yaml --output artifacts/redis_enterprise_active_active_database_api.md --template templates/template.tmpl
5656
sed -E -i 's/^### RedisEnterpriseActiveActiveDatabase\./### /g' artifacts/redis_enterprise_active_active_database_api.md
5757
sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterpriseactiveactivedatabase/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_active_active_database_api.md
58-
sed -E -i 's/<td><b><a href="#redisenterpriseactiveactivedatabase/<td><b><a href="#/' artifacts/redis_enterprise_active_active_database_api.md
58+
sed -E -i 's/<td><a href="#redisenterpriseactiveactivedatabase/<td><a href="#/' artifacts/redis_enterprise_active_active_database_api.md
59+
sed -E -i 's/\[index\]/\[\]/g' artifacts/redis_enterprise_active_active_database_api.md
60+
awk '/(#[^")]+)index/ {gsub(/index/,"")}; {print}' artifacts/redis_enterprise_active_active_database_api.md > _tmp.md && mv _tmp.md artifacts/redis_enterprise_active_active_database_api.md
5961
6062
crdoc --resources crds/rec_crd.yaml --output artifacts/redis_enterprise_cluster_api.md --template templates/template.tmpl
6163
sed -E -i 's/^### RedisEnterpriseCluster\./### /g' artifacts/redis_enterprise_cluster_api.md
6264
sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterprisecluster/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_cluster_api.md
63-
sed -E -i 's/<td><b><a href="#redisenterprisecluster/<td><b><a href="#/' artifacts/redis_enterprise_cluster_api.md
65+
sed -E -i 's/<td><a href="#redisenterprisecluster/<td><a href="#/' artifacts/redis_enterprise_cluster_api.md
66+
sed -E -i 's/\[index\]/\[\]/g' artifacts/redis_enterprise_cluster_api.md
67+
awk '/(#[^")]+)index/ {gsub(/index/,"")}; {print}' artifacts/redis_enterprise_cluster_api.md > _tmp.md && mv _tmp.md artifacts/redis_enterprise_cluster_api.md
6468
6569
crdoc --resources crds/redb_crd.yaml --output artifacts/redis_enterprise_database_api.md --template templates/template.tmpl
6670
sed -E -i 's/^### RedisEnterpriseDatabase\./### /g' artifacts/redis_enterprise_database_api.md
6771
sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterprisedatabase/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_database_api.md
68-
sed -E -i 's/<td><b><a href="#redisenterprisedatabase/<td><b><a href="#/' artifacts/redis_enterprise_database_api.md
72+
sed -E -i 's/<td><a href="#redisenterprisedatabase/<td><a href="#/' artifacts/redis_enterprise_database_api.md
73+
sed -E -i 's/\[index\]/\[\]/g' artifacts/redis_enterprise_database_api.md
74+
awk '/(#[^")]+)index/ {gsub(/index/,"")}; {print}' artifacts/redis_enterprise_database_api.md > _tmp.md && mv _tmp.md artifacts/redis_enterprise_database_api.md
6975
70-
crdoc --resources crds/rerc_crd.yaml --output artifacts/redis_enterprise_remote_cluster.md --template templates/template.tmpl
71-
sed -E -i 's/^### RedisEnterpriseRemoteCluster\./### /g' artifacts/redis_enterprise_remote_cluster.md
72-
sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterpriseremotecluster/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_remote_cluster.md
73-
sed -E -i 's/<td><b><a href="#redisenterpriseremotecluster/<td><b><a href="#/' artifacts/redis_enterprise_remote_cluster.md
76+
crdoc --resources crds/rerc_crd.yaml --output artifacts/redis_enterprise_remote_cluster_api.md --template templates/template.tmpl
77+
sed -E -i 's/^### RedisEnterpriseRemoteCluster\./### /g' artifacts/redis_enterprise_remote_cluster_api.md
78+
sed -E -i 's/^<sup><sup>\[↩ Parent\]\(#redisenterpriseremotecluster/<sup><sup>\[↩ Parent\]\(#/g' artifacts/redis_enterprise_remote_cluster_api.md
79+
sed -E -i 's/<td><a href="#redisenterpriseremotecluster/<td><a href="#/' artifacts/redis_enterprise_remote_cluster_api.md
80+
sed -E -i 's/\[index\]/\[\]/g' artifacts/redis_enterprise_remote_cluster_api.md
81+
awk '/(#[^")]+)index/ {gsub(/index/,"")}; {print}' artifacts/redis_enterprise_remote_cluster_api.md > _tmp.md && mv _tmp.md artifacts/redis_enterprise_remote_cluster_api.md
7482
7583
- name: 'Send pull request'
7684
env:
@@ -88,7 +96,7 @@ jobs:
8896
cp artifacts/redis_enterprise_active_active_database_api.md content/operate/kubernetes/reference/
8997
cp artifacts/redis_enterprise_cluster_api.md content/operate/kubernetes/reference/
9098
cp artifacts/redis_enterprise_database_api.md content/operate/kubernetes/reference/
91-
cp artifacts/redis_enterprise_remote_cluster.md content/operate/kubernetes/reference/
99+
cp artifacts/redis_enterprise_remote_cluster_api.md content/operate/kubernetes/reference/
92100
93101
git apply content/operate/kubernetes/reference/kubernetes-api-reference-frontmatter.patch
94102

.github/workflows/main-staging.yml

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,92 @@ jobs:
3333
echo "ERROR: Invalid branch name ${{ github.ref_name }}!"
3434
exit 1
3535
fi
36-
- name: Configure Hugo
36+
37+
- name: Install dependencies
38+
run: make deps
39+
40+
- name: Build out all versions
3741
run: |
42+
set -x
43+
44+
function setBaseUrl() {
3845
if [[ "${{ github.ref_name }}" == "main" ]]
3946
then
4047
hugo_root_path=docs/staging/dev
4148
elif [[ "${{ github.ref_name }}" == "latest" ]]
4249
then
43-
hugo_root_path="docs/latest"
50+
hugo_root_path="docs/latest"
4451
elif [[ "${{ endsWith(github.ref_name, '-build') }}" == "true" ]]
4552
then
4653
hugo_root_path=`echo docs/version/${{ github.ref_name }} | sed 's/-build$//'`
4754
else
4855
hugo_root_path=docs/staging/${{ github.ref_name }}
4956
fi \
5057
&& sed -i "s#baseURL = \"https://redis.io\"#baseURL = \"https://redis.io/$hugo_root_path\"#g" config.toml
51-
- name: Install dependencies and run Hugo
52-
run: make all
58+
}
59+
60+
setBaseUrl
61+
kubernetes_versions=($(find content/operate/kubernetes/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
62+
rs_versions=($(find content/operate/rs/ -maxdepth 1 -type d -regex ".*[0-9-]" | awk -F/ '{print $NF}'))
63+
64+
# build latest
65+
for version in "${kubernetes_versions[@]}"; do
66+
rm -r "content/operate/kubernetes/${version}"
67+
done
68+
for version in "${rs_versions[@]}"; do
69+
rm -r "content/operate/rs/${version}"
70+
done
71+
make all
72+
73+
git checkout .
74+
75+
# build all versions
76+
for version in "${kubernetes_versions[@]}"; do
77+
78+
setBaseUrl
79+
80+
# for each version, remove all other versions before building
81+
versions_to_remove=($(echo "${kubernetes_versions[@]}" "${version}" | tr ' ' '\n' | sort | uniq -u))
82+
for version_to_remove in "${versions_to_remove[@]}"; do
83+
rm -r "content/operate/kubernetes/${version_to_remove}"
84+
done
85+
86+
cp -r "content/operate/kubernetes/${version}"/* content/operate/kubernetes/
87+
rm -r "content/operate/kubernetes/${version}"
88+
sed -i 's/id="versionSelectorKubernetesValue" class="version-selector-control">latest/id="versionSelectorKubernetesValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html
89+
sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis for Kubernetes/' content/operate/kubernetes/_index.md
90+
91+
# inject replace command in meta-links to make sure editURL and issuesURL point to right version
92+
sed -i "11i \{\{ \$gh_file = replaceRE \`\^operate\/kubernetes\/\` \"operate\/kubernetes\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
93+
94+
hugo -d "kubernetes-${version}"
95+
96+
git checkout .
97+
done
98+
99+
for version in "${rs_versions[@]}"; do
100+
101+
setBaseUrl
102+
103+
# for each version, remove all other versions before building
104+
versions_to_remove=($(echo "${rs_versions[@]}" "${version}" | tr ' ' '\n' | sort | uniq -u))
105+
for version_to_remove in "${versions_to_remove[@]}"; do
106+
rm -r "content/operate/rs/${version_to_remove}"
107+
done
108+
109+
cp -r "content/operate/rs/${version}"/* content/operate/rs/
110+
rm -r "content/operate/rs/${version}"
111+
sed -i 's/id="versionSelectorRsValue" class="version-selector-control">latest/id="versionSelectorRsValue" class="version-selector-control">v'"${version}"'/' layouts/partials/docs-nav.html
112+
sed -i 's/linkTitle: '"${version}"'/linkTitle: Redis Software/' content/operate/rs/_index.md
113+
114+
# inject replace command in meta-links to make sure editURL and issuesURL point to right version
115+
sed -i "11i \{\{ \$gh_file = replaceRE \`\^operate\/rs\/\` \"operate\/rs\/$version\/\" \$gh_file }}" layouts/partials/meta-links.html
116+
117+
hugo -d "rs-${version}"
118+
119+
git checkout .
120+
done
121+
53122
- name: List client examples
54123
run: ls "${{ github.workspace }}/examples"
55124
- name: List files to be published
@@ -80,5 +149,12 @@ jobs:
80149
bucket_path=staging/${{ github.ref_name }}
81150
fi \
82151
&& ./google-cloud-sdk/bin/gsutil -m rsync -r -c -j html -d ${{ github.workspace }}/public gs://$BUCKET/$bucket_path
152+
153+
versioned_builds=($(find . -type d -regex ".*[0-9-]" -maxdepth 1 | sed -E 's/^.\///'))
154+
for versioned_build in "${versioned_builds[@]}"; do
155+
product=$(grep -Eo '[a-zA-Z]+' <<< $versioned_build)
156+
gsutil -m rsync -r -c -j html -d "${{ github.workspace }}/${versioned_build}/operate/${product}" "gs://${BUCKET}/${versioned_build}/operate/${product}"
157+
done
158+
83159
- name: End
84160
run: echo "This job's status is ${{ job.status }}."
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: redis_docs_sync
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release:
7+
type: string
8+
required: true
9+
description: ''
10+
11+
jobs:
12+
redis_docs_sync:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
actions: write
17+
steps:
18+
- name: Generate a token
19+
id: generate-token
20+
uses: actions/create-github-app-token@v1
21+
with:
22+
app-id: ${{ secrets.DOCS_APP_ID }}
23+
private-key: ${{ secrets.DOCS_APP_PRIVATE_KEY }}
24+
25+
- name: 'Checkout'
26+
uses: actions/checkout@v3
27+
with:
28+
token: ${{ steps.generate-token.outputs.token }}
29+
30+
- name: 'Generate modules-api-ref.md and commands.json files and push if necessary'
31+
env:
32+
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
33+
run: |-
34+
RELEASE="${{ github.event.inputs.release }}"
35+
BRANCH="redis_docs_sync_${RELEASE}"
36+
37+
# Generate modules-api-ref.md
38+
gh repo clone redis/redis
39+
pushd redis
40+
git fetch origin --tags
41+
git checkout "tags/${RELEASE}"
42+
make 1>/dev/null
43+
src/redis-server &
44+
utils/generate-commands-json.py > generated-commands.json
45+
utils/generate-module-api-doc.rb > generated-modules-api-ref.md
46+
popd
47+
48+
# check if remote branch already exists
49+
git fetch --all
50+
set +e
51+
git ls-remote --exit-code --heads origin "refs/heads/${BRANCH}"
52+
if [ "$?" -eq 0 ]; then
53+
set -e
54+
# if it does, create local branch off existing remote branch
55+
git checkout -b "${BRANCH}" "origin/${BRANCH}"
56+
git branch --set-upstream-to="origin/${BRANCH}" "${BRANCH}"
57+
git pull
58+
else
59+
set -e
60+
# otherwise, create local branch from main
61+
git checkout -b "${BRANCH}"
62+
fi
63+
64+
mv redis/generated-modules-api-ref.md content/develop/reference/modules/modules-api-ref.md
65+
mv redis/generated-commands.json data/commands_core.json
66+
67+
# Apply frontmatter patch
68+
git apply content/develop/reference/modules/modules-api-ref-frontmatter.patch
69+
70+
# Check if there are any changes
71+
commands_core_is_different=$(git diff data/commands_core.json)
72+
modules_api_is_different=$(git diff content/develop/reference/modules/modules-api-ref.md)
73+
74+
# If commands_core file has changed, commit it
75+
if [[ ! -z $commands_core_is_different ]]; then
76+
git add data/commands_core.json
77+
git config user.email "177626021+redisdocsapp[bot]@users.noreply.github.com"
78+
git config user.name "redisdocsapp[bot]"
79+
git commit -m "Update commands_core.json for release ${RELEASE}"
80+
fi
81+
82+
# If modules-api-ref file has changed, commit it
83+
if [[ ! -z $modules_api_is_different ]]; then
84+
git add content/develop/reference/modules/modules-api-ref.md
85+
git config user.email "177626021+redisdocsapp[bot]@users.noreply.github.com"
86+
git config user.name "redisdocsapp[bot]"
87+
git commit -m "Update modules-api-ref.md for release ${RELEASE}"
88+
fi
89+
90+
if [[ ! -z $commands_core_is_different || ! -z $modules_api_is_different ]]; then
91+
git push origin "${BRANCH}"
92+
fi
93+
94+
# If a pr is not already open, create one
95+
set +e
96+
gh search prs -R redis/docs --state open --match title "redis docs sync ${RELEASE}" | grep -q "redis docs sync ${RELEASE}"
97+
if [ "$?" -eq 1 ]; then
98+
set -e
99+
gh pr create \
100+
--body "redis docs sync ${RELEASE}" \
101+
--title "redis docs sync ${RELEASE}" \
102+
--head "$BRANCH" \
103+
--base "main"
104+
fi

build/components/markdown.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def make_command_linkifier(commands: dict, name: str):
138138
def linkifier(m):
139139
command = m.group(1)
140140
if command in commands and command not in exclude:
141-
return f'[`{command}`](/commands/{command_filename(command)})'
141+
return f'[`{command}`]({{{{< relref "/commands/{command_filename(command)}" >}}}})'
142142
else:
143143
return m.group(0)
144144
return linkifier

build/update_cmds.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python3
2+
from components.syntax import Command
3+
from components.markdown import Markdown
4+
import json
5+
6+
if __name__ == '__main__':
7+
with open('data/commands_core.json', 'r') as f:
8+
j = json.load(f)
9+
10+
board = []
11+
for k in j:
12+
v = j.get(k)
13+
c = Command(k, v)
14+
sf = c.syntax()
15+
path = f'content/commands/{k.lower().replace(" ", "-")}/'
16+
md = Markdown(f'{path}index.md')
17+
md.fm_data |= v
18+
md.fm_data.update({
19+
'syntax_str': str(c),
20+
'syntax_fmt': sf,
21+
})
22+
if 'replaced_by' in md.fm_data:
23+
replaced = md.generate_commands_links(k, j, md.fm_data['replaced_by'])
24+
md.fm_data['replaced_by'] = replaced
25+
md.persist()

content/apis/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ If you have installed Redis Enterprise Software, you can automate operations wit
6060

6161
If you need to install Redis Enterprise on Kubernetes, then you can use the [Redis Enterprise for Kubernetes Operators]({{< relref "/operate/Kubernetes/" >}}). You can find the resource definitions here:
6262

63-
- [Redis Enterprise Cluster API](https://github.com/RedisLabs/redis-enterprise-k8s-docs/blob/master/redis_enterprise_cluster_api.md)
64-
- [Redis Enterprise Database API](https://github.com/RedisLabs/redis-enterprise-k8s-docs/blob/master/redis_enterprise_database_api.md)
63+
- [Redis Enterprise Cluster API]({{<relref "/operate/kubernetes/reference/redis_enterprise_cluster_api">}})
64+
- [Redis Enterprise Database API]({{<relref "/operate/kubernetes/reference/redis_enterprise_database_api">}})

content/commands/client-trackinginfo/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ Here's the list of tracking information sections and their respective values:
4343
* `caching-no`: The next command won't cache keys (exists only together with `optout`).
4444
* `noloop`: The client isn't notified about keys modified by itself.
4545
* `broken_redirect`: The client ID used for redirection isn't valid anymore.
46-
* **redirect**: The client ID used for notifications redirection, or -1 when none.
46+
* **redirect**: The client ID used for notifications redirection, 0 for self-redirection, or -1 when none.
4747
* **prefixes**: A list of key prefixes for which notifications are sent to the client.

content/commands/del/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ A key is ignored if it does not exist.
5757

5858
## Examples
5959

60+
{{< clients-example cmds_generic del >}}
61+
> SET key1 "Hello"
62+
"OK"
63+
> SET key2 "World"
64+
"OK"
65+
> DEL key1 key2 key3
66+
(integer) 2
67+
{{< /clients-example >}}
68+
69+
Give these commands a try in the interactive console:
70+
6071
{{% redis-cli %}}
6172
SET key1 "Hello"
6273
SET key2 "World"

content/commands/expire/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,29 @@ are now fixed.
137137

138138
## Examples
139139

140+
{{< clients-example cmds_generic expire >}}
141+
> SET mykey "Hello"
142+
"OK"
143+
> EXPIRE mykey 10
144+
(integer) 1
145+
> TTL mykey
146+
(integer) 10
147+
> SET mykey "Hello World"
148+
"OK"
149+
> TTL mykey
150+
(integer) -1
151+
> EXPIRE mykey 10 XX
152+
(integer) 0
153+
> TTL mykey
154+
(integer) -1
155+
> EXPIRE mykey 10 NX
156+
(integer) 1
157+
> TTL mykey
158+
(integer) 10
159+
{{< /clients-example >}}
160+
161+
Give these commands a try in the interactive console:
162+
140163
{{% redis-cli %}}
141164
SET mykey "Hello"
142165
EXPIRE mykey 10

0 commit comments

Comments
 (0)