-
Notifications
You must be signed in to change notification settings - Fork 135
DOCS-2833 Add script that updates Felix config for OSS #2510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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." | ||
| } | ||
ctauchen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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." | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got to that after having trouble with newlines. I think I'll leave it for now, but I take the point that it's cleaner with a plain echo statement. |
||
| continue | ||
| fi | ||
|
|
||
| update_felix_config | ||
|
|
||
| done | ||
| } | ||
|
|
||
| update_master | ||
| update_versions | ||
|
|
||
| printf "%s\n" "All updates are complete." | ||
|
|
||
| exit 0 | ||
Uh oh!
There was an error while loading. Please reload this page.