update kubeflow dip-catalog
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
@ -1,88 +0,0 @@
|
||||
|
||||
# This script aims at helping create a PR to update the manifests of the
|
||||
# knative.
|
||||
# This script:
|
||||
# 1. Checks out a new branch
|
||||
# 2. Download files into the correct places
|
||||
# 3. Commits the changes
|
||||
#
|
||||
# Afterwards the developers can submit the PR to the kubeflow/manifests
|
||||
# repo, based on that local branch
|
||||
# It must be executed directly from its directory
|
||||
|
||||
# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
set -euxo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
COMMIT="1.22.1" # Must be a release
|
||||
CURRENT_VERSION="1-21"
|
||||
NEW_VERSION="1-22"
|
||||
|
||||
SRC_DIR=${SRC_DIR:=/tmp/istio-cni}
|
||||
BRANCH=${BRANCH:=istio-${COMMIT?}}
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
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
|
||||
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
|
||||
|
||||
# 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 istio repository
|
||||
if [ ! -d "$SRC_DIR" ]; then
|
||||
mkdir -p $SRC_DIR
|
||||
fi
|
||||
cd $SRC_DIR
|
||||
if [ ! -d "istio-${COMMIT}" ]; then
|
||||
wget "https://github.com/istio/istio/releases/download/${COMMIT}/istio-${COMMIT}-linux-amd64.tar.gz"
|
||||
tar xvfz istio-${COMMIT}-linux-amd64.tar.gz
|
||||
fi
|
||||
|
||||
ISTIOCTL=$SRC_DIR/istio-${COMMIT}/bin/istioctl
|
||||
cd $ISTIO_NEW
|
||||
$ISTIOCTL profile dump default > profile.yaml
|
||||
|
||||
# cd $ISTIO_NEW
|
||||
# export PATH="$MANIFESTS_DIR/scripts:$PATH"
|
||||
$ISTIOCTL manifest generate -f profile.yaml -f profile-overlay.yaml --set components.cni.enabled=true --set components.cni.namespace=kube-system > dump.yaml
|
||||
./split-istio-packages -f dump.yaml
|
||||
mv $ISTIO_NEW/crd.yaml $ISTIO_NEW/istio-crds/base
|
||||
mv $ISTIO_NEW/install.yaml $ISTIO_NEW/istio-install/base
|
||||
mv $ISTIO_NEW/cluster-local-gateway.yaml $ISTIO_NEW/cluster-local-gateway/base
|
||||
rm dump.yaml
|
||||
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "WARNING: You have uncommitted changes"
|
||||
fi
|
||||
|
||||
# Update README.md to synchronize with the upgraded Istio version
|
||||
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}"
|
||||
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
# # This script aims at helping create a PR to update the manifests of Istio
|
||||
# # This script:
|
||||
# # 1. Checks out a new branch
|
||||
# # 2. Download files into the correct places
|
||||
# # 3. Commits the changes
|
||||
# #
|
||||
# # Afterwards the developers can submit the PR to the kubeflow/manifests
|
||||
# # repository, based on that local branch
|
||||
# # It must be executed directly from its directory
|
||||
|
||||
# # strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
set -euxo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
COMMIT="1.22.1"
|
||||
CURRENT_VERSION="1-21"
|
||||
NEW_VERSION="1-22" # Must be a release
|
||||
|
||||
SRC_DIR=${SRC_DIR:=/tmp/istio} # Must be a release
|
||||
BRANCH=${BRANCH:=istio-${COMMIT?}}
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
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
|
||||
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
|
||||
|
||||
# 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 istio repository
|
||||
if [ ! -d "$SRC_DIR" ]; then
|
||||
mkdir -p $SRC_DIR
|
||||
fi
|
||||
cd $SRC_DIR
|
||||
if [ ! -d "istio-${COMMIT}" ]; then
|
||||
wget "https://github.com/istio/istio/releases/download/${COMMIT}/istio-${COMMIT}-linux-amd64.tar.gz"
|
||||
tar xvfz istio-${COMMIT}-linux-amd64.tar.gz
|
||||
fi
|
||||
|
||||
ISTIOCTL=$SRC_DIR/istio-${COMMIT}/bin/istioctl
|
||||
cd $ISTIO_NEW
|
||||
$ISTIOCTL profile dump default > profile.yaml
|
||||
|
||||
# cd $ISTIO_NEW
|
||||
# export PATH="$MANIFESTS_DIR/scripts:$PATH"
|
||||
$ISTIOCTL manifest generate -f profile.yaml -f profile-overlay.yaml > dump.yaml
|
||||
./split-istio-packages -f dump.yaml
|
||||
mv $ISTIO_NEW/crd.yaml $ISTIO_NEW/istio-crds/base
|
||||
mv $ISTIO_NEW/install.yaml $ISTIO_NEW/istio-install/base
|
||||
mv $ISTIO_NEW/cluster-local-gateway.yaml $ISTIO_NEW/cluster-local-gateway/base
|
||||
rm dump.yaml
|
||||
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "WARNING: You have uncommitted changes"
|
||||
fi
|
||||
|
||||
# Update README.md to synchronize with the upgraded Istio version
|
||||
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}"
|
||||
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script aims at helping create a PR to update the manifests of the
|
||||
# kubeflow/katib repository.
|
||||
# This script:
|
||||
# 1. Checks out a new branch
|
||||
# 2. Copies files to the correct places
|
||||
# 3. Commits the changes
|
||||
#
|
||||
# Afterwards the developers can submit the PR to the kubeflow/manifests
|
||||
# repository, based on that local branch
|
||||
# It must be executed directly from its directory
|
||||
|
||||
# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
set -euxo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
COMMIT="v0.17.0" # You can use tags as well
|
||||
SRC_DIR=${SRC_DIR:=/tmp/kubeflow-katib}
|
||||
BRANCH=${BRANCH:=synchronize-kubeflow-katib-manifests-${COMMIT?}}
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
|
||||
|
||||
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
|
||||
|
||||
# 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 KFP repositorysitory
|
||||
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
|
||||
|
||||
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "WARNING: You have uncommitted changes"
|
||||
fi
|
||||
|
||||
echo "Copying katib manifests..."
|
||||
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
|
||||
|
||||
|
||||
echo "Successfully copied all manifests."
|
||||
|
||||
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}"
|
||||
@@ -0,0 +1,144 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script aims at helping create a PR to update the manifests of knative.
|
||||
# This script:
|
||||
# 1. Checks out a new branch
|
||||
# 2. Download files into the correct places
|
||||
# 3. Commits the changes
|
||||
#
|
||||
# Afterwards the developers can submit the PR to the kubeflow/manifests
|
||||
# repository, based on that local branch
|
||||
# It must be executed directly from its directory
|
||||
|
||||
# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
set -euxo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
KN_SERVING_RELEASE="v1.12.4" # Must be a release
|
||||
KN_EXTENSION_RELEASE="v1.12.3" # Must be a release
|
||||
KN_EVENTING_RELEASE="v1.12.6" # Must be a release
|
||||
BRANCH=${BRANCH:=synchronize-knative-manifests-${KN_SERVING_RELEASE?}}
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
|
||||
|
||||
# replace source regex ($1) with target regex ($2)
|
||||
# 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}"
|
||||
|
||||
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
|
||||
|
||||
# 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
|
||||
|
||||
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..."
|
||||
# No need to install serving-crds.
|
||||
# See: https://github.com/knative/serving/issues/9945
|
||||
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 $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=""' $DST_DIR/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 'explode(.)' $DST_DIR/knative-serving/base/upstream/serving-core.yaml
|
||||
yq eval -i 'explode(.)' $DST_DIR/knative-serving/base/upstream/net-istio.yaml
|
||||
yq eval -i 'explode(.)' $DST_DIR/knative-serving-post-install-jobs/base/serving-post-install-jobs.yaml
|
||||
|
||||
# We are not using the '|=' operator because it generates an empty object
|
||||
# ({}) 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..."
|
||||
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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=""' $DST_DIR/knative-eventing/base/upstream/eventing-core.yaml
|
||||
yq eval -i '... comments=""' $DST_DIR/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 '... comments=""' $DST_DIR/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 '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
|
||||
# ({}) which crashes kustomize.
|
||||
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
|
||||
yq eval -i 'select((.kind == "ConfigMap" and .metadata.name == "config-tracing") | not)' $DST_DIR/knative-eventing/base/upstream/in-memory-channel.yaml
|
||||
|
||||
echo "Successfully copied all manifests."
|
||||
|
||||
echo "Updating README..."
|
||||
|
||||
replace_in_file \
|
||||
"\[.*\](https://github.com/knative/serving/releases/tag/knative-.*) <" \
|
||||
"\[$KN_SERVING_RELEASE\](https://github.com/knative/serving/releases/tag/knative-$KN_SERVING_RELEASE) <" \
|
||||
${MANIFESTS_DIR}/README.md
|
||||
|
||||
replace_in_file \
|
||||
"> \[.*\](https://github.com/knative/eventing/releases/tag/knative-.*)" \
|
||||
"> \[$KN_EVENTING_RELEASE\](https://github.com/knative/eventing/releases/tag/knative-$KN_EVENTING_RELEASE)" \
|
||||
${MANIFESTS_DIR}/README.md
|
||||
|
||||
replace_in_file \
|
||||
"\[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)" \
|
||||
$DST_DIR/README.md
|
||||
|
||||
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 ($KN_EXTENSION_RELEASE)\](https://github.com/knative-extensions/net-istio/releases/tag/knative-$KN_EXTENSION_RELEASE)" \
|
||||
$DST_DIR/README.md
|
||||
|
||||
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 \[$KN_EVENTING_RELEASE release\](https://github.com/knative/eventing/releases/tag/knative-$KN_EVENTING_RELEASE)" \
|
||||
$DST_DIR/README.md
|
||||
|
||||
echo "Committing the changes..."
|
||||
cd $MANIFESTS_DIR
|
||||
git add $DST_DIR
|
||||
git add README.md
|
||||
git commit -s -m "Update common/knative manifests from ${KN_SERVING_RELEASE}/${KN_EVENTING_RELEASE}"
|
||||
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script aims at helping create a PR to update the manifests of the
|
||||
# kserve/kserve repository.
|
||||
# This script:
|
||||
# 1. Checks out a new branch
|
||||
# 2. Copies files to the correct places
|
||||
# 3. Commits the changes
|
||||
#
|
||||
# Afterwards the developers can submit the PR to the kubeflow/manifests
|
||||
# repository, based on that local branch
|
||||
# It must be executed directly from its directory
|
||||
|
||||
# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
set -euxo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
KSERVE_VERSION="v0.13.0"
|
||||
COMMIT="0.13.0" # You can use tags as well
|
||||
SRC_DIR=${SRC_DIR:=/tmp/kserve}
|
||||
BRANCH=${BRANCH:=synchronize-kserve-manifests-${COMMIT?}}
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
|
||||
|
||||
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
|
||||
|
||||
# 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 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..."
|
||||
DST_DIR=$MANIFESTS_DIR/contrib/kserve/kserve
|
||||
if [ -d "$DST_DIR" ]; then
|
||||
rm -rf "$DST_DIR"/kserve*
|
||||
fi
|
||||
cp $SRC_DIR/kserve/install/"$KSERVE_VERSION"/* $DST_DIR -r
|
||||
|
||||
|
||||
echo "Successfully copied all manifests."
|
||||
|
||||
echo "Updating README..."
|
||||
SRC_TXT="\[.*\](https://github.com/kserve/kserve/tree/.*)"
|
||||
DST_TXT="\[$COMMIT\](https://github.com/kserve/kserve/tree/$COMMIT/install/$KSERVE_VERSION)"
|
||||
|
||||
sed -i "s|$SRC_TXT|$DST_TXT|g" "${MANIFESTS_DIR}"/README.md
|
||||
|
||||
echo "Committing the changes..."
|
||||
cd "$MANIFESTS_DIR"
|
||||
git add contrib/kserve
|
||||
git add README.md
|
||||
git commit -s -m "Update kserve manifests from ${KSERVE_VERSION}" -m "Update kserve/kserve manifests from ${COMMIT}"
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script aims at helping create a PR to update the manifests of the
|
||||
# kserve/models-web-app repository.
|
||||
# This script:
|
||||
# 1. Checks out a new branch
|
||||
# 2. Copies files to the correct places
|
||||
# 3. Commits the changes
|
||||
#
|
||||
# Afterwards the developers can submit the PR to the kubeflow/manifests
|
||||
# repository, based on that local branch
|
||||
|
||||
|
||||
COMMIT="0.13.0" # You can use tags as well
|
||||
SRC_DIR=${SRC_DIR:=/tmp/kserve-models-web-app}
|
||||
BRANCH=${BRANCH:=synchronize-kserve-web-app-manifests-${COMMIT?}}
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
|
||||
|
||||
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
|
||||
|
||||
# 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 || 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 admission-webhook manifests..."
|
||||
DST_DIR=$MANIFESTS_DIR/contrib/kserve/models-web-app
|
||||
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."
|
||||
|
||||
echo "Updating README..."
|
||||
SRC_TXT="\[.*\](https://github.com/kserve/models-web-app/tree/.*)"
|
||||
DST_TXT="\[$COMMIT\](https://github.com/kserve/models-web-app/tree/$COMMIT/config)"
|
||||
|
||||
sed -i "s|$SRC_TXT|$DST_TXT|g" "${MANIFESTS_DIR}"/README.md
|
||||
|
||||
echo "Committing the changes..."
|
||||
cd $MANIFESTS_DIR || exit
|
||||
git add contrib/kserve/models-web-app
|
||||
git add README.md
|
||||
git commit -s -m "Update kserve models web application manifests from ${COMMIT}"
|
||||
@@ -0,0 +1,183 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script aims at helping create a PR to update the manifests of the
|
||||
# kubeflow/kubeflow repo.
|
||||
# This script:
|
||||
# 1. Checks out a new branch
|
||||
# 2. Copies files to the correct places
|
||||
# 3. Commits the changes
|
||||
#
|
||||
# Afterwards the developers can submit the PR to the kubeflow/manifests
|
||||
# repo, based on that local branch
|
||||
|
||||
# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
COMMIT="v1.9.0" # You can use tags as well
|
||||
SRC_DIR=${SRC_DIR:=/tmp/kubeflow-kubeflow}
|
||||
BRANCH=${BRANCH:=synchronize-kubeflow-kubeflow-manifests-${COMMIT?}}
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
|
||||
|
||||
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
|
||||
|
||||
# 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 "kubeflow/.git" ]; then
|
||||
git clone https://github.com/kubeflow/kubeflow.git
|
||||
fi
|
||||
cd $SRC_DIR/models-web-app
|
||||
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 admission-webhook manifests..."
|
||||
DST_DIR=$MANIFESTS_DIR/apps/admission-webhook/upstream
|
||||
if [ -d "$DST_DIR" ]; then
|
||||
rm -r "$DST_DIR"
|
||||
fi
|
||||
mkdir -p $DST_DIR
|
||||
cp $SRC_DIR/kubeflow/components/admission-webhook/manifests/* $DST_DIR -r
|
||||
|
||||
echo "Updating README..."
|
||||
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/admission-webhook/manifests)"
|
||||
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/admission-webhook/manifests)"
|
||||
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
|
||||
|
||||
echo "Copying centraldashboard manifests..."
|
||||
DST_DIR=$MANIFESTS_DIR/apps/centraldashboard/upstream
|
||||
if [ -d "$DST_DIR" ]; then
|
||||
rm -r "$DST_DIR"
|
||||
fi
|
||||
mkdir -p $DST_DIR
|
||||
cp $SRC_DIR/kubeflow/components/centraldashboard/manifests/* $DST_DIR -r
|
||||
|
||||
echo "Updating README..."
|
||||
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/centraldashboard/manifests)"
|
||||
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/centraldashboard/manifests)"
|
||||
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
|
||||
|
||||
echo "Copying jupyter-web-app manifests..."
|
||||
DST_DIR=$MANIFESTS_DIR/apps/jupyter/jupyter-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/jupyter/manifests/* $DST_DIR -r
|
||||
|
||||
echo "Updating README..."
|
||||
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/crud-web-apps/jupyter/manifests)"
|
||||
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/crud-web-apps/jupyter/manifests)"
|
||||
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
|
||||
|
||||
echo "Copying volumes-web-app manifests..."
|
||||
DST_DIR=$MANIFESTS_DIR/apps/volumes-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/volumes/manifests/* $DST_DIR -r
|
||||
|
||||
echo "Updating README..."
|
||||
SRC_TXT="\[.*\](https://github.com/kubeflow/kubeflow/tree/.*/components/crud-web-apps/volumes/manifests)"
|
||||
DST_TXT="\[$COMMIT\](https://github.com/kubeflow/kubeflow/tree/$COMMIT/components/crud-web-apps/volumes/manifests)"
|
||||
sed -i "s|$SRC_TXT|$DST_TXT|g" ${MANIFESTS_DIR}/README.md
|
||||
|
||||
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 "Committing the changes..."
|
||||
cd $MANIFESTS_DIR
|
||||
git add apps
|
||||
git add README.md
|
||||
git commit -s -m "Update kubeflow/kubeflow manifests from ${COMMIT}"
|
||||
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script aims at helping create a PR to update the manifests of the
|
||||
# kubeflow/model-registry repository.
|
||||
# This script:
|
||||
# 1. Checks out a new branch
|
||||
# 2. Copies files to the correct places
|
||||
# 3. Commits the changes
|
||||
#
|
||||
# Afterwards the developers can submit the PR to the kubeflow/manifests
|
||||
# repository, based on that local branch
|
||||
# It must be executed directly from its directory
|
||||
|
||||
# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
set -euxo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
COMMIT="v0.2.1-alpha" # You can use tags as well
|
||||
DEV_MODE=${DEV_MODE:=false}
|
||||
SRC_DIR=${SRC_DIR:=/tmp/kubeflow-model-registry}
|
||||
BRANCH=${BRANCH:=synchronize-kubeflow-model-registry-manifests-${COMMIT?}}
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
|
||||
|
||||
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
|
||||
|
||||
# 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 $SRC_DIR/model-registry/manifests/kustomize/* $DST_DIR -r
|
||||
|
||||
echo "Successfully copied all manifests."
|
||||
|
||||
echo "Updating README..."
|
||||
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
|
||||
|
||||
echo "Committing the changes..."
|
||||
cd $MANIFESTS_DIR
|
||||
git add apps
|
||||
git add README.md
|
||||
git commit -s -m "Update kubeflow/model-registry manifests from ${COMMIT}"
|
||||
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script aims at helping create a PR to update the manifests of the
|
||||
# kubeflow/pipelines repository.
|
||||
# This script:
|
||||
# 1. Checks out a new branch
|
||||
# 2. Copies files to the correct places
|
||||
# 3. Commits the changes
|
||||
#
|
||||
# Afterwards the developers can submit the PR to the kubeflow/manifests
|
||||
# repository, based on that local branch
|
||||
# It must be executed directly from its directory
|
||||
|
||||
# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
set -euxo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
COMMIT="2.2.0" # 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 )
|
||||
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
|
||||
|
||||
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
|
||||
|
||||
# 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 KFP repository
|
||||
mkdir -p $SRC_DIR
|
||||
cd $SRC_DIR
|
||||
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
|
||||
|
||||
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "WARNING: You have uncommitted changes"
|
||||
fi
|
||||
|
||||
echo "Copying pipelines manifests..."
|
||||
DST_DIR=$MANIFESTS_DIR/apps/pipeline/upstream
|
||||
if [ -d "$DST_DIR" ]; then
|
||||
rm -r "$DST_DIR"
|
||||
fi
|
||||
cp $SRC_DIR/pipelines/manifests/kustomize $DST_DIR -r
|
||||
|
||||
|
||||
echo "Successfully copied all manifests."
|
||||
|
||||
echo "Updating README..."
|
||||
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}"
|
||||
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script aims at helping create a PR to update the manifests of the
|
||||
# contrib/seldon repository.
|
||||
# This script:
|
||||
# 1. Checks out a new branch
|
||||
# 2. Copies files to the correct places
|
||||
# 3. Commits the changes
|
||||
#
|
||||
# Afterwards the developers can submit the PR to the kubeflow/manifests
|
||||
# repository, based on that local branch
|
||||
# It must be executed directly from its directory
|
||||
|
||||
# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
set -euxo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
COMMIT="v1.18.1" # You can use tags as well
|
||||
SRC_DIR=${SRC_DIR:=/tmp/seldon}
|
||||
BRANCH=${BRANCH:=synchronize-seldon-core-manifests-${COMMIT?}}
|
||||
UPDATE_ECHO_MODEL=false
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
|
||||
|
||||
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
|
||||
|
||||
# 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 Seldon repository
|
||||
mkdir -p $SRC_DIR
|
||||
cd $SRC_DIR
|
||||
if [ ! -d "seldon-core/.git" ]; then
|
||||
git clone https://github.com/SeldonIO/seldon-core.git
|
||||
fi
|
||||
cd $SRC_DIR/seldon-core
|
||||
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 "Updating seldon manifests..."
|
||||
DST_DIR=$MANIFESTS_DIR/contrib/seldon
|
||||
|
||||
cd $DST_DIR
|
||||
SRC_TXT="SELDON_VERSION ?= .*"
|
||||
DST_TXT="SELDON_VERSION ?= ${COMMIT:1}"
|
||||
sed -i "s|$SRC_TXT|$DST_TXT|g" ${DST_DIR}/Makefile
|
||||
# Update manifests
|
||||
SELDON_OPERATOR_CHART="$SRC_DIR/seldon-core/helm-charts/seldon-core-operator" make seldon-core-operator/base
|
||||
|
||||
echo "Successfully updated all manifests."
|
||||
|
||||
if [ "$UPDATE_ECHO_MODEL" = "true" ]; then
|
||||
echo "Updating seldonio/echo-model version..."
|
||||
SRC_TXT="seldonio/echo-model:[0-9]\+\.[0-9]\+\.[0-9]\+"
|
||||
DST_TXT="seldonio/echo-model:${COMMIT:1}"
|
||||
sed -i "s|$SRC_TXT|$DST_TXT|g" ${DST_DIR}/README.md
|
||||
sed -i "s|$SRC_TXT|$DST_TXT|g" ${DST_DIR}/example.yaml
|
||||
echo "Successfully updated seldonio/echo-model."
|
||||
fi
|
||||
|
||||
|
||||
echo "Committing the changes..."
|
||||
cd $MANIFESTS_DIR
|
||||
git add contrib/seldon
|
||||
git add README.md
|
||||
git commit -s -m "Update seldon manifests from ${COMMIT}"
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script aims at helping create a PR to update the manifests of the
|
||||
# kubeflow/training-operator repository.
|
||||
# This script:
|
||||
# 1. Checks out a new branch
|
||||
# 2. Copies files to the correct places
|
||||
# 3. Commits the changes
|
||||
#
|
||||
# Afterwards the developers can submit the PR to the kubeflow/manifests
|
||||
# repository, based on that local branch
|
||||
# It must be executed directly from its directory
|
||||
|
||||
# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
set -euxo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
COMMIT="v1.8.0" # You can use tags as well
|
||||
SRC_DIR=${SRC_DIR:=/tmp/kubeflow-training-operator}
|
||||
BRANCH=${BRANCH:=synchronize-kubeflow-training-operator-manifests-${COMMIT?}}
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
MANIFESTS_DIR=$(dirname $SCRIPT_DIR)
|
||||
|
||||
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
|
||||
|
||||
# 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 Training Operator repository
|
||||
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
|
||||
echo "WARNING: You have uncommitted changes"
|
||||
fi
|
||||
|
||||
echo "Copying training-operator manifests..."
|
||||
DST_DIR=$MANIFESTS_DIR/apps/training-operator/upstream
|
||||
if [ -d "$DST_DIR" ]; then
|
||||
rm -r "$DST_DIR"
|
||||
fi
|
||||
cp $SRC_DIR/training-operator/manifests $DST_DIR -r
|
||||
|
||||
|
||||
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}"
|
||||
@@ -0,0 +1,406 @@
|
||||
# The script:
|
||||
# 1. Extract all the images used by the Kubeflow Working Groups
|
||||
# - The reported image lists are saved in respective files under ../image_lists directory
|
||||
# 2. Scan the reported images using Trivy for security vulnerabilities
|
||||
# - Scanned reports will be saved in JSON format inside ../image_lists/security_scan_reports/ folder for each Working Group
|
||||
# 3. The script will also generate a summary of the security scan reports with severity counts for each Working Group with images
|
||||
# - Summary of security counts with images a JSON file inside ../image_lists/summary_of_severity_counts_for_WG folder
|
||||
# 4. Generate a summary of the security scan reports
|
||||
# - The summary will be saved in JSON format inside ../image_lists/summary_of_severity_counts_for_WG folder
|
||||
# 5. Before run this file you have to
|
||||
# 1. Install kustomize
|
||||
# - sudo apt install snapd
|
||||
# - sudo snap install kustomize
|
||||
# 2. Install trivy
|
||||
# - sudo apt install snapd
|
||||
# - sudo snap install trivy
|
||||
# 4. Install Python
|
||||
# 5. Install prettytable
|
||||
# - pip install prettytable
|
||||
|
||||
# The script must be executed from the hack folder as it use relative paths
|
||||
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import re
|
||||
import argparse
|
||||
import json
|
||||
import glob
|
||||
from prettytable import PrettyTable
|
||||
|
||||
# Dictionary mapping Kubeflow workgroups to directories containing kustomization files
|
||||
wg_dirs = {
|
||||
"automl": "../apps/katib/upstream/installs",
|
||||
"pipelines": "../apps/pipeline/upstream/env ../apps/kfp-tekton/upstream/env",
|
||||
"training": "../apps/training-operator/upstream/overlays",
|
||||
"manifests": "../common/cert-manager/cert-manager/base ../common/cert-manager/kubeflow-issuer/base ../common/istio-1-22/istio-crds/base ../common/istio-1-22/istio-namespace/base ../common/istio-1-22/istio-install/overlays/oauth2-proxy ../common/oidc-client/oauth2-proxy/overlays/m2m-self-signed ../common/dex/overlays/oauth2-proxy ../common/knative/knative-serving/overlays/gateways ../common/knative/knative-eventing/base ../common/istio-1-22/cluster-local-gateway/base ../common/kubeflow-namespace/base ../common/kubeflow-roles/base ../common/istio-1-22/kubeflow-istio-resources/base",
|
||||
"workbenches": "../apps/pvcviewer-controller/upstream/base ../apps/admission-webhook/upstream/overlays ../apps/centraldashboard/upstream/overlays/oauth2-proxy ../apps/jupyter/jupyter-web-app/upstream/overlays ../apps/volumes-web-app/upstream/overlays ../apps/tensorboard/tensorboards-web-app/upstream/overlays ../apps/profiles/upstream/overlays ../apps/jupyter/notebook-controller/upstream/overlays ../apps/tensorboard/tensorboard-controller/upstream/overlays",
|
||||
"serving": "../contrib/kserve - ../contrib/kserve/models-web-app/overlays/kubeflow",
|
||||
"model-registry": "../apps/model-registry/upstream",
|
||||
}
|
||||
|
||||
DIRECTORY = "../image_lists"
|
||||
os.makedirs(DIRECTORY, exist_ok=True)
|
||||
SCAN_REPORTS_DIR = os.path.join(DIRECTORY, "security_scan_reports")
|
||||
ALL_SEVERITY_COUNTS = os.path.join(DIRECTORY, "severity_counts_with_images_for_WG")
|
||||
SUMMARY_OF_SEVERITY_COUNTS = os.path.join(
|
||||
DIRECTORY, "summary_of_severity_counts_for_WG"
|
||||
)
|
||||
|
||||
os.makedirs(SCAN_REPORTS_DIR, exist_ok=True)
|
||||
os.makedirs(ALL_SEVERITY_COUNTS, exist_ok=True)
|
||||
os.makedirs(SUMMARY_OF_SEVERITY_COUNTS, exist_ok=True)
|
||||
|
||||
|
||||
def log(*args, **kwargs):
|
||||
# Custom log function that print messages with flush=True by default.
|
||||
kwargs.setdefault("flush", True)
|
||||
print(*args, **kwargs)
|
||||
|
||||
|
||||
def save_images(wg, images, version):
|
||||
# Saves a list of container images to a text file named after the workgroup and version.
|
||||
output_file = f"../image_lists/kf_{version}_{wg}_images.txt"
|
||||
with open(output_file, "w") as f:
|
||||
f.write("\n".join(images))
|
||||
log(f"File {output_file} successfully created")
|
||||
|
||||
|
||||
def validate_semantic_version(version):
|
||||
# Validates a semantic version string (e.g., "0.1.2" or "latest").
|
||||
regex = r"^[0-9]+\.[0-9]+\.[0-9]+$"
|
||||
if re.match(regex, version) or version == "latest":
|
||||
return version
|
||||
else:
|
||||
raise ValueError(f"Invalid semantic version: '{version}'")
|
||||
|
||||
|
||||
def extract_images(version):
|
||||
version = validate_semantic_version(version)
|
||||
log(f"Running the script using Kubeflow version: {version}")
|
||||
|
||||
all_images = set() # Collect all unique images across workgroups
|
||||
|
||||
for wg, dirs in wg_dirs.items():
|
||||
wg_images = set() # Collect unique images for this workgroup
|
||||
for dir_path in dirs.split():
|
||||
for root, _, files in os.walk(dir_path):
|
||||
for file in files:
|
||||
if file in [
|
||||
"kustomization.yaml",
|
||||
"kustomization.yml",
|
||||
"Kustomization",
|
||||
]:
|
||||
full_path = os.path.join(root, file)
|
||||
try:
|
||||
# Execute `kustomize build` to render the kustomization file
|
||||
result = subprocess.run(
|
||||
["kustomize", "build", root],
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
log(
|
||||
f'ERROR:\t Failed "kustomize build" command for directory: {root}. See error above'
|
||||
)
|
||||
continue
|
||||
|
||||
# Use regex to find lines with 'image: <image-name>:<version>' or 'image: <image-name>'
|
||||
# and '- image: <image-name>:<version>' but avoid environment variables
|
||||
kustomize_images = re.findall(
|
||||
r"^\s*-?\s*image:\s*([^$\s:]+(?:\:[^\s]+)?)$",
|
||||
result.stdout,
|
||||
re.MULTILINE,
|
||||
)
|
||||
wg_images.update(kustomize_images)
|
||||
|
||||
# Ensure uniqueness within workgroup images
|
||||
uniq_wg_images = sorted(wg_images)
|
||||
all_images.update(uniq_wg_images)
|
||||
save_images(wg, uniq_wg_images, version)
|
||||
|
||||
# Ensure uniqueness across all workgroups
|
||||
uniq_images = sorted(all_images)
|
||||
save_images("all", uniq_images, version)
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Extract images from Kubeflow kustomizations."
|
||||
)
|
||||
# Define a positional argument 'version' with optional occurrence and default value 'latest'. You can run this file as python3 <filename>.py or python <filename>.py <version>
|
||||
parser.add_argument(
|
||||
"version",
|
||||
nargs="?",
|
||||
type=str,
|
||||
default="latest",
|
||||
help="Kubeflow version to use (defaults to latest).",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
extract_images(args.version)
|
||||
|
||||
|
||||
log("Started scanning images")
|
||||
|
||||
# Get list of text files excluding "kf_latest_all_images.txt"
|
||||
files = [
|
||||
f
|
||||
for f in glob.glob(os.path.join(DIRECTORY, "*.txt"))
|
||||
if not f.endswith("kf_latest_all_images.txt")
|
||||
]
|
||||
|
||||
# Loop through each text file in the specified directory
|
||||
for file in files:
|
||||
log(f"Scanning images in {file}")
|
||||
|
||||
file_base_name = os.path.basename(file).replace(".txt", "")
|
||||
|
||||
# Directory to save reports for this specific file
|
||||
file_reports_dir = os.path.join(SCAN_REPORTS_DIR, file_base_name)
|
||||
os.makedirs(file_reports_dir, exist_ok=True)
|
||||
|
||||
# Directory to save security count
|
||||
severity_count = os.path.join(file_reports_dir, "severity_counts")
|
||||
os.makedirs(severity_count, exist_ok=True)
|
||||
|
||||
with open(file, "r") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
image_name = line.split(":")[0]
|
||||
image_tag = line.split(":")[1] if ":" in line else ""
|
||||
|
||||
image_name_scan = image_name.split("/")[-1]
|
||||
|
||||
if image_tag:
|
||||
image_name_scan = f"{image_name_scan}_{image_tag}"
|
||||
|
||||
scan_output_file = os.path.join(
|
||||
file_reports_dir, f"{image_name_scan}_scan.json"
|
||||
)
|
||||
|
||||
log(f"Scanning ", line)
|
||||
|
||||
try:
|
||||
result = subprocess.run(
|
||||
[
|
||||
"trivy",
|
||||
"image",
|
||||
"--format",
|
||||
"json",
|
||||
"--output",
|
||||
scan_output_file,
|
||||
line,
|
||||
],
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
|
||||
with open(scan_output_file, "r") as json_file:
|
||||
scan_data = json.load(json_file)
|
||||
|
||||
if not scan_data.get("Results"):
|
||||
log(f"No vulnerabilities found in {image_name}:{image_tag}")
|
||||
else:
|
||||
vulnerabilities_list = [
|
||||
result["Vulnerabilities"]
|
||||
for result in scan_data["Results"]
|
||||
if "Vulnerabilities" in result and result["Vulnerabilities"]
|
||||
]
|
||||
|
||||
if not vulnerabilities_list:
|
||||
log(
|
||||
f"The vulnerabilities detection may be insufficient because security updates are not provided for {image_name}:{image_tag}\n"
|
||||
)
|
||||
else:
|
||||
severity_counts = {"LOW": 0, "MEDIUM": 0, "HIGH": 0, "CRITICAL": 0}
|
||||
for vulnerabilities in vulnerabilities_list:
|
||||
for vulnerability in vulnerabilities:
|
||||
severity = vulnerability.get("Severity", "UNKNOWN")
|
||||
if severity == "UNKNOWN":
|
||||
continue
|
||||
elif severity in severity_counts:
|
||||
severity_counts[severity] += 1
|
||||
|
||||
report = {"image": line, "severity_counts": severity_counts}
|
||||
|
||||
image_table = PrettyTable()
|
||||
image_table.field_names = ["Critical", "High", "Medium", "Low"]
|
||||
image_table.add_row(
|
||||
[
|
||||
severity_counts["CRITICAL"],
|
||||
severity_counts["HIGH"],
|
||||
severity_counts["MEDIUM"],
|
||||
severity_counts["LOW"],
|
||||
]
|
||||
)
|
||||
log(f"{image_table}\n")
|
||||
|
||||
severity_report_file = os.path.join(
|
||||
severity_count, f"{image_name_scan}_severity_report.json"
|
||||
)
|
||||
with open(severity_report_file, "w") as report_file:
|
||||
json.dump(report, report_file, indent=4)
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
log(f"Error scanning {image_name}:{image_tag}")
|
||||
log(e.stderr)
|
||||
|
||||
# Combine all the JSON files into a single file with severity counts for all images
|
||||
json_files = glob.glob(os.path.join(severity_count, "*.json"))
|
||||
|
||||
output_file = os.path.join(ALL_SEVERITY_COUNTS, f"{file_base_name}.json")
|
||||
|
||||
if not json_files:
|
||||
log(f"No JSON files found in '{severity_count}'. Skipping combination.")
|
||||
else:
|
||||
combined_data = []
|
||||
for json_file in json_files:
|
||||
with open(json_file, "r") as jf:
|
||||
combined_data.append(json.load(jf))
|
||||
|
||||
with open(output_file, "w") as of:
|
||||
json.dump({"data": combined_data}, of, indent=4)
|
||||
|
||||
log(f"JSON files successfully combined into '{output_file}'")
|
||||
|
||||
# File to save summary of the severity counts for WGs as JSON format.
|
||||
summary_file = os.path.join(
|
||||
SUMMARY_OF_SEVERITY_COUNTS, "severity_summary_in_json_format.json"
|
||||
)
|
||||
|
||||
# Initialize counters
|
||||
total_images = 0
|
||||
total_low = 0
|
||||
total_medium = 0
|
||||
total_high = 0
|
||||
total_critical = 0
|
||||
|
||||
# Initialize a dictionary to hold the final JSON data
|
||||
merged_data = {}
|
||||
|
||||
# Loop through each JSON file in the ALL_SEVERITY_COUNTS
|
||||
for file_path in glob.glob(os.path.join(ALL_SEVERITY_COUNTS, "*.json")):
|
||||
# Split filename based on underscores
|
||||
filename_parts = os.path.basename(file_path).split("_")
|
||||
|
||||
# Check if there are at least 3 parts (prefix, name, _images)
|
||||
if len(filename_parts) >= 4:
|
||||
# Extract name (second part)
|
||||
filename = filename_parts[2]
|
||||
filename = filename.capitalize()
|
||||
|
||||
else:
|
||||
log(f"Skipping invalid filename format: {file_path}")
|
||||
continue
|
||||
|
||||
with open(file_path, "r") as f:
|
||||
data = json.load(f)["data"]
|
||||
|
||||
# Initialize counts for this file
|
||||
image_count = len(data)
|
||||
low = sum(entry["severity_counts"]["LOW"] for entry in data)
|
||||
medium = sum(entry["severity_counts"]["MEDIUM"] for entry in data)
|
||||
high = sum(entry["severity_counts"]["HIGH"] for entry in data)
|
||||
critical = sum(entry["severity_counts"]["CRITICAL"] for entry in data)
|
||||
|
||||
# Update the total counts
|
||||
total_images += image_count
|
||||
total_low += low
|
||||
total_medium += medium
|
||||
total_high += high
|
||||
total_critical += critical
|
||||
|
||||
# Create the output for this file
|
||||
file_data = {
|
||||
"images": image_count,
|
||||
"LOW": low,
|
||||
"MEDIUM": medium,
|
||||
"HIGH": high,
|
||||
"CRITICAL": critical,
|
||||
}
|
||||
|
||||
# Update merged_data with filename as key
|
||||
merged_data[filename] = file_data
|
||||
|
||||
# Add total counts to merged_data
|
||||
merged_data["total"] = {
|
||||
"images": total_images,
|
||||
"LOW": total_low,
|
||||
"MEDIUM": total_medium,
|
||||
"HIGH": total_high,
|
||||
"CRITICAL": total_critical,
|
||||
}
|
||||
|
||||
|
||||
log("Summary in Json Format:")
|
||||
log(json.dumps(merged_data, indent=4))
|
||||
|
||||
|
||||
# Write the final output to a file
|
||||
with open(summary_file, "w") as summary_f:
|
||||
json.dump(merged_data, summary_f, indent=4)
|
||||
|
||||
log(f"Summary written to: {summary_file} as JSON format")
|
||||
|
||||
# Load JSON content from the file
|
||||
with open(summary_file, "r") as file:
|
||||
data = json.load(file)
|
||||
|
||||
# Define a mapping for working group names
|
||||
groupnames = {
|
||||
"Automl": "AutoML",
|
||||
"Pipelines": "Pipelines",
|
||||
"Workbenches": "Workbenches(Notebooks)",
|
||||
"Serving": "Kserve",
|
||||
"Manifests": "Manifests",
|
||||
"Training": "Training",
|
||||
"Model-registry": "Model Registry",
|
||||
"total": "All Images",
|
||||
}
|
||||
|
||||
# Create PrettyTable
|
||||
table = PrettyTable()
|
||||
table.field_names = [
|
||||
"Working Group",
|
||||
"Images",
|
||||
"Critical CVE",
|
||||
"High CVE",
|
||||
"Medium CVE",
|
||||
"Low CVE",
|
||||
]
|
||||
|
||||
# Populate the table with data
|
||||
for group_name in groupnames:
|
||||
if group_name in data: # Check if group_name exists in data
|
||||
value = data[group_name]
|
||||
table.add_row(
|
||||
[
|
||||
groupnames[group_name],
|
||||
value["images"],
|
||||
value["CRITICAL"],
|
||||
value["HIGH"],
|
||||
value["MEDIUM"],
|
||||
value["LOW"],
|
||||
]
|
||||
)
|
||||
|
||||
# log the table
|
||||
log(table)
|
||||
|
||||
|
||||
# Write the table output to a file in the specified folder
|
||||
output_file = (
|
||||
SUMMARY_OF_SEVERITY_COUNTS + "/summary_of_severity_counts_for_WGs_in_table.txt"
|
||||
)
|
||||
with open(output_file, "w") as f:
|
||||
f.write(str(table))
|
||||
|
||||
log("Output saved to:", output_file)
|
||||
log("Severity counts with images respect to WGs are saved in the",ALL_SEVERITY_COUNTS)
|
||||
log("Scanned Json reports on images are saved in",SCAN_REPORTS_DIR)
|
||||
Reference in New Issue
Block a user