Making the synchronize scripts consistent (#3115)

* Making the scripts consistent

Signed-off-by: kunal-511 <yoyokvunal@gmail.com>

* Updated variable names, remove some echo and comments, fail hard policy applied

Signed-off-by: kunal-511 <yoyokvunal@gmail.com>

---------

Signed-off-by: kunal-511 <yoyokvunal@gmail.com>
This commit is contained in:
Kunal Dugar 2025-04-28 20:42:01 +05:30 committed by GitHub
parent 95a774c6f8
commit 7588f29d23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 544 additions and 722 deletions

97
scripts/lib.sh Normal file
View File

@ -0,0 +1,97 @@
#!/usr/bin/env bash
# Common functions for Kubeflow manifest synchronization scripts
setup_error_handling() {
set -euxo pipefail
IFS=$'\n\t'
}
# Check if the git repository has uncommitted changes
check_uncommitted_changes() {
if [ -n "$(git status --porcelain)" ]; then
echo "WARNING: You have uncommitted changes"
fi
}
# Create a new git branch if it doesn't exist
create_branch() {
local branch="$1"
check_uncommitted_changes
if [ $(git branch --list "$branch") ]; then
echo "WARNING: Branch $branch already exists."
fi
if ! git show-ref --verify --quiet refs/heads/$branch; then
git checkout -b "$branch"
else
echo "Branch $branch already exists."
fi
}
clone_and_checkout() {
local source_directory="$1"
local repository_url="$2"
local repository_directory="$3"
local commit="$4"
echo "Checking out in $source_directory to $commit..."
mkdir -p "$source_directory"
cd "$source_directory"
# Clone repository if it doesn't exist
if [ ! -d "$repository_directory/.git" ]; then
git clone "$repository_url" "$repository_directory"
fi
# Checkout to specific commit
cd "$source_directory/$repository_directory"
if ! git rev-parse --verify --quiet "$commit"; then
git checkout -b "$commit"
else
git checkout "$commit"
fi
check_uncommitted_changes
}
# Copy manifests from source to destination
copy_manifests() {
local source="$1"
local destination="$2"
echo "Copying manifests..."
if [ -d "$destination" ]; then
rm -r "$destination"
fi
cp "$source" "$destination" -r
echo "Successfully copied all manifests."
}
# Update README with new commit reference
update_readme() {
local manifests_directory="$1"
local source_text="$2"
local destination_text="$3"
sed -i "s|$source_text|$destination_text|g" "${manifests_directory}/README.md"
}
# Commit changes to git repository
commit_changes() {
local manifests_directory="$1"
local commit_message="$2"
local paths_to_add=("${@:3}")
cd "$manifests_directory"
for path in "${paths_to_add[@]}"; do
git add "$path"
done
git commit -s -m "$commit_message"
}

View File

@ -1,54 +1,38 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to create a PR to update the manifests # This script helps to create a PR to update the Istio CNI manifests
set -euxo pipefail
IFS=$'\n\t'
SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source "${SCRIPT_DIRECTORY}/lib.sh"
setup_error_handling
COMPONENT_NAME="istio-cni"
COMMIT="1.24.3" COMMIT="1.24.3"
CURRENT_VERSION="1-24" CURRENT_VERSION="1-24"
NEW_VERSION="1-24" # Must be a release NEW_VERSION="1-24" # Must be a release
SOURCE_DIRECTORY=${SOURCE_DIRECTORY:=/tmp/${COMPONENT_NAME}}
BRANCH_NAME=${BRANCH_NAME:=${COMPONENT_NAME}-${COMMIT?}}
SRC_DIR=${SRC_DIR:=/tmp/istio-cni} # Path configurations
BRANCH=${BRANCH:=istio-cni-${COMMIT?}} MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
ISTIO_OLD=$MANIFESTS_DIRECTORY/common/${COMPONENT_NAME}-${CURRENT_VERSION}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) ISTIO_NEW=$MANIFESTS_DIRECTORY/common/${COMPONENT_NAME}-${NEW_VERSION}
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
ISTIO_OLD=$MANIFESTS_DIR/common/istio-cni-${CURRENT_VERSION}
ISTIO_NEW=$MANIFESTS_DIR/common/istio-cni-${NEW_VERSION}
if [ ! -d "$ISTIO_NEW" ]; then if [ ! -d "$ISTIO_NEW" ]; then
cp -a $ISTIO_OLD $ISTIO_NEW cp -a $ISTIO_OLD $ISTIO_NEW
fi
echo "Creating branch: ${BRANCH}"
if [ -n "$(git status --porcelain)" ]; then
echo "WARNING: You have uncommitted changes"
fi
if [ `git branch --list $BRANCH` ]
then
echo "WARNING: Branch $BRANCH already exists."
fi fi
# Create the branch in the manifests repository create_branch "$BRANCH_NAME"
if ! git show-ref --verify --quiet refs/heads/$BRANCH; then
git checkout -b $BRANCH
else
echo "Branch $BRANCH already exists."
fi
echo "Checking out in $SRC_DIR to $COMMIT..."
# Checkout the istio repository echo "Checking out in $SOURCE_DIRECTORY to $COMMIT..."
if [ ! -d "$SRC_DIR" ]; then mkdir -p $SOURCE_DIRECTORY
mkdir -p $SRC_DIR cd $SOURCE_DIRECTORY
fi
cd $SRC_DIR
if [ ! -d "istio-${COMMIT}" ]; then if [ ! -d "istio-${COMMIT}" ]; then
wget "https://github.com/istio/istio/releases/download/${COMMIT}/istio-${COMMIT}-linux-amd64.tar.gz" wget "https://github.com/istio/istio/releases/download/${COMMIT}/istio-${COMMIT}-linux-amd64.tar.gz"
tar xvfz istio-${COMMIT}-linux-amd64.tar.gz tar xvfz istio-${COMMIT}-linux-amd64.tar.gz
fi fi
ISTIOCTL=$SRC_DIR/istio-${COMMIT}/bin/istioctl ISTIOCTL=$SOURCE_DIRECTORY/istio-${COMMIT}/bin/istioctl
cd $ISTIO_NEW cd $ISTIO_NEW
$ISTIOCTL manifest generate -f profile.yaml -f profile-overlay.yaml --set components.cni.enabled=true --set components.cni.namespace=kube-system > dump.yaml $ISTIOCTL manifest generate -f profile.yaml -f profile-overlay.yaml --set components.cni.enabled=true --set components.cni.namespace=kube-system > dump.yaml
@ -58,22 +42,20 @@ mv $ISTIO_NEW/install.yaml $ISTIO_NEW/istio-install/base
mv $ISTIO_NEW/cluster-local-gateway.yaml $ISTIO_NEW/cluster-local-gateway/base mv $ISTIO_NEW/cluster-local-gateway.yaml $ISTIO_NEW/cluster-local-gateway/base
rm dump.yaml rm dump.yaml
if [ -n "$(git status --porcelain)" ]; then check_uncommitted_changes
echo "WARNING: You have uncommitted changes"
SOURCE_TEXT="\[.*\](https://github.com/istio/istio/releases/tag/.*)"
DESTINATION_TEXT="\[$COMMIT\](https://github.com/istio/istio/releases/tag/$COMMIT)"
update_readme "$MANIFESTS_DIRECTORY" "$SOURCE_TEXT" "$DESTINATION_TEXT"
echo "Synchronizing directory names..."
find "$MANIFESTS_DIRECTORY" -type f -not -path '*/.git/*' -exec sed -i "s/istio-cni-${CURRENT_VERSION}/istio-cni-${NEW_VERSION}/g" {} +
cd "$MANIFESTS_DIRECTORY"
if [ "$CURRENT_VERSION" != "$NEW_VERSION" ]; then
rm -rf $ISTIO_OLD
fi fi
commit_changes "$MANIFESTS_DIRECTORY" "Upgrade istio-cni to v.${COMMIT}" "."
# Update README.md to synchronize with the upgraded Istio version echo "Synchronization completed successfully."
echo "Updating README..."
SRC_TXT="\[.*\](https://github.com/istio/istio/releases/tag/.*)"
DST_TXT="\[$COMMIT\](https://github.com/istio/istio/releases/tag/$COMMIT)"
sed -i "s|$SRC_TXT|$DST_TXT|g" "${MANIFESTS_DIR}"/README.md
#Synchronize the updated directory names with other files
find "$MANIFESTS_DIR" -type f -not -path '*/.git/*' -exec sed -i "s/istio-cni-${CURRENT_VERSION}/istio-cni-${NEW_VERSION}/g" {} +
echo "Committing the changes..."
cd "$MANIFESTS_DIR"
rm -rf $ISTIO_OLD
git add .
git commit -s -m "Upgrade istio-cni to v.${COMMIT}"

View File

