From 4b7038f1c16b419a3595d946a3d7e395ebfeaf04 Mon Sep 17 00:00:00 2001 From: Ferenc Csaky Date: Sat, 27 Sep 2025 20:30:03 +0200 Subject: [PATCH 1/5] [FLINK-38448] Replace `burnett01/rsync-deployments` with a custom `rsync-deploy` action in `docs.yaml` --- .github/actions/rsync-deploy/action.yml | 69 +++++++++++++++++++++++++ .github/workflows/docs.yaml | 6 +-- 2 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 .github/actions/rsync-deploy/action.yml diff --git a/.github/actions/rsync-deploy/action.yml b/.github/actions/rsync-deploy/action.yml new file mode 100644 index 000000000..95061884f --- /dev/null +++ b/.github/actions/rsync-deploy/action.yml @@ -0,0 +1,69 @@ +name: Rsync Deploy (local) +description: Upload a folder to a single remote destination via rsync over SSH. +inputs: + switches: + description: rsync switches + required: false + default: "--archive --compress" + path: + description: Local source directory (always copies its content) + required: true + remote_path: + description: Remote destination directory + required: true + remote_host: + description: SSH host + required: true + remote_port: + description: SSH port + required: false + default: "22" + remote_user: + description: SSH username + required: true + remote_key: + description: SSH private key (OpenSSH/PEM) + required: true + known_hosts: + description: Optional known_hosts entry for the remote host + required: false +runs: + using: composite + steps: + - name: Prepare SSH + shell: bash + run: | + set -euo pipefail + install -m 700 -d ~/.ssh + printf '%s\n' "${{ inputs.remote_key }}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + + SSH_PORT="${{ inputs.remote_port }}" + [[ -z "$SSH_PORT" ]] && SSH_PORT=22 + + if [[ -n "${{ inputs.known_hosts }}" ]]; then + printf '%s\n' "${{ inputs.known_hosts }}" > ~/.ssh/known_hosts + else + ssh-keyscan -p "$SSH_PORT" -H "${{ inputs.remote_host }}" >> ~/.ssh/known_hosts + fi + + - name: Rsync upload + shell: bash + run: | + set -euo pipefail + SSH_PORT="${{ inputs.remote_port }}" + [[ -z "$SSH_PORT" ]] && SSH_PORT=22 + SSH_CMD="ssh -p ${SSH_PORT} -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes" + + SRC="${{ inputs.path }}" + DEST="${{ inputs.remote_path }}" + USER="${{ inputs.remote_user }}" + HOST="${{ inputs.remote_host }}" + + # Ensure destination directory exists + ${SSH_CMD} "${USER}@${HOST}" "mkdir -p '${DEST%/}'" + + # Copy *contents* of SRC into DEST + rsync ${{ inputs.switches }} \ + -e "${SSH_CMD}" \ + "${SRC%/}/" "${USER}@${HOST}:'${DEST%/}/'" diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 18aee80b7..2df823904 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -51,9 +51,8 @@ jobs: run: | 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" - name: Upload documentation - uses: burnett01/rsync-deployments@7.1.0 + uses: ./.github/actions/rsync-deploy with: - switches: --archive --compress path: docs/target/ remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/flink/flink-kubernetes-operator-docs-${{ env.flink_branch }}/ remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }} @@ -62,9 +61,8 @@ jobs: remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }} - name: Upload documentation alias if: env.flink_alias != '' - uses: burnett01/rsync-deployments@7.1.0 + uses: ./.github/actions/rsync-deploy with: - switches: --archive --compress path: docs/target/ remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/flink/flink-kubernetes-operator-docs-${{ env.flink_alias }}/ remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }} From 56af482fc8a9038b98b976e8035ac226a45b9b09 Mon Sep 17 00:00:00 2001 From: Ferenc Csaky Date: Mon, 29 Sep 2025 12:23:31 +0200 Subject: [PATCH 2/5] add license and reference for rsync-deployments --- .../action.yml | 1 + .github/workflows/docs.yaml | 4 ++-- LICENSE.rsync-deployments | 22 +++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) rename .github/actions/{rsync-deploy => rsync-deployments}/action.yml (94%) create mode 100644 LICENSE.rsync-deployments diff --git a/.github/actions/rsync-deploy/action.yml b/.github/actions/rsync-deployments/action.yml similarity index 94% rename from .github/actions/rsync-deploy/action.yml rename to .github/actions/rsync-deployments/action.yml index 95061884f..e358f537c 100644 --- a/.github/actions/rsync-deploy/action.yml +++ b/.github/actions/rsync-deployments/action.yml @@ -1,3 +1,4 @@ +# This implementation took inspiration from https://github.com/Burnett01/rsync-deployments/blob/7.1.0/action.yml name: Rsync Deploy (local) description: Upload a folder to a single remote destination via rsync over SSH. inputs: diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 2df823904..bc0514b23 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -51,7 +51,7 @@ jobs: run: | 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" - name: Upload documentation - uses: ./.github/actions/rsync-deploy + uses: ./.github/actions/rsync-deployments with: path: docs/target/ remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/flink/flink-kubernetes-operator-docs-${{ env.flink_branch }}/ @@ -61,7 +61,7 @@ jobs: remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }} - name: Upload documentation alias if: env.flink_alias != '' - uses: ./.github/actions/rsync-deploy + uses: ./.github/actions/rsync-deployments with: path: docs/target/ remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/flink/flink-kubernetes-operator-docs-${{ env.flink_alias }}/ diff --git a/LICENSE.rsync-deployments b/LICENSE.rsync-deployments new file mode 100644 index 000000000..aa38d490b --- /dev/null +++ b/LICENSE.rsync-deployments @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2019-2022 Contention +Copyright (c) 2019-2025 Burnett01 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From c0161e1bcade951036f601efb4ac8c3d8e63436a Mon Sep 17 00:00:00 2001 From: Ferenc Csaky Date: Mon, 29 Sep 2025 12:28:30 +0200 Subject: [PATCH 3/5] simplify rsync deploy action --- .github/actions/rsync-deployments/action.yml | 46 ++++++-------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/.github/actions/rsync-deployments/action.yml b/.github/actions/rsync-deployments/action.yml index e358f537c..92fb8820e 100644 --- a/.github/actions/rsync-deployments/action.yml +++ b/.github/actions/rsync-deployments/action.yml @@ -7,7 +7,7 @@ inputs: required: false default: "--archive --compress" path: - description: Local source directory (always copies its content) + description: Local source directory (always copies its content only) required: true remote_path: description: Remote destination directory @@ -25,46 +25,28 @@ inputs: remote_key: description: SSH private key (OpenSSH/PEM) required: true - known_hosts: - description: Optional known_hosts entry for the remote host - required: false runs: using: composite steps: - - name: Prepare SSH + - name: rsync via ssh-agent shell: bash run: | set -euo pipefail - install -m 700 -d ~/.ssh - printf '%s\n' "${{ inputs.remote_key }}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - - SSH_PORT="${{ inputs.remote_port }}" - [[ -z "$SSH_PORT" ]] && SSH_PORT=22 - if [[ -n "${{ inputs.known_hosts }}" ]]; then - printf '%s\n' "${{ inputs.known_hosts }}" > ~/.ssh/known_hosts - else - ssh-keyscan -p "$SSH_PORT" -H "${{ inputs.remote_host }}" >> ~/.ssh/known_hosts - fi + # Start agent and load the key + eval "$(ssh-agent -s)" + ssh-add - <<< "${{ inputs.remote_key }}" - - name: Rsync upload - shell: bash - run: | - set -euo pipefail - SSH_PORT="${{ inputs.remote_port }}" - [[ -z "$SSH_PORT" ]] && SSH_PORT=22 - SSH_CMD="ssh -p ${SSH_PORT} -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes" + # SSH command with host key checking disabled (matches your reference impl) + RSH="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p ${{ inputs.remote_port }}" - SRC="${{ inputs.path }}" + # Resolve paths and DSN + LOCAL_PATH="${GITHUB_WORKSPACE}/${{ inputs.path }}" DEST="${{ inputs.remote_path }}" - USER="${{ inputs.remote_user }}" - HOST="${{ inputs.remote_host }}" + DSN="${{ inputs.remote_user }}@${{ inputs.remote_host }}" - # Ensure destination directory exists - ${SSH_CMD} "${USER}@${HOST}" "mkdir -p '${DEST%/}'" + # Deploy (copy *contents* of LOCAL_PATH into DEST) + rsync ${{ inputs.switches }} -e "$RSH" "${LOCAL_PATH%/}/" "$DSN:'${DEST%/}/'" - # Copy *contents* of SRC into DEST - rsync ${{ inputs.switches }} \ - -e "${SSH_CMD}" \ - "${SRC%/}/" "${USER}@${HOST}:'${DEST%/}/'" + # Cleanup identities from the agent + ssh-add -D || true From f9d252d91f8e4b2d08d9f332f75c9e5293035de9 Mon Sep 17 00:00:00 2001 From: Ferenc Csaky Date: Mon, 29 Sep 2025 12:48:58 +0200 Subject: [PATCH 4/5] Rework doc build to not use shell script and Docker img --- .github/workflows/docs.sh | 53 ------------------------------------- .github/workflows/docs.yaml | 39 +++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 55 deletions(-) delete mode 100755 .github/workflows/docs.sh diff --git a/.github/workflows/docs.sh b/.github/workflows/docs.sh deleted file mode 100755 index 079535dda..000000000 --- a/.github/workflows/docs.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bash -################################################################################ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -################################################################################ -set -e - -export JAVA_HOME=$JAVA_HOME_11_X64 - -# setup hugo -HUGO_REPO=https://github.com/gohugoio/hugo/releases/download/v0.104.0/hugo_extended_0.104.0_Linux-64bit.tar.gz -HUGO_ARTIFACT=hugo_extended_0.104.0_Linux-64bit.tar.gz -if ! curl --fail -OL $HUGO_REPO ; then - echo "Failed to download Hugo binary" - exit 1 -fi -tar -zxvf $HUGO_ARTIFACT -git submodule update --init --recursive -# generate docs into docs/target -./hugo -v --source docs --destination target -if [ $? -ne 0 ]; then - echo "Error building the docs" - exit 1 -fi - -# build Flink Operator; required for Javadoc step -#mvn clean install -B -DskipTests - -# build Java docs -mkdir -p docs/target/api -mvn javadoc:aggregate -B \ - -DadditionalJOption="-Xdoclint:none" \ - -DadditionalJOption="--allow-script-in-comments" \ - -DexcludePackageNames="org.apache.flink.examples" \ - -Dmaven.javadoc.failOnError=false \ - -Dcheckstyle.skip=true \ - -Dspotless.check.skip=true \ - -Denforcer.skip=true \ - -Dheader="

