Skip to content

Commit 3e3cb58

Browse files
authored
[FLINK-38448] Rework doc build and doc deployment (#1035)
1 parent ef31965 commit 3e3cb58

File tree

4 files changed

+112
-59
lines changed

4 files changed

+112
-59
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This implementation took inspiration from https://github.com/Burnett01/rsync-deployments/blob/7.1.0/action.yml
2+
name: Rsync Deploy (local)
3+
description: Upload a folder to a single remote destination via rsync over SSH.
4+
inputs:
5+
switches:
6+
description: rsync switches
7+
required: false
8+
default: "--archive --compress"
9+
path:
10+
description: Local source directory
11+
required: true
12+
remote_path:
13+
description: Remote destination directory
14+
required: true
15+
remote_host:
16+
description: SSH host
17+
required: true
18+
remote_port:
19+
description: SSH port
20+
required: false
21+
default: "22"
22+
remote_user:
23+
description: SSH username
24+
required: true
25+
remote_key:
26+
description: SSH private key (OpenSSH/PEM)
27+
required: true
28+
runs:
29+
using: composite
30+
steps:
31+
- name: rsync via ssh-agent
32+
shell: bash
33+
run: |
34+
set -euo pipefail
35+
36+
# Start agent and load the key
37+
eval "$(ssh-agent -s)"
38+
ssh-add - <<< "${{ inputs.remote_key }}"
39+
40+
# SSH command with host key checking disabled (matches your reference impl)
41+
RSH="ssh -o StrictHostKeyChecking=no -p ${{ inputs.remote_port }}"
42+
43+
# Resolve paths and DSN
44+
LOCAL_PATH="$GITHUB_WORKSPACE/${{ inputs.path }}"
45+
DSN="${{ inputs.remote_user }}@${{ inputs.remote_host }}"
46+
47+
# Deploy
48+
sh -c "rsync ${{ inputs.switches }} -e '$RSH' $LOCAL_PATH $DSN:${{ inputs.remote_path }}"
49+
50+
# Cleanup identities from the agent
51+
ssh-add -D || true

.github/workflows/docs.sh

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/docs.yaml

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
build-documentation:
2424
if: github.repository == 'apache/flink-kubernetes-operator'
2525
runs-on: ubuntu-latest
26+
env:
27+
HUGO_REPO: https://github.com/gohugoio/hugo/releases/download/v0.104.0/hugo_extended_0.104.0_Linux-64bit.tar.gz
28+
HUGO_ARTIFACT: hugo_extended_0.104.0_Linux-64bit.tar.gz
2629
strategy:
2730
max-parallel: 1
2831
matrix:
@@ -31,7 +34,12 @@ jobs:
3134
- release-1.13
3235
- release-1.12
3336
steps:
34-
- uses: actions/checkout@v3
37+
- name: Set up Temurin JDK 17
38+
uses: actions/setup-java@v4
39+
with:
40+
distribution: temurin
41+
java-version: 17
42+
- uses: actions/checkout@v4
3543
with:
3644
ref: ${{ matrix.branch }}
3745
- name: Set branch environment variable
@@ -49,11 +57,37 @@ jobs:
4957
fi
5058
- name: Build documentation
5159
run: |
52-
docker run --rm --volume "$PWD:/root/flink-kubernetes-operator" chesnay/flink-ci:java_8_11 bash -c "cd /root/flink-kubernetes-operator && ./.github/workflows/docs.sh"
60+
if ! curl --fail -OL "$HUGO_REPO" ; then
61+
echo "Failed to download Hugo binary"
62+
exit 1
63+
fi
64+
tar -zxvf "$HUGO_ARTIFACT"
65+
git submodule update --init --recursive
66+
67+
# generate docs into docs/target
68+
./hugo -v --source docs --destination target
69+
if [ $? -ne 0 ]; then
70+
echo "Error building the docs"
71+
exit 1
72+
fi
73+
74+
# build Java docs
75+
mkdir -p docs/target/api
76+
77+
mvn javadoc:aggregate -B \
78+
-DadditionalJOption="-Xdoclint:none" \
79+
-DadditionalJOption="--allow-script-in-comments" \
80+
-DexcludePackageNames="org.apache.flink.examples" \
81+
-Dmaven.javadoc.failOnError=false \
82+
-Dcheckstyle.skip=true \
83+
-Dspotless.check.skip=true \
84+
-Denforcer.skip=true \
85+
-Dheader="<a href=\"http://flink.apache.org/\" target=\"_top\"><h1>Back to Flink Website</h1></a> <script>var _paq=window._paq=window._paq||[];_paq.push([\"disableCookies\"]),_paq.push([\"setDomains\",[\"*.flink.apache.org\",\"*.nightlies.apache.org/flink\"]]),_paq.push([\"trackPageView\"]),_paq.push([\"enableLinkTracking\"]),function(){var u=\"//matomo.privacy.apache.org/\";_paq.push([\"setTrackerUrl\",u+\"matomo.php\"]),_paq.push([\"setSiteId\",\"1\"]);var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s)}();</script>"
86+
87+
mv target/site/apidocs docs/target/api/java
5388
- name: Upload documentation
54-
uses: burnett01/rsync-deployments@7.1.0
89+
uses: ./.github/actions/rsync-deployments
5590
with:
56-
switches: --archive --compress
5791
path: docs/target/
5892
remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/flink/flink-kubernetes-operator-docs-${{ env.flink_branch }}/
5993
remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }}
@@ -62,9 +96,8 @@ jobs:
6296
remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }}
6397
- name: Upload documentation alias
6498
if: env.flink_alias != ''
65-
uses: burnett01/rsync-deployments@7.1.0
99+
uses: ./.github/actions/rsync-deployments
66100
with:
67-
switches: --archive --compress
68101
path: docs/target/
69102
remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/flink/flink-kubernetes-operator-docs-${{ env.flink_alias }}/
70103
remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }}

LICENSE.rsync-deployments

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2019-2022 Contention
4+
Copyright (c) 2019-2025 Burnett01
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

0 commit comments

Comments
 (0)