@ -1,54 +1,39 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to create a PR to update the manifests # This script helps to create a PR to update the Istio manifests
set -euxo pipefail
IFS=$'\n\t'
# Source the common library functions
SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source "${SCRIPT_DIRECTORY}/lib.sh"
setup_error_handling
COMPONENT_NAME="istio"
COMMIT="1.24.3" COMMIT="1.24.3"
CURRENT_VERSION="1-24" CURRENT_VERSION="1-24"
NEW_VERSION="1-24" # Must be a release NEW_VERSION="1-24" # Must be a release
SOURCE_DIRECTORY=${SOURCE_DIRECTORY:=/tmp/${COMPONENT_NAME}}
BRANCH_NAME=${BRANCH_NAME:=${COMPONENT_NAME}-${COMMIT?}}
SRC_DIR=${SRC_DIR:=/tmp/istio} # Must be a release # Path configurations
BRANCH=${BRANCH:=istio-${COMMIT?}} MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
ISTIO_OLD=$MANIFESTS_DIRECTORY/common/${COMPONENT_NAME}-${CURRENT_VERSION}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) ISTIO_NEW=$MANIFESTS_DIRECTORY/common/${COMPONENT_NAME}-${NEW_VERSION}
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
ISTIO_OLD=$MANIFESTS_DIR/common/istio-${CURRENT_VERSION}
ISTIO_NEW=$MANIFESTS_DIR/common/istio-${NEW_VERSION}
if [ ! -d "$ISTIO_NEW" ]; then if [ ! -d "$ISTIO_NEW" ]; then
cp -a $ISTIO_OLD $ISTIO_NEW cp -a $ISTIO_OLD $ISTIO_NEW
fi
echo "Creating branch: ${BRANCH}"
if [ -n "$(git status --porcelain)" ]; then
echo "WARNING: You have uncommitted changes"
fi
if [ `git branch --list $BRANCH` ]
then
echo "WARNING: Branch $BRANCH already exists."
fi fi
# Create the branch in the manifests repository create_branch "$BRANCH_NAME"
if ! git show-ref --verify --quiet refs/heads/$BRANCH; then
git checkout -b $BRANCH
else
echo "Branch $BRANCH already exists."
fi
echo "Checking out in $SRC_DIR to $COMMIT..."
# Checkout the istio repository echo "Checking out in $SOURCE_DIRECTORY to $COMMIT..."
if [ ! -d "$SRC_DIR" ]; then mkdir -p $SOURCE_DIRECTORY
mkdir -p $SRC_DIR cd $SOURCE_DIRECTORY
fi
cd $SRC_DIR
if [ ! -d "istio-${COMMIT}" ]; then if [ ! -d "istio-${COMMIT}" ]; then
wget "https://github.com/istio/istio/releases/download/${COMMIT}/istio-${COMMIT}-linux-amd64.tar.gz" wget "https://github.com/istio/istio/releases/download/${COMMIT}/istio-${COMMIT}-linux-amd64.tar.gz"
tar xvfz istio-${COMMIT}-linux-amd64.tar.gz tar xvfz istio-${COMMIT}-linux-amd64.tar.gz
fi fi
ISTIOCTL=$SRC_DIR/istio-${COMMIT}/bin/istioctl ISTIOCTL=$SOURCE_DIRECTORY/istio-${COMMIT}/bin/istioctl
cd $ISTIO_NEW cd $ISTIO_NEW
$ISTIOCTL manifest generate -f profile.yaml -f profile-overlay.yaml > dump.yaml $ISTIOCTL manifest generate -f profile.yaml -f profile-overlay.yaml > dump.yaml
@ -58,22 +43,19 @@ mv $ISTIO_NEW/install.yaml $ISTIO_NEW/istio-install/base
mv $ISTIO_NEW/cluster-local-gateway.yaml $ISTIO_NEW/cluster-local-gateway/base mv $ISTIO_NEW/cluster-local-gateway.yaml $ISTIO_NEW/cluster-local-gateway/base
rm dump.yaml rm dump.yaml
if [ -n "$(git status --porcelain)" ]; then check_uncommitted_changes
echo "WARNING: You have uncommitted changes"
SOURCE_TEXT="\[.*\](https://github.com/istio/istio/releases/tag/.*)"
DESTINATION_TEXT="\[$COMMIT\](https://github.com/istio/istio/releases/tag/$COMMIT)"
update_readme "$MANIFESTS_DIRECTORY" "$SOURCE_TEXT" "$DESTINATION_TEXT"
find "$MANIFESTS_DIRECTORY" -type f -not -path '*/.git/*' -exec sed -i "s/istio-${CURRENT_VERSION}/istio-${NEW_VERSION}/g" {} +
cd "$MANIFESTS_DIRECTORY"
if [ "$CURRENT_VERSION" != "$NEW_VERSION" ]; then
rm -rf $ISTIO_OLD
fi fi
commit_changes "$MANIFESTS_DIRECTORY" "Upgrade istio to v.${COMMIT}" "."
# Update README.md to synchronize with the upgraded Istio version echo "Synchronization completed successfully."
echo "Updating README..."
SRC_TXT="\[.*\](https://github.com/istio/istio/releases/tag/.*)"
DST_TXT="\[$COMMIT\](https://github.com/istio/istio/releases/tag/$COMMIT)"
sed -i "s|$SRC_TXT|$DST_TXT|g" "${MANIFESTS_DIR}"/README.md
#Synchronize the updated directory names with other files
find "$MANIFESTS_DIR" -type f -not -path '*/.git/*' -exec sed -i "s/istio-${CURRENT_VERSION}/istio-${NEW_VERSION}/g" {} +
echo "Committing the changes..."
cd "$MANIFESTS_DIR"
rm -rf $ISTIO_OLD
git add .
git commit -s -m "Upgrade istio to v.${COMMIT}"

View File

@ -1,69 +1,38 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to create a PR to update the manifests # This script helps to create a PR to update the Katib manifests
set -euxo pipefail
IFS=$'\n\t'
COMMIT="v0.18.0" # You can use tags as well SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SRC_DIR=${SRC_DIR:=/tmp/kubeflow-katib} source "${SCRIPT_DIRECTORY}/lib.sh"
BRANCH=${BRANCH:=synchronize-kubeflow-katib-manifests-${COMMIT?}}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) setup_error_handling
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
echo "Creating branch: ${BRANCH}" COMPONENT_NAME="katib"
REPOSITORY_NAME="kubeflow/katib"
REPOSITORY_URL="https://github.com/kubeflow/katib.git"
COMMIT="v0.18.0"
REPOSITORY_DIRECTORY="katib"
SOURCE_DIRECTORY=${SOURCE_DIRECTORY:=/tmp/kubeflow-${COMPONENT_NAME}}
BRANCH_NAME=${BRANCH_NAME:=synchronize-${COMPONENT_NAME}-manifests-${COMMIT?}}
if [ -n "$(git status --porcelain)" ]; then # Path configurations
echo "WARNING: You have uncommitted changes" MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
fi SOURCE_MANIFESTS_PATH="manifests/v1beta1"
if [ `git branch --list $BRANCH` ] DESTINATION_MANIFESTS_PATH="apps/${COMPONENT_NAME}/upstream"
then
echo "WARNING: Branch $BRANCH already exists."
fi
# Create the branch in the manifests repository # README update patterns
if ! git show-ref --verify --quiet refs/heads/$BRANCH; then SOURCE_TEXT="\[.*\](https://github.com/${REPOSITORY_NAME}/tree/.*/manifests/v1beta1)"
git checkout -b $BRANCH DESTINATION_TEXT="\[${COMMIT}\](https://github.com/${REPOSITORY_NAME}/tree/${COMMIT}/manifests/v1beta1)"
else
echo "Branch $BRANCH already exists."
fi
echo "Checking out in $SRC_DIR to $COMMIT..."
# Checkout the KFP repositorysitory create_branch "$BRANCH_NAME"
mkdir -p $SRC_DIR
cd $SRC_DIR
if [ ! -d "katib/.git" ]; then
git clone https://github.com/kubeflow/katib.git
fi
cd $SRC_DIR/katib
if ! git rev-parse --verify --quiet $COMMIT; then
git checkout -b $COMMIT
else
git checkout $COMMIT
fi
clone_and_checkout "$SOURCE_DIRECTORY" "$REPOSITORY_URL" "$REPOSITORY_DIRECTORY" "$COMMIT"
if [ -n "$(git status --porcelain)" ]; then copy_manifests "${SOURCE_DIRECTORY}/${REPOSITORY_DIRECTORY}/${SOURCE_MANIFESTS_PATH}" "${MANIFESTS_DIRECTORY}/${DESTINATION_MANIFESTS_PATH}"
echo "WARNING: You have uncommitted changes"
fi
echo "Copying katib manifests..." update_readme "$MANIFESTS_DIRECTORY" "$SOURCE_TEXT" "$DESTINATION_TEXT"
DST_DIR=$MANIFESTS_DIR/apps/katib/upstream
if [ -d "$DST_DIR" ]; then
rm -r "$DST_DIR"
fi
cp $SRC_DIR/katib/manifests/v1beta1 $DST_DIR -r
commit_changes "$MANIFESTS_DIRECTORY" "Update ${REPOSITORY_NAME} manifests from ${COMMIT}" \
"apps" \
"README.md"
echo "Successfully copied all manifests." echo "Synchronization completed successfully."
echo "Updating README..."
SRC_TXT="\[.*\](https://github.com/kubeflow/katib/tree/.*/manifests/v1beta1)"
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/katib/tree/$COMMIT/manifests/v1beta1)"
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
echo "Committing the changes..."
cd $MANIFESTS_DIR
git add apps
git add README.md
git commit -s -m "Update kubeflow/katib manifests from ${COMMIT}"

View File