Back to Flink Website

" -mv target/site/apidocs docs/target/api/java diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index bc0514b23..20432bed8 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -23,6 +23,9 @@ jobs: build-documentation: if: github.repository == 'apache/flink-kubernetes-operator' runs-on: ubuntu-latest + env: + HUGO_REPO: https://github.com/gohugoio/hugo/releases/download/v0.104.0/hugo_extended_0.104.0_Linux-64bit.tar.gz + HUGO_ARTIFACT: hugo_extended_0.104.0_Linux-64bit.tar.gz strategy: max-parallel: 1 matrix: @@ -31,7 +34,12 @@ jobs: - release-1.13 - release-1.12 steps: - - uses: actions/checkout@v3 + - name: Set up Temurin JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + - uses: actions/checkout@v4 with: ref: ${{ matrix.branch }} - name: Set branch environment variable @@ -49,7 +57,34 @@ jobs: fi - name: Build documentation run: | - 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" + if ! curl --fail -OL "$HUGO_REPO" ; then + echo "Failed to download Hugo binary" + exit 1 + fi + tar -zxvf "$HUGO_ARTIFACT" + git submodule update --init --recursive + + # generate docs into docs/target + ./hugo -v --source docs --destination target + if [ $? -ne 0 ]; then + echo "Error building the docs" + exit 1 + fi + + # build Java docs + mkdir -p docs/target/api + + mvn javadoc:aggregate -B \ + -DadditionalJOption="-Xdoclint:none" \ + -DadditionalJOption="--allow-script-in-comments" \ + -DexcludePackageNames="org.apache.flink.examples" \ + -Dmaven.javadoc.failOnError=false \ + -Dcheckstyle.skip=true \ + -Dspotless.check.skip=true \ + -Denforcer.skip=true \ + -Dheader="

