diff --git a/docker/owlbot/nodejs_mono_repo/build-dev.sh b/docker/owlbot/nodejs_mono_repo/build-dev.sh new file mode 100755 index 000000000..5e5700eac --- /dev/null +++ b/docker/owlbot/nodejs_mono_repo/build-dev.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright 2026 Google LLC +# +# 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 +# +# https://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. + +# File for local development of the Docker image. This is not intended to be used in CI, but can be used to test changes to the Dockerfile and entrypoint script. +set -e + +# Get the directory of the script +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +# Navigate to the root of the synthtool repo +cd "$DIR/../../.." + +echo "Preparing post-processor-changes.txt..." +# Generate post-processor-changes.txt as expected by some Dockerfiles/CI +git log -1 --format="%B%n%nSource-Link: https://github.com/googleapis/synthtool/commit/%H" > post-processor-changes.txt && +sed -i "s/([^()]*)$//g" post-processor-changes.txt && +sed -i "s/^\(feat\|fix\)/chore/g" post-processor-changes.txt && +sed -i "s/\!:/:/g" post-processor-changes.txt + +echo "Building owlbot-nodejs-mono-repo..." +docker build -t owlbot-nodejs-mono-repo -f docker/owlbot/nodejs_mono_repo/Dockerfile . + +# Cleanup temporary file +rm post-processor-changes.txt + +echo "" +echo "Successfully built owlbot-nodejs-mono-repo" +echo "To run it against a local repository, use:" +echo " docker run --rm -v \$(pwd):/workspace -w /workspace owlbot-nodejs-mono-repo [RELATIVE_DIRS]" diff --git a/synthtool/languages/node_mono_repo.py b/synthtool/languages/node_mono_repo.py index 4232a4bb0..a545addf6 100644 --- a/synthtool/languages/node_mono_repo.py +++ b/synthtool/languages/node_mono_repo.py @@ -27,7 +27,6 @@ from synthtool.languages import common from datetime import date import logging -from os import system from synthtool import _tracked_paths from synthtool import gcp @@ -641,7 +640,7 @@ def owlbot_entrypoint( for dir in specified_owlbot_dirs: owlbot_py_file_path = hasOwlBotPy(dir) if owlbot_py_file_path: - system(f"python3 {owlbot_py_file_path}") + subprocess.run(["python3", str(owlbot_py_file_path)], check=True) else: owlbot_main( dir, @@ -657,7 +656,7 @@ def owlbot_entrypoint( for dir in owlbot_dirs: owlbot_py_file_path = hasOwlBotPy(dir) if owlbot_py_file_path: - system(f"python3 {owlbot_py_file_path}") + subprocess.run(["python3", str(owlbot_py_file_path)], check=True) else: owlbot_main( dir,