@ -1,133 +1,110 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to create a PR to update the manifests # This script helps to create a PR to update the Knative manifests
set -euxo pipefail
IFS=$'\n\t'
SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source "${SCRIPT_DIRECTORY}/lib.sh"
setup_error_handling
COMPONENT_NAME="knative"
KN_SERVING_RELEASE="v1.16.2" # Must be a release KN_SERVING_RELEASE="v1.16.2" # Must be a release
KN_EXTENSION_RELEASE="v1.16.0" # Must be a release KN_EXTENSION_RELEASE="v1.16.0" # Must be a release
KN_EVENTING_RELEASE="v1.16.4" # Must be a release KN_EVENTING_RELEASE="v1.16.4" # Must be a release
BRANCH=${BRANCH:=synchronize-knative-manifests-${KN_SERVING_RELEASE?}} BRANCH_NAME=${BRANCH_NAME:=synchronize-${COMPONENT_NAME}-manifests-${KN_SERVING_RELEASE?}}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Path configurations
MANIFESTS_DIR=$(dirname $SCRIPT_DIR) MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
DESTINATION_DIRECTORY=$MANIFESTS_DIRECTORY/common/${COMPONENT_NAME}
# replace source regex ($1) with target regex ($2) create_branch "$BRANCH_NAME"
# in file ($3)
replace_in_file() {
SRC_TXT=$1
DST_TXT=$2
sed -i "s|$SRC_TXT|$DST_TXT|g" $3
}
echo "Creating branch: ${BRANCH}" check_uncommitted_changes
if [ -n "$(git status --porcelain)" ]; then # Clean up existing files (keep README and OWNERS)
echo "WARNING: You have uncommitted changes" if [ -d "$DESTINATION_DIRECTORY" ]; then
fi rm -r "$DESTINATION_DIRECTORY/knative-serving/base/upstream"
if [ `git branch --list $BRANCH` ] rm "$DESTINATION_DIRECTORY/knative-serving-post-install-jobs/base/serving-post-install-jobs.yaml"
then rm -r "$DESTINATION_DIRECTORY/knative-eventing/base/upstream"
echo "WARNING: Branch $BRANCH already exists." rm "$DESTINATION_DIRECTORY/knative-eventing-post-install-jobs/base/eventing-post-install.yaml"
fi fi
# Create the branch in the manifests repository # Create required directories
if ! git show-ref --verify --quiet refs/heads/$BRANCH; then mkdir -p "$DESTINATION_DIRECTORY/knative-serving/base/upstream"
git checkout -b $BRANCH mkdir -p "$DESTINATION_DIRECTORY/knative-serving-post-install-jobs/base"
else mkdir -p "$DESTINATION_DIRECTORY/knative-eventing/base/upstream"
echo "Branch $BRANCH already exists." mkdir -p "$DESTINATION_DIRECTORY/knative-eventing-post-install-jobs/base"
fi
if [ -n "$(git status --porcelain)" ]; then
echo "WARNING: You have uncommitted changes"
fi
DST_DIR=$MANIFESTS_DIR/common/knative
if [ -d "$DST_DIR" ]; then
# keep README and OWNERS file
rm -r "$DST_DIR/knative-serving/base/upstream"
rm "$DST_DIR/knative-serving-post-install-jobs/base/serving-post-install-jobs.yaml"
rm -r "$DST_DIR/knative-eventing/base/upstream"
rm "$DST_DIR/knative-eventing-post-install-jobs/base/eventing-post-install.yaml"
fi
mkdir -p "$DST_DIR/knative-serving/base/upstream"
mkdir -p "$DST_DIR/knative-serving-post-install-jobs/base"
mkdir -p "$DST_DIR/knative-eventing/base/upstream"
mkdir -p "$DST_DIR/knative-eventing-post-install-jobs/base"
echo "Downloading knative-serving manifests..." echo "Downloading knative-serving manifests..."
# No need to install serving-crds. wget -O $DESTINATION_DIRECTORY/knative-serving/base/upstream/serving-core.yaml "https://github.com/knative/serving/releases/download/knative-$KN_SERVING_RELEASE/serving-core.yaml"
# See: https://github.com/knative/serving/issues/9945 wget -O $DESTINATION_DIRECTORY/knative-serving/base/upstream/net-istio.yaml "https://github.com/knative-extensions/net-istio/releases/download/knative-$KN_EXTENSION_RELEASE/net-istio.yaml"
wget -O $DST_DIR/knative-serving/base/upstream/serving-core.yaml "https://github.com/knative/serving/releases/download/knative-$KN_SERVING_RELEASE/serving-core.yaml" wget -O $DESTINATION_DIRECTORY/knative-serving-post-install-jobs/base/serving-post-install-jobs.yaml "https://github.com/knative/serving/releases/download/knative-$KN_SERVING_RELEASE/serving-post-install-jobs.yaml"
wget -O $DST_DIR/knative-serving/base/upstream/net-istio.yaml "https://github.com/knative-extensions/net-istio/releases/download/knative-$KN_EXTENSION_RELEASE/net-istio.yaml"
wget -O $DST_DIR/knative-serving-post-install-jobs/base/serving-post-install-jobs.yaml "https://github.com/knative/serving/releases/download/knative-$KN_SERVING_RELEASE/serving-post-install-jobs.yaml"
yq eval -i '... comments=""' $DST_DIR/knative-serving/base/upstream/serving-core.yaml yq eval -i '... comments=""' $DESTINATION_DIRECTORY/knative-serving/base/upstream/serving-core.yaml
yq eval -i '... comments=""' $DST_DIR/knative-serving/base/upstream/net-istio.yaml yq eval -i '... comments=""' $DESTINATION_DIRECTORY/knative-serving/base/upstream/net-istio.yaml
yq eval -i '... comments=""' $DST_DIR/knative-serving-post-install-jobs/base/serving-post-install-jobs.yaml yq eval -i '... comments=""' $DESTINATION_DIRECTORY/knative-serving-post-install-jobs/base/serving-post-install-jobs.yaml
yq eval -i 'explode(.)' $DST_DIR/knative-serving/base/upstream/serving-core.yaml yq eval -i 'explode(.)' $DESTINATION_DIRECTORY/knative-serving/base/upstream/serving-core.yaml
yq eval -i 'explode(.)' $DST_DIR/knative-serving/base/upstream/net-istio.yaml yq eval -i 'explode(.)' $DESTINATION_DIRECTORY/knative-serving/base/upstream/net-istio.yaml
yq eval -i 'explode(.)' $DST_DIR/knative-serving-post-install-jobs/base/serving-post-install-jobs.yaml yq eval -i 'explode(.)' $DESTINATION_DIRECTORY/knative-serving-post-install-jobs/base/serving-post-install-jobs.yaml
# We are not using the '|=' operator because it generates an empty object yq eval -i 'select(.kind == "Job" and .metadata.generateName == "storage-version-migration-serving-") | .metadata.name = "storage-version-migration-serving"' $DESTINATION_DIRECTORY/knative-serving-post-install-jobs/base/serving-post-install-jobs.yaml
# ({}) which crashes kustomize.
yq eval -i 'select(.kind == "Job" and .metadata.generateName == "storage-version-migration-serving-") | .metadata.name = "storage-version-migration-serving"' $DST_DIR/knative-serving-post-install-jobs/base/serving-post-install-jobs.yaml
echo "Downloading knative-eventing manifests..." echo "Downloading knative-eventing manifests..."
wget -O $DESTINATION_DIRECTORY/knative-eventing/base/upstream/eventing-core.yaml "https://github.com/knative/eventing/releases/download/knative-$KN_EVENTING_RELEASE/eventing-core.yaml"
wget -O $DESTINATION_DIRECTORY/knative-eventing/base/upstream/in-memory-channel.yaml "https://github.com/knative/eventing/releases/download/knative-$KN_EVENTING_RELEASE/in-memory-channel.yaml"
wget -O $DESTINATION_DIRECTORY/knative-eventing/base/upstream/mt-channel-broker.yaml "https://github.com/knative/eventing/releases/download/knative-$KN_EVENTING_RELEASE/mt-channel-broker.yaml"
wget -O $DESTINATION_DIRECTORY/knative-eventing-post-install-jobs/base/eventing-post-install.yaml "https://github.com/knative/eventing/releases/download/knative-$KN_EVENTING_RELEASE/eventing-post-install.yaml"
wget -O $DST_DIR/knative-eventing/base/upstream/eventing-core.yaml "https://github.com/knative/eventing/releases/download/knative-$KN_EVENTING_RELEASE/eventing-core.yaml" yq eval -i '... comments=""' $DESTINATION_DIRECTORY/knative-eventing/base/upstream/eventing-core.yaml
wget -O $DST_DIR/knative-eventing/base/upstream/in-memory-channel.yaml "https://github.com/knative/eventing/releases/download/knative-$KN_EVENTING_RELEASE/in-memory-channel.yaml" yq eval -i '... comments=""' $DESTINATION_DIRECTORY/knative-eventing/base/upstream/in-memory-channel.yaml
wget -O $DST_DIR/knative-eventing/base/upstream/mt-channel-broker.yaml "https://github.com/knative/eventing/releases/download/knative-$KN_EVENTING_RELEASE/mt-channel-broker.yaml" yq eval -i '... comments=""' $DESTINATION_DIRECTORY/knative-eventing/base/upstream/mt-channel-broker.yaml
wget -O $DST_DIR/knative-eventing-post-install-jobs/base/eventing-post-install.yaml "https://github.com/knative/eventing/releases/download/knative-$KN_EVENTING_RELEASE/eventing-post-install.yaml" yq eval -i '... comments=""' $DESTINATION_DIRECTORY/knative-eventing-post-install-jobs/base/eventing-post-install.yaml
yq eval -i '... comments=""' $DST_DIR/knative-eventing/base/upstream/eventing-core.yaml yq eval -i 'explode(.)' $DESTINATION_DIRECTORY/knative-eventing/base/upstream/eventing-core.yaml
yq eval -i '... comments=""' $DST_DIR/knative-eventing/base/upstream/in-memory-channel.yaml yq eval -i 'explode(.)' $DESTINATION_DIRECTORY/knative-eventing/base/upstream/in-memory-channel.yaml
yq eval -i '... comments=""' $DST_DIR/knative-eventing/base/upstream/mt-channel-broker.yaml yq eval -i 'explode(.)' $DESTINATION_DIRECTORY/knative-eventing/base/upstream/mt-channel-broker.yaml
yq eval -i '... comments=""' $DST_DIR/knative-eventing-post-install-jobs/base/eventing-post-install.yaml yq eval -i 'explode(.)' $DESTINATION_DIRECTORY/knative-eventing-post-install-jobs/base/eventing-post-install.yaml
yq eval -i 'explode(.)' $DST_DIR/knative-eventing/base/upstream/eventing-core.yaml yq eval -i 'select(.kind == "Job" and .metadata.generateName == "storage-version-migration-eventing-") | .metadata.name = "storage-version-migration-eventing"' $DESTINATION_DIRECTORY/knative-eventing-post-install-jobs/base/eventing-post-install.yaml
yq eval -i 'explode(.)' $DST_DIR/knative-eventing/base/upstream/in-memory-channel.yaml
yq eval -i 'explode(.)' $DST_DIR/knative-eventing/base/upstream/mt-channel-broker.yaml
yq eval -i 'explode(.)' $DST_DIR/knative-eventing-post-install-jobs/base/eventing-post-install.yaml
# We are not using the '|=' operator because it generates an empty object yq eval -i 'select((.kind == "ConfigMap" and .metadata.name == "config-observability") | not)' $DESTINATION_DIRECTORY/knative-eventing/base/upstream/in-memory-channel.yaml
# ({}) which crashes kustomize. yq eval -i 'select((.kind == "ConfigMap" and .metadata.name == "config-tracing") | not)' $DESTINATION_DIRECTORY/knative-eventing/base/upstream/in-memory-channel.yaml
yq eval -i 'select(.kind == "Job" and .metadata.generateName == "storage-version-migration-eventing-") | .metadata.name = "storage-version-migration-eventing"' $DST_DIR/knative-eventing-post-install-jobs/base/eventing-post-install.yaml
yq eval -i 'select((.kind == "ConfigMap" and .metadata.name == "config-observability") | not)' $DST_DIR/knative-eventing/base/upstream/in-memory-channel.yaml # Helper function to replace text in files
yq eval -i 'select((.kind == "ConfigMap" and .metadata.name == "config-tracing") | not)' $DST_DIR/knative-eventing/base/upstream/in-memory-channel.yaml replace_in_file() {
local SOURCE_TEXT=$1
echo "Successfully copied all manifests." local DESTINATION_TEXT=$2
local FILE=$3
echo "Updating README..." sed -i "s|$SOURCE_TEXT|$DESTINATION_TEXT|g" $FILE
}
replace_in_file \ replace_in_file \
"\[.*\](https://github.com/knative/serving/releases/tag/knative-.*) <" \ "\[.*\](https://github.com/knative/serving/releases/tag/knative-.*) <" \
"\[$KN_SERVING_RELEASE\](https://github.com/knative/serving/releases/tag/knative-$KN_SERVING_RELEASE) <" \ "\[$KN_SERVING_RELEASE\](https://github.com/knative/serving/releases/tag/knative-$KN_SERVING_RELEASE) <" \
${MANIFESTS_DIR}/README.md ${MANIFESTS_DIRECTORY}/README.md
replace_in_file \ replace_in_file \
"> \[.*\](https://github.com/knative/eventing/releases/tag/knative-.*)" \ "> \[.*\](https://github.com/knative/eventing/releases/tag/knative-.*)" \
"> \[$KN_EVENTING_RELEASE\](https://github.com/knative/eventing/releases/tag/knative-$KN_EVENTING_RELEASE)" \ "> \[$KN_EVENTING_RELEASE\](https://github.com/knative/eventing/releases/tag/knative-$KN_EVENTING_RELEASE)" \
${MANIFESTS_DIR}/README.md ${MANIFESTS_DIRECTORY}/README.md
replace_in_file \ replace_in_file \
"\[Knative serving (v.*)\](https://github.com/knative/serving/releases/tag/knative-v.*)" \ "\[Knative serving (v.*)\](https://github.com/knative/serving/releases/tag/knative-v.*)" \
"\[Knative serving ($KN_SERVING_RELEASE)\](https://github.com/knative/serving/releases/tag/knative-$KN_SERVING_RELEASE)" \ "\[Knative serving ($KN_SERVING_RELEASE)\](https://github.com/knative/serving/releases/tag/knative-$KN_SERVING_RELEASE)" \
$DST_DIR/README.md $DESTINATION_DIRECTORY/README.md
replace_in_file \ replace_in_file \
"\[Knative ingress controller for Istio (v.*)\](https://github.com/knative-extensions/net-istio/releases/tag/knative-v.*)" \ "\[Knative ingress controller for Istio (v.*)\](https://github.com/knative-extensions/net-istio/releases/tag/knative-v.*)" \
"\[Knative ingress controller for Istio ($KN_EXTENSION_RELEASE)\](https://github.com/knative-extensions/net-istio/releases/tag/knative-$KN_EXTENSION_RELEASE)" \ "\[Knative ingress controller for Istio ($KN_EXTENSION_RELEASE)\](https://github.com/knative-extensions/net-istio/releases/tag/knative-$KN_EXTENSION_RELEASE)" \
$DST_DIR/README.md $DESTINATION_DIRECTORY/README.md
replace_in_file \ replace_in_file \
"The manifests for Knative Eventing are based off the \[v.* release\](https://github.com/knative/eventing/releases/tag/knative-v.*)" \ "The manifests for Knative Eventing are based off the \[v.* release\](https://github.com/knative/eventing/releases/tag/knative-v.*)" \
"The manifests for Knative Eventing are based off the \[$KN_EVENTING_RELEASE release\](https://github.com/knative/eventing/releases/tag/knative-$KN_EVENTING_RELEASE)" \ "The manifests for Knative Eventing are based off the \[$KN_EVENTING_RELEASE release\](https://github.com/knative/eventing/releases/tag/knative-$KN_EVENTING_RELEASE)" \
$DST_DIR/README.md $DESTINATION_DIRECTORY/README.md
echo "Committing the changes..." commit_changes "$MANIFESTS_DIRECTORY" "Update common/knative manifests from ${KN_SERVING_RELEASE}/${KN_EVENTING_RELEASE}" \
cd $MANIFESTS_DIR "$DESTINATION_DIRECTORY" \
git add $DST_DIR "README.md"
git add README.md
git commit -s -m "Update common/knative manifests from ${KN_SERVING_RELEASE}/${KN_EVENTING_RELEASE}" echo "Synchronization completed successfully."

