From 0208d65ef1c3ac4840366e191b0b62b40c1085bd Mon Sep 17 00:00:00 2001 From: Christopher Tauchen Date: Wed, 4 Feb 2026 13:41:35 +0000 Subject: [PATCH] Add script that updates Felix config for OSS This script updates the FelixConfiguration component with data from projectcalico/calico. Works for master and OSS 3.30+. DOCS-2833 --- scripts/felix-config-update.sh | 65 ++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 scripts/felix-config-update.sh diff --git a/scripts/felix-config-update.sh b/scripts/felix-config-update.sh new file mode 100755 index 0000000000..2aa50dcbce --- /dev/null +++ b/scripts/felix-config-update.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +set -eu -o pipefail + +# Load versions +VERSIONS=($(jq -r '.[]' calico_versions.json)) + +# Get updates from master branch + +update_felix_config() { + #This function prints the target and source locations and + #copies the source file to the target file. + + TMPFILE=$(mktemp /tmp/remote-url-output.XXXXXX) + trap 'rm -f "$TMPFILE"' EXIT + + printf "%s\n\n" "Begin processing $VERSION" + printf "%s\n" "Target path: $LOCAL_PATH" + printf "%s\n" "Source URL: $REMOTE_URL" + + curl -fsSL -o "$TMPFILE" "$REMOTE_URL" + + if jq -e . "$TMPFILE" >/dev/null 2>&1; then + echo "Success: $TMPFILE is valid JSON." + else + echo "Error: $TMPFILE contains invalid JSON." + exit 1 + fi + + curl -fsSL -o "$LOCAL_PATH" "$REMOTE_URL" + printf "%s\n\n\n" "Finished processing $VERSION." +} + +update_master () { + # This function updates the configuration from the master branch. + VERSION="master" + LOCAL_PATH="calico/_includes/components/FelixConfig/config-params.json" + REMOTE_URL="https://raw.githubusercontent.com/projectcalico/calico/refs/heads/master/felix/docs/config-params.json" + update_felix_config +} + +update_versions() { + # This function updates the configurations from the versioned branches. + for i in "${!VERSIONS[@]}"; do + VERSION="${VERSIONS[$i]}" + LOCAL_PATH="calico_versioned_docs/version-${VERSION}/_includes/components/FelixConfig/config-params.json" + REMOTE_URL="https://raw.githubusercontent.com/projectcalico/calico/refs/heads/release-v${VERSION}/felix/docs/config-params.json" + + # Exclude version 3.29, which came before direct-from-source method. + if [ "$VERSION" == "3.29" ]; then + printf "%s\n" "Skipping $VERSION: No action required." + continue + fi + + update_felix_config + + done +} + +update_master +update_versions + +printf "%s\n" "All updates are complete." + +exit 0