From 36ac7defcb3f51c953aa96ca5eeab30026c4683f Mon Sep 17 00:00:00 2001 From: James Liu <37026441+zijianjoy@users.noreply.github.com> Date: Fri, 27 Aug 2021 16:49:22 -0700 Subject: [PATCH] chore(third_party): Add a script to update MLMD. (#6454) * chore(third_party): Add a script to update MLMD * address comments --- third_party/ml-metadata/README.md | 23 +++++++++++++++ third_party/ml-metadata/VERSION | 1 + third_party/ml-metadata/update_version.sh | 36 +++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 third_party/ml-metadata/VERSION create mode 100755 third_party/ml-metadata/update_version.sh diff --git a/third_party/ml-metadata/README.md b/third_party/ml-metadata/README.md index 49dcae6d3c8..e4daa4b2ee4 100644 --- a/third_party/ml-metadata/README.md +++ b/third_party/ml-metadata/README.md @@ -2,12 +2,35 @@ Upstream repo location: . +## Upgrade MLMD versions + +First change the MLMD version in VERSION file in current folder, for example: $VERSION=1.2.0. + +``` +echo -n "\$VERSION" > VERSION +``` + +Run the `update_version.sh` script in current folder to update related image references: + +``` +./update_version.sh +``` + +Run update_dependencies.sh in the following way: + +``` +../../hack/update-all-requirements.sh +``` + +Make sure the generated files are as expected. Update clients as described below: + ## Build golang gRPC client from proto * [MLMD proto definitions](https://github.com/google/ml-metadata/tree/master/ml_metadata/proto) * [grpc go quickstart](https://grpc.io/docs/languages/go/quickstart/) * [client example code](https://github.com/grpc/grpc-go/blob/master/examples/helloworld/greeter_client/main.go) + ## Build JS client from proto Refer to [frontend/README.md](frontend/README.md) for `npm run build:replace` command. diff --git a/third_party/ml-metadata/VERSION b/third_party/ml-metadata/VERSION new file mode 100644 index 00000000000..867e52437ab --- /dev/null +++ b/third_party/ml-metadata/VERSION @@ -0,0 +1 @@ +1.2.0 \ No newline at end of file diff --git a/third_party/ml-metadata/update_version.sh b/third_party/ml-metadata/update_version.sh new file mode 100755 index 00000000000..8a808aacfc7 --- /dev/null +++ b/third_party/ml-metadata/update_version.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e + +echo "Usage: update kubeflow/pipelines/third_party/ml-metadata/VERSION to new MLMD version tag by" +echo '`echo -n "\$VERSION" > VERSION` first, then run this script.' +echo "Please use the above command to make sure the file doesn't have extra" +echo "line endings." +echo "MLMD version page: https://github.com/google/ml-metadata/releases" + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)" +TAG_NAME="$(cat $DIR/VERSION)" +REPO_ROOT="$DIR/../.." + +cd $REPO_ROOT +echo $PWD +echo $TAG_NAME + +image_files=( "$REPO_ROOT/.cloudbuild.yaml" \ + "$REPO_ROOT/.release.cloudbuild.yaml" \ + "$REPO_ROOT/manifests/kustomize/base/metadata/base/metadata-grpc-deployment.yaml" \ + "$REPO_ROOT/test/tag_for_hosted.sh" \ + "$REPO_ROOT/v2/Makefile" \ + ) +for i in "${image_files[@]}" +do + echo "Replacing $i" + sed -i.bak -r "s/gcr.io\/tfx-oss-public\/ml_metadata_store_server\:[0-9.-a-z]+/gcr.io\/tfx-oss-public\/ml_metadata_store_server\:$TAG_NAME/g" "$i" +done + +requirement_files=( "$REPO_ROOT/backend/metadata_writer/requirements.in" ) +for i in "${requirement_files[@]}" +do + echo "Replacing $i" + sed -i.bak -r "s/ml-metadata==[0-9.-a-z]+/ml-metadata==$TAG_NAME/g" "$i" +done