View File

@ -1,71 +1,46 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to create a PR to update the manifests # This script helps to create a PR to update the KServe manifests
set -euxo pipefail
IFS=$'\n\t'
SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source "${SCRIPT_DIRECTORY}/lib.sh"
setup_error_handling
COMPONENT_NAME="kserve"
REPOSITORY_NAME="kserve/kserve"
REPOSITORY_URL="https://github.com/kserve/kserve.git"
KSERVE_VERSION="v0.15.0" KSERVE_VERSION="v0.15.0"
COMMIT="v0.15.0" # You can use tags as well COMMIT="v0.15.0"
SRC_DIR=${SRC_DIR:=/tmp/kserve} REPOSITORY_DIRECTORY="kserve"
BRANCH=${BRANCH:=synchronize-kserve-manifests-${COMMIT?}} SOURCE_DIRECTORY=${SOURCE_DIRECTORY:=/tmp/${COMPONENT_NAME}}
BRANCH_NAME=${BRANCH_NAME:=synchronize-${COMPONENT_NAME}-manifests-${COMMIT?}}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Path configurations
MANIFESTS_DIR=$(dirname $SCRIPT_DIR) MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
SOURCE_MANIFESTS_PATH="install/${KSERVE_VERSION}"
DESTINATION_MANIFESTS_PATH="apps/${COMPONENT_NAME}/${COMPONENT_NAME}"
echo "Creating branch: ${BRANCH}" # README update patterns
SOURCE_TEXT="\[.*\](https://github.com/${REPOSITORY_NAME}/releases/tag/.*)"
DESTINATION_TEXT="\[${COMMIT}\](https://github.com/${REPOSITORY_NAME}/releases/tag/${COMMIT}/install/${KSERVE_VERSION})"
if [ -n "$(git status --porcelain)" ]; then create_branch "$BRANCH_NAME"
echo "WARNING: You have uncommitted changes"
fi
if [ `git branch --list $BRANCH` ]
then
echo "WARNING: Branch $BRANCH already exists."
fi
# Create the branch in the manifests repository clone_and_checkout "$SOURCE_DIRECTORY" "$REPOSITORY_URL" "$REPOSITORY_DIRECTORY" "$COMMIT"
if ! git show-ref --verify --quiet refs/heads/$BRANCH; then
git checkout -b $BRANCH
else
echo "Branch $BRANCH already exists."
fi
echo "Checking out in $SRC_DIR to $COMMIT..."
# Checkout the kserve repository
mkdir -p $SRC_DIR
cd $SRC_DIR
if [ ! -d "kserve/.git" ]; then
git clone https://github.com/kserve/kserve.git
fi
cd $SRC_DIR/kserve
if ! git rev-parse --verify --quiet $COMMIT; then
git checkout -b $COMMIT
else
git checkout $COMMIT
fi
if [ -n "$(git status --porcelain)" ]; then
echo "WARNING: You have uncommitted changes"
fi
echo "Copying kserve manifests..." echo "Copying kserve manifests..."
DST_DIR=$MANIFESTS_DIR/apps/kserve/kserve DESTINATION_DIRECTORY=$MANIFESTS_DIRECTORY/$DESTINATION_MANIFESTS_PATH
if [ -d "$DST_DIR" ]; then if [ -d "$DESTINATION_DIRECTORY" ]; then
rm -rf "$DST_DIR"/kserve* rm -rf "$DESTINATION_DIRECTORY"/kserve*
fi fi
cp $SRC_DIR/kserve/install/"$KSERVE_VERSION"/* $DST_DIR -r cp $SOURCE_DIRECTORY/$REPOSITORY_DIRECTORY/$SOURCE_MANIFESTS_PATH/* $DESTINATION_DIRECTORY -r
echo "Successfully copied all manifests." update_readme "$MANIFESTS_DIRECTORY" "$SOURCE_TEXT" "$DESTINATION_TEXT"
echo "Updating README..." commit_changes "$MANIFESTS_DIRECTORY" "Update ${REPOSITORY_NAME} manifests from ${KSERVE_VERSION}" \
SRC_TXT="\[.*\](https://github.com/kserve/kserve/releases/tag/.*)" "apps/${COMPONENT_NAME}" \
DST_TXT="\[$COMMIT\](https://github.com/kserve/kserve/releases/tag/$COMMIT/install/$KSERVE_VERSION)" "README.md" \
"scripts"
sed -i "s|$SRC_TXT|$DST_TXT|g" "${MANIFESTS_DIR}"/README.md echo "Synchronization completed successfully."
echo "Committing the changes..."
cd "$MANIFESTS_DIR"
git add apps/kserve
git add README.md
git add scripts
git commit -s -m "Update kserve manifests from ${KSERVE_VERSION}" -m "Update kserve/kserve manifests from ${COMMIT}"

View File

@ -1,69 +1,39 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to create a PR to update the manifests # This script helps to create a PR to update the KServe Models Web App manifests
set -euxo pipefail
IFS=$'\n\t'
COMMIT="v0.14.0" # You can use tags as well SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SRC_DIR=${SRC_DIR:=/tmp/kserve-models-web-app} source "${SCRIPT_DIRECTORY}/lib.sh"
BRANCH=${BRANCH:=synchronize-kserve-web-application-manifests-${COMMIT?}}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) setup_error_handling
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
echo "Creating branch: ${BRANCH}" COMPONENT_NAME="models-web-app"
REPOSITORY_NAME="kserve/models-web-app"
REPOSITORY_URL="https://github.com/kserve/models-web-app.git"
COMMIT="v0.14.0"
REPOSITORY_DIRECTORY="models-web-app"
SOURCE_DIRECTORY=${SOURCE_DIRECTORY:=/tmp/kserve-${COMPONENT_NAME}}
BRANCH_NAME=${BRANCH_NAME:=synchronize-kserve-${COMPONENT_NAME}-manifests-${COMMIT?}}
if [ -n "$(git status --porcelain)" ]; then # Path configurations
echo "WARNING: You have uncommitted changes" MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
fi SOURCE_MANIFESTS_PATH="config"
DESTINATION_MANIFESTS_PATH="apps/kserve/${COMPONENT_NAME}"
if [ "$(git branch --list $BRANCH)" ] # README update patterns
then SOURCE_TEXT="\[.*\](https://github.com/${REPOSITORY_NAME}/tree/.*)"
echo "WARNING: Branch $BRANCH already exists." DESTINATION_TEXT="\[${COMMIT}\](https://github.com/${REPOSITORY_NAME}/tree/${COMMIT}/${SOURCE_MANIFESTS_PATH})"
fi
# Create the branch in the manifests repository create_branch "$BRANCH_NAME"
if ! git show-ref --verify --quiet refs/heads/$BRANCH; then
git checkout -b $BRANCH
else
echo "Branch $BRANCH already exists."
fi
echo "Checking out in $SRC_DIR to $COMMIT..."
# Checkout the Kserve Models Web Application repository clone_and_checkout "$SOURCE_DIRECTORY" "$REPOSITORY_URL" "$REPOSITORY_DIRECTORY" "$COMMIT"
mkdir -p $SRC_DIR
cd $SRC_DIR || exit
if [ ! -d "models-web-app/.git" ]; then
git clone https://github.com/kserve/models-web-app.git
fi
cd $SRC_DIR/models-web-app || exit
if ! git rev-parse --verify --quiet $COMMIT; then
git checkout -b $COMMIT
else
git checkout $COMMIT
fi
if [ -n "$(git status --porcelain)" ]; then
echo "WARNING: You have uncommitted changes"
fi
echo "Copying manifests" echo "Copying manifests"
DST_DIR=$MANIFESTS_DIR/apps/kserve/models-web-app copy_manifests "${SOURCE_DIRECTORY}/${REPOSITORY_DIRECTORY}/${SOURCE_MANIFESTS_PATH}" "${MANIFESTS_DIRECTORY}/${DESTINATION_MANIFESTS_PATH}"
if [ -d "$DST_DIR" ]; then
rm -r "$DST_DIR"
fi
mkdir -p $DST_DIR
cp $SRC_DIR/models-web-app/config/* $DST_DIR -r
echo "Successfully copied all manifests." update_readme "$MANIFESTS_DIRECTORY" "$SOURCE_TEXT" "$DESTINATION_TEXT"
echo "Updating README..." commit_changes "$MANIFESTS_DIRECTORY" "Update kserve models web application manifests from ${COMMIT}" \
SRC_TXT="\[.*\](https://github.com/kserve/models-web-app/tree/.*)" "${DESTINATION_MANIFESTS_PATH}" \
DST_TXT="\[$COMMIT\](https://github.com/kserve/models-web-app/tree/$COMMIT/config)" "README.md"
sed -i "s|$SRC_TXT|$DST_TXT|g" "${MANIFESTS_DIR}"/README.md echo "Synchronization completed successfully."
echo "Committing the changes..."
cd $MANIFESTS_DIR || exit
git add apps/kserve/models-web-app
git add README.md
git commit -s -m "Update kserve models web application manifests from ${COMMIT}"

View File

@ -1,172 +1,99 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to create a PR to update the manifests # This script helps to create a PR to update the Kubeflow manifests
set -euxo pipefail
IFS=$'\n\t'
COMMIT="v1.10.0" # You can use tags as well SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SRC_DIR=${SRC_DIR:=/tmp/kubeflow-kubeflow} source "${SCRIPT_DIRECTORY}/lib.sh"
BRANCH=${BRANCH:=synchronize-kubeflow-kubeflow-manifests-${COMMIT?}}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) setup_error_handling
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
echo "Creating branch: ${BRANCH}" COMPONENT_NAME="kubeflow"
REPOSITORY_NAME="kubeflow/kubeflow"
REPOSITORY_URL="https://github.com/kubeflow/kubeflow.git"
COMMIT="v1.10.0"
REPOSITORY_DIRECTORY="kubeflow"
SOURCE_DIRECTORY=${SOURCE_DIRECTORY:=/tmp/${COMPONENT_NAME}-${COMPONENT_NAME}}
BRANCH_NAME=${BRANCH_NAME:=synchronize-${COMPONENT_NAME}-${COMPONENT_NAME}-manifests-${COMMIT?}}
if [ -n "$(git status --porcelain)" ]; then # Path configurations
echo "WARNING: You have uncommitted changes" MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
fi
if [ `git branch --list $BRANCH` ] create_branch "$BRANCH_NAME"
then
echo "WARNING: Branch $BRANCH already exists."
fi
# Create the branch in the manifests repository clone_and_checkout "$SOURCE_DIRECTORY" "$REPOSITORY_URL" "$REPOSITORY_DIRECTORY" "$COMMIT"
if ! git show-ref --verify --quiet refs/heads/$BRANCH; then
git checkout -b $BRANCH
else
echo "Branch $BRANCH already exists."
fi
echo "Checking out in $SRC_DIR to $COMMIT..."
# Checkout the upstream repository # Function to copy manifests for a specific component
mkdir -p $SRC_DIR copy_component_manifests() {
cd $SRC_DIR local component_name=$1
if [ ! -d "kubeflow/.git" ]; then local source_path=$2
git clone https://github.com/kubeflow/kubeflow.git local destination_path=$3
fi local readme_path_pattern=$4
cd $SRC_DIR/kubeflow
if ! git rev-parse --verify --quiet $COMMIT; then echo "Copying ${component_name} manifests..."
git checkout -b $COMMIT
else local destination_directory="${MANIFESTS_DIRECTORY}/${destination_path}"
git checkout $COMMIT if [ -d "$destination_directory" ]; then
fi rm -r "$destination_directory"
fi
mkdir -p "$destination_directory"
cp "${SOURCE_DIRECTORY}/${REPOSITORY_DIRECTORY}/${source_path}/"* "$destination_directory" -r
echo "Updating README for ${component_name}..."
local source_text="\[.*\](https://github.com/${REPOSITORY_NAME}/tree/.*/components/${readme_path_pattern})"
local destination_text="\[${COMMIT}\](https://github.com/${REPOSITORY_NAME}/tree/${COMMIT}/components/${readme_path_pattern})"
update_readme "$MANIFESTS_DIRECTORY" "$source_text" "$destination_text"
}
if [ -n "$(git status --porcelain)" ]; then copy_component_manifests "admission-webhook" \
echo "WARNING: You have uncommitted changes" "components/admission-webhook/manifests" \
fi "apps/admission-webhook/upstream" \
"admission-webhook/manifests"
echo "Copying admission-webhook manifests..." copy_component_manifests "centraldashboard" \
DST_DIR=$MANIFESTS_DIR/apps/admission-webhook/upstream "components/centraldashboard/manifests" \
if [ -d "$DST_DIR" ]; then "apps/centraldashboard/upstream" \
rm -r "$DST_DIR" "centraldashboard/manifests"
fi
mkdir -p $DST_DIR
cp $SRC_DIR/kubeflow/components/admission-webhook/manifests/* $DST_DIR -r
echo "Updating README..." copy_component_manifests "jupyter-web-app" \
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/admission-webhook/manifests)" "components/crud-web-apps/jupyter/manifests" \
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/admission-webhook/manifests)" "apps/jupyter/jupyter-web-app/upstream" \
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md "crud-web-apps/jupyter/manifests"
echo "Copying centraldashboard manifests..." copy_component_manifests "volumes-web-app" \
DST_DIR=$MANIFESTS_DIR/apps/centraldashboard/upstream "components/crud-web-apps/volumes/manifests" \
if [ -d "$DST_DIR" ]; then "apps/volumes-web-app/upstream" \
rm -r "$DST_DIR" "crud-web-apps/volumes/manifests"
fi
mkdir -p $DST_DIR
cp $SRC_DIR/kubeflow/components/centraldashboard/manifests/* $DST_DIR -r
echo "Updating README..." copy_component_manifests "tensorboards-web-app" \
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/centraldashboard/manifests)" "components/crud-web-apps/tensorboards/manifests" \
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/centraldashboard/manifests)" "apps/tensorboard/tensorboards-web-app/upstream" \
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md "crud-web-apps/tensorboards/manifests"
echo "Copying jupyter-web-app manifests..." copy_component_manifests "profile-controller" \
DST_DIR=$MANIFESTS_DIR/apps/jupyter/jupyter-web-app/upstream "components/profile-controller/config" \
if [ -d "$DST_DIR" ]; then "apps/profiles/upstream" \
rm -r "$DST_DIR" "profile-controller/config"
fi
mkdir -p $DST_DIR
cp $SRC_DIR/kubeflow/components/crud-web-apps/jupyter/manifests/* $DST_DIR -r
echo "Updating README..." copy_component_manifests "notebook-controller" \
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/crud-web-apps/jupyter/manifests)" "components/notebook-controller/config" \
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/crud-web-apps/jupyter/manifests)" "apps/jupyter/notebook-controller/upstream" \
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md "notebook-controller/config"
echo "Copying volumes-web-app manifests..." copy_component_manifests "tensorboard-controller" \
DST_DIR=$MANIFESTS_DIR/apps/volumes-web-app/upstream "components/tensorboard-controller/config" \
if [ -d "$DST_DIR" ]; then "apps/tensorboard/tensorboard-controller/upstream" \
rm -r "$DST_DIR" "tensorboard-controller/config"
fi
mkdir -p $DST_DIR
cp $SRC_DIR/kubeflow/components/crud-web-apps/volumes/manifests/* $DST_DIR -r
echo "Updating README..." copy_component_manifests "pvcviewer-controller" \
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/crud-web-apps/volumes/manifests)" "components/pvcviewer-controller/config" \
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/crud-web-apps/volumes/manifests)" "apps/pvcviewer-controller/upstream" \
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md "pvcviewer-controller/config"
echo "Copying tensorboards-web-app manifests..."
DST_DIR=$MANIFESTS_DIR/apps/tensorboard/tensorboards-web-app/upstream
if [ -d "$DST_DIR" ]; then
rm -r "$DST_DIR"
fi
mkdir -p $DST_DIR
cp $SRC_DIR/kubeflow/components/crud-web-apps/tensorboards/manifests/* $DST_DIR -r
echo "Updating README..."
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/crud-web-apps/tensorboards/manifests)"
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/crud-web-apps/tensorboards/manifests)"
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
echo "Copying profile-controller manifests..."
DST_DIR=$MANIFESTS_DIR/apps/profiles/upstream
if [ -d "$DST_DIR" ]; then
rm -r "$DST_DIR"
fi
mkdir -p $DST_DIR
cp $SRC_DIR/kubeflow/components/profile-controller/config/* $DST_DIR -r
echo "Updating README..."
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/profile-controller/config)"
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/profile-controller/config)"
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
echo "Copying notebook-controller manifests..."
DST_DIR=$MANIFESTS_DIR/apps/jupyter/notebook-controller/upstream
if [ -d "$DST_DIR" ]; then
rm -r "$DST_DIR"
fi
mkdir -p $DST_DIR
cp $SRC_DIR/kubeflow/components/notebook-controller/config/* $DST_DIR -r
echo "Updating README..."
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/notebook-controller/config)"
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/notebook-controller/config)"
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
echo "Copying tensorboard-controller manifests..."
DST_DIR=$MANIFESTS_DIR/apps/tensorboard/tensorboard-controller/upstream
if [ -d "$DST_DIR" ]; then
rm -r "$DST_DIR"
fi
mkdir -p $DST_DIR
cp $SRC_DIR/kubeflow/components/tensorboard-controller/config/* $DST_DIR -r
echo "Updating README..."
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/tensorboard-controller/config)"
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/tensorboard-controller/config)"
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
echo "Copying pvcviewer-controller manifests..."
DST_DIR=$MANIFESTS_DIR/apps/pvcviewer-controller/upstream
if [ -d "$DST_DIR" ]; then
rm -r "$DST_DIR"
fi
mkdir -p $DST_DIR
cp $SRC_DIR/kubeflow/components/pvcviewer-controller/config/* $DST_DIR -r
echo "Updating README..."
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/pvcviewer-controller/config)"
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/pvcviewer-controller/config)"
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
echo "Successfully copied all manifests." echo "Successfully copied all manifests."
echo "Committing the changes..." commit_changes "$MANIFESTS_DIRECTORY" "Update ${REPOSITORY_NAME} manifests from ${COMMIT}" \
cd $MANIFESTS_DIR "apps" \
git add apps "README.md"
git add README.md
git commit -s -m "Update kubeflow/kubeflow manifests from ${COMMIT}" echo "Synchronization completed successfully."

View File

@ -1,70 +1,47 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to create a PR to update the manifests # This script helps to create a PR to update the Model Registry manifests
set -euxo pipefail
IFS=$'\n\t'
COMMIT="v0.2.13" # You can use tags as well SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source "${SCRIPT_DIRECTORY}/lib.sh"
setup_error_handling
COMPONENT_NAME="model-registry"
REPOSITORY_NAME="kubeflow/model-registry"
REPOSITORY_URL="https://github.com/kubeflow/model-registry.git"
COMMIT="v0.2.13"
REPOSITORY_DIRECTORY="model-registry"
DEV_MODE=${DEV_MODE:=false} DEV_MODE=${DEV_MODE:=false}
SRC_DIR=${SRC_DIR:=/tmp/kubeflow-model-registry} SOURCE_DIRECTORY=${SOURCE_DIRECTORY:=/tmp/kubeflow-${COMPONENT_NAME}}
BRANCH=${BRANCH:=synchronize-kubeflow-model-registry-manifests-${COMMIT?}} BRANCH_NAME=${BRANCH_NAME:=synchronize-kubeflow-${COMPONENT_NAME}-manifests-${COMMIT?}}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Path configurations
MANIFESTS_DIR=$(dirname $SCRIPT_DIR) MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
SOURCE_MANIFESTS_PATH="manifests/kustomize"
DESTINATION_MANIFESTS_PATH="apps/${COMPONENT_NAME}/upstream"
echo "Creating branch: ${BRANCH}" # README update patterns
SOURCE_TEXT="\[.*\](https://github.com/${REPOSITORY_NAME}/tree/.*/manifests/kustomize)"
DESTINATION_TEXT="\[${COMMIT}\](https://github.com/${REPOSITORY_NAME}/tree/${COMMIT}/manifests/kustomize)"
if [ -n "$(git status --porcelain)" ]; then create_branch "$BRANCH_NAME"
echo "WARNING: You have uncommitted changes"
clone_and_checkout "$SOURCE_DIRECTORY" "$REPOSITORY_URL" "$REPOSITORY_DIRECTORY" "$COMMIT"
echo "Copying ${COMPONENT_NAME} manifests..."
DESTINATION_DIRECTORY=$MANIFESTS_DIRECTORY/$DESTINATION_MANIFESTS_PATH
if [ -d "$DESTINATION_DIRECTORY" ]; then
rm -r "$DESTINATION_DIRECTORY"
fi fi
mkdir -p $DESTINATION_DIRECTORY
if [ `git branch --list $BRANCH` ] cp -r "$SOURCE_DIRECTORY/$REPOSITORY_DIRECTORY/$SOURCE_MANIFESTS_PATH/"* "$DESTINATION_DIRECTORY"
then
echo "WARNING: Branch $BRANCH already exists."
fi
# Create the branch in the manifests repository
if ! git show-ref --verify --quiet refs/heads/$BRANCH; then
git checkout -b $BRANCH
else
echo "Branch $BRANCH already exists."
fi
echo "Checking out in $SRC_DIR to $COMMIT..."
# Checkout the Model Registry repository
mkdir -p $SRC_DIR
cd $SRC_DIR
if [ ! -d "model-registry/.git" ]; then
git clone https://github.com/kubeflow/model-registry.git
fi
cd $SRC_DIR/model-registry
if ! git rev-parse --verify --quiet $COMMIT; then
git checkout -b $COMMIT
else
git checkout $COMMIT
fi
if [ -n "$(git status --porcelain)" ]; then
echo "WARNING: You have uncommitted changes"
fi
echo "Copying model-registry manifests..."
DST_DIR=$MANIFESTS_DIR/apps/model-registry/upstream
if [ -d "$DST_DIR" ]; then
rm -r "$DST_DIR"
fi
mkdir -p $DST_DIR
cp -r "$SRC_DIR/model-registry/manifests/kustomize/"* "$DST_DIR"
echo "Successfully copied all manifests." echo "Successfully copied all manifests."
echo "Updating README..." update_readme "$MANIFESTS_DIRECTORY" "$SOURCE_TEXT" "$DESTINATION_TEXT"
SRC_TXT="\[.*\](https://github.com/kubeflow/model-registry/tree/.*/manifests/kustomize)"
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/model-registry/tree/$COMMIT/manifests/kustomize)"
sed -i "" "s|$SRC_TXT|$DST_TXT|g" "${MANIFESTS_DIR}/README.md" commit_changes "$MANIFESTS_DIRECTORY" "Update ${REPOSITORY_NAME} manifests from ${COMMIT}" \
"apps" \
"README.md"
echo "Committing the changes..." echo "Synchronization completed successfully."
cd $MANIFESTS_DIR
git add apps
git add README.md
git commit -s -m "Update kubeflow/model-registry manifests from ${COMMIT}"