Back to Flink Website

" + + mv target/site/apidocs docs/target/api/java - name: Upload documentation uses: ./.github/actions/rsync-deployments with: From d5bf4e6eee08f1904bd1c14a953ac744faab7959 Mon Sep 17 00:00:00 2001 From: Ferenc Csaky Date: Mon, 29 Sep 2025 22:02:52 +0200 Subject: [PATCH 5/5] Fix rsync deploy --- .github/actions/rsync-deployments/action.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/actions/rsync-deployments/action.yml b/.github/actions/rsync-deployments/action.yml index 92fb8820e..e1f2c5e27 100644 --- a/.github/actions/rsync-deployments/action.yml +++ b/.github/actions/rsync-deployments/action.yml @@ -7,7 +7,7 @@ inputs: required: false default: "--archive --compress" path: - description: Local source directory (always copies its content only) + description: Local source directory required: true remote_path: description: Remote destination directory @@ -38,15 +38,14 @@ runs: ssh-add - <<< "${{ inputs.remote_key }}" # SSH command with host key checking disabled (matches your reference impl) - RSH="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p ${{ inputs.remote_port }}" + RSH="ssh -o StrictHostKeyChecking=no -p ${{ inputs.remote_port }}" # Resolve paths and DSN - LOCAL_PATH="${GITHUB_WORKSPACE}/${{ inputs.path }}" - DEST="${{ inputs.remote_path }}" + LOCAL_PATH="$GITHUB_WORKSPACE/${{ inputs.path }}" DSN="${{ inputs.remote_user }}@${{ inputs.remote_host }}" - # Deploy (copy *contents* of LOCAL_PATH into DEST) - rsync ${{ inputs.switches }} -e "$RSH" "${LOCAL_PATH%/}/" "$DSN:'${DEST%/}/'" + # Deploy + sh -c "rsync ${{ inputs.switches }} -e '$RSH' $LOCAL_PATH $DSN:${{ inputs.remote_path }}" # Cleanup identities from the agent ssh-add -D || true