mirror of
https://github.com/google/nomulus.git
synced 2025-04-29 11:37:51 +02:00
* Cover more base in forbidden SQL change check Update the forbidden SQL change detection script to include file deletion and renaming as well as edits.
43 lines
1.5 KiB
Text
43 lines
1.5 KiB
Text
# Copyright 2020 The Nomulus Authors. All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
# This file declares shell functions used by other scripts in this folder.
|
|
|
|
# Fetch the tag of the currently deployed release of Nomulus server
|
|
# or SQL schema. The caller is responsible for fetching relevant git
|
|
# tags to the local repo.
|
|
function fetchVersion() {
|
|
local deployed_system=${1}
|
|
local env=${2}
|
|
local dev_project=${3}
|
|
echo $(gsutil cat \
|
|
gs://${dev_project}-deployed-tags/${deployed_system}.${env}.tag)
|
|
}
|
|
|
|
function getChangeCountSinceVersion() {
|
|
local deployed_system=${1}
|
|
local version=${2}
|
|
local changes
|
|
|
|
if [[ ${deployed_system} == "sql " ]]; then
|
|
changes=$(git diff --name-only ${version} \
|
|
db/src/main/resources/sql/flyway | wc -l)
|
|
else
|
|
changes=$(git diff --name-only ${version} \
|
|
core/src/main/resources/META-INF \
|
|
core/src/main/java/google/registry/persistence \
|
|
db/src/main/resources/sql/schema/db-schema.sql.generated | wc -l)
|
|
fi
|
|
echo ${changes}
|
|
}
|