View File

@ -1,68 +1,39 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to create a PR to update the manifests # This script helps to create a PR to update the Kubeflow Pipelines manifests
set -euxo pipefail
IFS=$'\n\t'
COMMIT="2.4.1" # You can use tags as well
SRC_DIR=${SRC_DIR:=/tmp/kubeflow-pipelines}
BRANCH=${BRANCH:=synchronize-kubeflow-pipelines-manifests-${COMMIT?}}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
MANIFESTS_DIR=$(dirname $SCRIPT_DIR) source "${SCRIPT_DIRECTORY}/lib.sh"
echo "Creating branch: ${BRANCH}" setup_error_handling
if [ -n "$(git status --porcelain)" ]; then COMPONENT_NAME="pipelines"
echo "WARNING: You have uncommitted changes" REPOSITORY_NAME="kubeflow/pipelines"
fi REPOSITORY_URL="https://github.com/kubeflow/pipelines.git"
if [ `git branch --list $BRANCH` ] COMMIT="2.4.1"
then REPOSITORY_DIRECTORY="pipelines"
echo "WARNING: Branch $BRANCH already exists." SOURCE_DIRECTORY=${SOURCE_DIRECTORY:=/tmp/kubeflow-${COMPONENT_NAME}}
fi BRANCH_NAME=${BRANCH_NAME:=synchronize-kubeflow-${COMPONENT_NAME}-manifests-${COMMIT?}}
# Create the branch in the manifests repository # Path configurations
if ! git show-ref --verify --quiet refs/heads/$BRANCH; then MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
git checkout -b $BRANCH SOURCE_MANIFESTS_PATH="manifests/kustomize"
else DESTINATION_MANIFESTS_PATH="apps/pipeline/upstream"
echo "Branch $BRANCH already exists."
fi
echo "Checking out in $SRC_DIR to $COMMIT..."
# Checkout the KFP repository # README update patterns
mkdir -p $SRC_DIR SOURCE_TEXT="\[.*\](https://github.com/${REPOSITORY_NAME}/tree/.*/manifests/kustomize)"
cd $SRC_DIR DESTINATION_TEXT="\[${COMMIT}\](https://github.com/${REPOSITORY_NAME}/tree/${COMMIT}/manifests/kustomize)"
if [ ! -d "pipelines/.git" ]; then
git clone https://github.com/kubeflow/pipelines.git
fi
cd $SRC_DIR/pipelines
if ! git rev-parse --verify --quiet $COMMIT; then
git checkout -b $COMMIT
else
git checkout $COMMIT
fi
create_branch "$BRANCH_NAME"
if [ -n "$(git status --porcelain)" ]; then clone_and_checkout "$SOURCE_DIRECTORY" "$REPOSITORY_URL" "$REPOSITORY_DIRECTORY" "$COMMIT"
echo "WARNING: You have uncommitted changes"
fi
echo "Copying pipelines manifests..." echo "Copying ${COMPONENT_NAME} manifests..."
DST_DIR=$MANIFESTS_DIR/apps/pipeline/upstream copy_manifests "${SOURCE_DIRECTORY}/${REPOSITORY_DIRECTORY}/${SOURCE_MANIFESTS_PATH}" "${MANIFESTS_DIRECTORY}/${DESTINATION_MANIFESTS_PATH}"
if [ -d "$DST_DIR" ]; then
rm -r "$DST_DIR"
fi
cp $SRC_DIR/pipelines/manifests/kustomize $DST_DIR -r
update_readme "$MANIFESTS_DIRECTORY" "$SOURCE_TEXT" "$DESTINATION_TEXT"
echo "Successfully copied all manifests." commit_changes "$MANIFESTS_DIRECTORY" "Update ${REPOSITORY_NAME} manifests from ${COMMIT}" \
"apps" \
"README.md"
echo "Updating README..." echo "Synchronization completed successfully."
SRC_TXT="\[.*\](https://github.com/kubeflow/pipelines/tree/.*/manifests/kustomize)"
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/pipelines/tree/$COMMIT/manifests/kustomize)"
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
echo "Committing the changes..."
cd $MANIFESTS_DIR
git add apps
git add README.md
git commit -s -m "Update kubeflow/pipelines manifests from ${COMMIT}"

