Skip to content

Commit 57941be

Browse files
build: change migration script to support folder path for packages (#6992)
* build: change migration script to support folder path for packages * build: remove changes in system-test and samples test && use correct path for directory * chore: add handwritten folder in conditional_test script
1 parent 2d11940 commit 57941be

5 files changed

Lines changed: 9 additions & 21 deletions

File tree

bin/delete-everything-split-repo.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fi
2323

2424
# repo name (e.g. nodejs-asset)
2525
SPLIT_REPO=$1
26-
# destination directory (e.g. google-cloud-asset)
26+
# destination directory (e.g. packages/google-cloud-asset)
2727
ARTIFACT_NAME=$2
2828

2929
rm -rf "/tmp/${SPLIT_REPO}"
@@ -154,7 +154,7 @@ chmod u+x "/tmp/${SPLIT_REPO}/.kokoro/system-test.sh"
154154
README_MD="/tmp/${SPLIT_REPO}/README.md"
155155

156156
README_CONTENT=$(cat $README_MD)
157-
echo -e "**_THIS REPOSITORY IS DEPRECATED. ALL OF ITS CONTENT AND HISTORY HAS BEEN MOVED TO [GOOGLE-CLOUD-NODE](https://github.com/googleapis/google-cloud-node/tree/main/packages/${ARTIFACT_NAME})_**\n\n$README_CONTENT" > "$README_MD"
157+
echo -e "**_THIS REPOSITORY IS DEPRECATED. ALL OF ITS CONTENT AND HISTORY HAS BEEN MOVED TO [GOOGLE-CLOUD-NODE](https://github.com/googleapis/google-cloud-node/tree/main/${ARTIFACT_NAME})_**\n\n$README_CONTENT" > "$README_MD"
158158

159159
git add .
160160
git commit -m 'build: update README for deprecation notice and delete all files except samples'

bin/migrate-git-history.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ git merge --allow-unrelated-histories migration/main --no-edit
130130

131131
if [[ ! -z "${UPDATE_SCRIPT}" ]]
132132
then
133-
bash "${UPDATE_SCRIPT}"
133+
bash "${UPDATE_SCRIPT}" "${PACKAGE_PATH}"
134134
fi
135135

136136
git push -u origin "${BRANCH}" --force

bin/migrate-split-repo.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ fi
2323

2424
# repo name (e.g. nodejs-asset)
2525
SPLIT_REPO=$1
26-
# destination directory (e.g. google-cloud-asset)
27-
ARTIFACT_NAME=$2
28-
26+
# destination directory (e.g. packages/google-cloud-asset)
27+
export PACKAGE_PATH="$2"
28+
2929
## Get the directory of the build script
3030
SCRIPT_DIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))
3131

3232
export UPDATE_SCRIPT="${SCRIPT_DIR}/split-repo-post-process.sh"
33-
export PACKAGE_PATH="packages/${ARTIFACT_NAME}"
34-
3533
# run the migrate script, remove .kokoro and .github folders
3634
# keep the .github/.OwlBot.yaml config
3735
${SCRIPT_DIR}/migrate-git-history.sh \

bin/split-repo-post-process.sh

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,14 @@ then
6969
mv "${PACKAGE_PATH}/.repo-metadata2.json" "${PACKAGE_PATH}/.repo-metadata.json"
7070
fi
7171

72-
# update system tests scripts
73-
echo "adding compile step to system-test"
74-
# using a temp file because jq doesn't like writing to the input file as it reads
75-
jq -r ".scripts[\"system-test\"] = \"npm run compile && c8 mocha build/system-test\"" ${PACKAGE_PATH}/package.json > ${PACKAGE_PATH}/package2.json
76-
mv ${PACKAGE_PATH}/package2.json ${PACKAGE_PATH}/package.json
77-
78-
echo "adding compile step to samples-test"
79-
# using a temp file because jq doesn't like writing to the input file as it reads
80-
jq -r ".scripts[\"samples-test\"] = \"npm run compile && cd samples/ && npm link ../ && npm i && npm test\"" ${PACKAGE_PATH}/package.json > ${PACKAGE_PATH}/package2.json
81-
mv ${PACKAGE_PATH}/package2.json ${PACKAGE_PATH}/package.json
82-
8372
echo "updating repository object type"
8473
# using a temp file because jq doesn't like writing to the input file as it reads
85-
jq -r ".repository = {\"type\": \"git\", \"directory\": \"packages/${PACKAGE_NAME}\", \"url\": \"https://github.com/googleapis/google-cloud-node.git\"}" ${PACKAGE_PATH}/package.json > ${PACKAGE_PATH}/package2.json
74+
jq -r ".repository = {\"type\": \"git\", \"directory\": \"${PACKAGE_PATH}\", \"url\": \"https://github.com/googleapis/google-cloud-node.git\"}" ${PACKAGE_PATH}/package.json > ${PACKAGE_PATH}/package2.json
8675
mv ${PACKAGE_PATH}/package2.json ${PACKAGE_PATH}/package.json
8776

8877
echo "updating homepage"
8978
# using a temp file because jq doesn't like writing to the input file as it reads
90-
jq -r ".homepage = \"https://github.com/googleapis/google-cloud-node/tree/main/packages/${PACKAGE_NAME}\"" ${PACKAGE_PATH}/package.json > ${PACKAGE_PATH}/package2.json
79+
jq -r ".homepage = \"https://github.com/googleapis/google-cloud-node/tree/main/${PACKAGE_PATH}\"" ${PACKAGE_PATH}/package.json > ${PACKAGE_PATH}/package2.json
9180
mv ${PACKAGE_PATH}/package2.json ${PACKAGE_PATH}/package.json
9281

9382
if !(test -f "${PACKAGE_PATH}/owlbot.py"); then

ci/run_conditional_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ fi
7373
subdirs=(
7474
containers
7575
packages
76+
handwritten
7677
.github/scripts
7778
)
7879

0 commit comments

Comments
 (0)