View File

@ -1,35 +1,28 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to create a PR to update the manifests # This script helps to create a PR to update the Spark Operator manifests
set -euxo pipefail
IFS=$'\n\t'
# You can use tags or commit hashes SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source "${SCRIPT_DIRECTORY}/lib.sh"
setup_error_handling
COMPONENT_NAME="spark-operator"
SPARK_OPERATOR_VERSION=${SPARK_OPERATOR_VERSION:="2.1.1"} SPARK_OPERATOR_VERSION=${SPARK_OPERATOR_VERSION:="2.1.1"}
SPARK_OPERATOR_HELM_CHART_REPO=${SPARK_OPERATOR_HELM_CHART_REPO:="https://kubeflow.github.io/spark-operator"} SPARK_OPERATOR_HELM_CHART_REPO=${SPARK_OPERATOR_HELM_CHART_REPO:="https://kubeflow.github.io/spark-operator"}
DEV_MODE=${DEV_MODE:=false} DEV_MODE=${DEV_MODE:=false}
BRANCH=${BRANCH:=synchronize-spark-operator-manifests-${SPARK_OPERATOR_VERSION?}} BRANCH_NAME=${BRANCH_NAME:=synchronize-${COMPONENT_NAME}-manifests-${SPARK_OPERATOR_VERSION?}}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Path configurations
MANIFESTS_DIR=$(dirname $SCRIPT_DIR) MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
DESTINATION_MANIFESTS_PATH="apps/spark/${COMPONENT_NAME}/base"
echo "Creating branch: ${BRANCH}" create_branch "$BRANCH_NAME"
if [ -n "$(git status --porcelain)" ]; then
echo "WARNING: You have uncommitted changes"
fi
# Create the branch in the manifests repository
if ! git show-ref --verify --quiet refs/heads/$BRANCH; then
git checkout -b $BRANCH
else
echo "Branch $BRANCH already exists."
fi
echo "Generating manifests from Helm chart version ${SPARK_OPERATOR_VERSION}..." echo "Generating manifests from Helm chart version ${SPARK_OPERATOR_VERSION}..."
# Generate the manifests using Helm DESTINATION_DIRECTORY=$MANIFESTS_DIRECTORY/$DESTINATION_MANIFESTS_PATH
DST_DIR=$MANIFESTS_DIR/apps/spark/spark-operator/base mkdir -p $DESTINATION_DIRECTORY
mkdir -p $DST_DIR cd $DESTINATION_DIRECTORY
cd $DST_DIR
# Create a kustomization.yaml file if it doesn't exist # Create a kustomization.yaml file if it doesn't exist
if [ ! -f kustomization.yaml ]; then if [ ! -f kustomization.yaml ]; then
@ -41,7 +34,6 @@ resources:
EOF EOF
fi fi
# Generate the manifests using Helm
helm template -n kubeflow --include-crds spark-operator spark-operator \ helm template -n kubeflow --include-crds spark-operator spark-operator \
--set "spark.jobNamespaces={}" \ --set "spark.jobNamespaces={}" \
--set webhook.enable=true \ --set webhook.enable=true \
@ -51,19 +43,16 @@ helm template -n kubeflow --include-crds spark-operator spark-operator \
echo "Successfully generated manifests." echo "Successfully generated manifests."
echo "Updating README..."
# Use OS-compatible sed command # Use OS-compatible sed command
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS version sed -i '' 's/Spark Operator[^|]*|[^|]*apps\/spark\/spark-operator[^|]*|[^|]*[0-9]\.[0-9]\.[0-9]/Spark Operator | apps\/spark\/spark-operator | '"${SPARK_OPERATOR_VERSION}"'/g' "${MANIFESTS_DIRECTORY}/README.md"
sed -i '' 's/Spark Operator[^|]*|[^|]*apps\/spark\/spark-operator[^|]*|[^|]*[0-9]\.[0-9]\.[0-9]/Spark Operator | apps\/spark\/spark-operator | '"${SPARK_OPERATOR_VERSION}"'/g' "${MANIFESTS_DIR}/README.md"
else else
# Linux version sed -i 's/Spark Operator.*|.*apps\/spark\/spark-operator[^|]*|.*[0-9]\.[0-9]\.[0-9]/Spark Operator | apps\/spark\/spark-operator | '"${SPARK_OPERATOR_VERSION}"'/g' "${MANIFESTS_DIRECTORY}/README.md"
sed -i 's/Spark Operator.*|.*apps\/spark\/spark-operator[^|]*|.*[0-9]\.[0-9]\.[0-9]/Spark Operator | apps\/spark\/spark-operator | '"${SPARK_OPERATOR_VERSION}"'/g' "${MANIFESTS_DIR}/README.md"
fi fi
echo "Committing the changes..." commit_changes "$MANIFESTS_DIRECTORY" "Update kubeflow/${COMPONENT_NAME} manifests to ${SPARK_OPERATOR_VERSION}" \
cd $MANIFESTS_DIR "apps/spark" \
git add apps/spark "README.md" \
git add README.md "scripts"
git add scripts
git commit -s -m "Update kubeflow/spark-operator manifests to ${SPARK_OPERATOR_VERSION}" echo "Synchronization completed successfully."

View File

@ -1,71 +1,38 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to create a PR to update the manifests # This script helps to create a PR to update the Training Operator manifests
set -euxo pipefail
IFS=$'\n\t'
COMMIT="v1.9.1" # You can use tags as well SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SRC_DIR=${SRC_DIR:=/tmp/kubeflow-training-operator} source "${SCRIPT_DIRECTORY}/lib.sh"
BRANCH=${BRANCH:=synchronize-kubeflow-training-operator-manifests-${COMMIT?}}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) setup_error_handling
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
echo "Creating branch: ${BRANCH}" COMPONENT_NAME="training-operator"
REPOSITORY_NAME="kubeflow/training-operator"
REPOSITORY_URL="https://github.com/kubeflow/training-operator.git"
COMMIT="v1.9.1"
REPOSITORY_DIRECTORY="training-operator"
SOURCE_DIRECTORY=${SOURCE_DIRECTORY:=/tmp/kubeflow-${COMPONENT_NAME}}
BRANCH_NAME=${BRANCH_NAME:=synchronize-${COMPONENT_NAME}-manifests-${COMMIT?}}
if [ -n "$(git status --porcelain)" ]; then # Path configurations
echo "WARNING: You have uncommitted changes" MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
fi SOURCE_MANIFESTS_PATH="manifests"
DESTINATION_MANIFESTS_PATH="apps/${COMPONENT_NAME}/upstream"
if [ `git branch --list $BRANCH` ] # README update patterns
then SOURCE_TEXT="\[.*\](https://github.com/${REPOSITORY_NAME}/tree/.*/manifests)"
echo "WARNING: Branch $BRANCH already exists." DESTINATION_TEXT="\[${COMMIT}\](https://github.com/${REPOSITORY_NAME}/tree/${COMMIT}/manifests)"
fi
# Create the branch in the manifests repository create_branch "$BRANCH_NAME"
if ! git show-ref --verify --quiet refs/heads/$BRANCH; then
git checkout -b $BRANCH
else
echo "Branch $BRANCH already exists."
fi
echo "Checking out in $SRC_DIR to $COMMIT..." clone_and_checkout "$SOURCE_DIRECTORY" "$REPOSITORY_URL" "$REPOSITORY_DIRECTORY" "$COMMIT"
# Checkout the Training Operator repository copy_manifests "${SOURCE_DIRECTORY}/${REPOSITORY_DIRECTORY}/${SOURCE_MANIFESTS_PATH}" "${MANIFESTS_DIRECTORY}/${DESTINATION_MANIFESTS_PATH}"
mkdir -p $SRC_DIR
cd $SRC_DIR
if [ ! -d "training-operator/.git" ]; then
git clone https://github.com/kubeflow/training-operator.git
fi
cd $SRC_DIR/training-operator
if ! git rev-parse --verify --quiet $COMMIT; then
git checkout -b $COMMIT
else
git checkout $COMMIT
fi
if [ -n "$(git status --porcelain)" ]; then update_readme "$MANIFESTS_DIRECTORY" "$SOURCE_TEXT" "$DESTINATION_TEXT"
echo "WARNING: You have uncommitted changes"
fi
echo "Copying training-operator manifests..." commit_changes "$MANIFESTS_DIRECTORY" "Update ${REPOSITORY_NAME} manifests from ${COMMIT}" \
DST_DIR=$MANIFESTS_DIR/apps/training-operator/upstream "apps" \
if [ -d "$DST_DIR" ]; then "README.md"
rm -r "$DST_DIR"
fi
cp $SRC_DIR/training-operator/manifests $DST_DIR -r
echo "Synchronization completed successfully."
echo "Successfully copied all manifests."
echo "Updating README..."
SRC_TXT="\[.*\](https://github.com/kubeflow/training-operator/tree/.*/manifests)"
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/training-operator/tree/$COMMIT/manifests)"
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
# DEV: Comment out these commands if you are testing locally
echo "Committing the changes..."
cd $MANIFESTS_DIR
git add apps
git add README.md
git commit -s -m "Update kubeflow/training-operator manifests from ${COMMIT}"

39
scripts/template.sh Normal file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Template for Kubeflow manifests synchronization scripts
# Usage: Copy this file and adjust the variables for your specific component
# Source the common library functions
SCRIPT_DIRECTORY=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source "${SCRIPT_DIRECTORY}/lib.sh"
setup_error_handling
# Configuration variables (adjust these for your specific component)
COMPONENT_NAME="component-name" # Name of the component (e.g., katib, training-operator)
REPOSITORY_NAME="repo-name" # Repository name (e.g., kubeflow/katib)
REPOSITORY_URL="https://github.com/org/repo.git" # Repository URL to clone from
COMMIT="v0.0.0" # Version/commit to synchronize
REPOSITORY_DIRECTORY="${COMPONENT_NAME}" # Directory name within SOURCE_DIRECTORY
SOURCE_DIRECTORY=${SOURCE_DIRECTORY:=/tmp/kubeflow-${COMPONENT_NAME}} # Where to clone the source repo
BRANCH_NAME=${BRANCH_NAME:=synchronize-${COMPONENT_NAME}-manifests-${COMMIT?}} # Branch name for the PR
MANIFESTS_DIRECTORY=$(dirname $SCRIPT_DIRECTORY)
SOURCE_MANIFESTS_PATH="manifests" # Path within source repo where manifests are
DESTINATION_MANIFESTS_PATH="apps/${COMPONENT_NAME}/upstream" # Destination path within manifests repo
SOURCE_TEXT="\[.*\](https://github.com/${REPOSITORY_NAME}/tree/.*/manifests)"
DESTINATION_TEXT="\[${COMMIT}\](https://github.com/${REPOSITORY_NAME}/tree/${COMMIT}/manifests)"
create_branch "$BRANCH_NAME"
clone_and_checkout "$SOURCE_DIRECTORY" "$REPOSITORY_URL" "$REPOSITORY_DIRECTORY" "$COMMIT"
copy_manifests "${SOURCE_DIRECTORY}/${REPOSITORY_DIRECTORY}/${SOURCE_MANIFESTS_PATH}" "${MANIFESTS_DIRECTORY}/${DESTINATION_MANIFESTS_PATH}"
update_readme "$MANIFESTS_DIRECTORY" "$SOURCE_TEXT" "$DESTINATION_TEXT"
commit_changes "$MANIFESTS_DIRECTORY" "Update ${REPOSITORY_NAME} manifests from ${COMMIT}" \
"${DESTINATION_MANIFESTS_PATH}" \
"README.md"
echo "Synchronization completed successfully."