From a3aa2ee2d8588ef2c9c265cb89a41ee68a5b0897 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 19 May 2023 22:26:18 -0400 Subject: [PATCH] build: migrate release scripts (#1799) (#1347) * build: migrate release scripts (#1799) Source-Link: https://github.com/googleapis/synthtool/commit/1fd6dff029bb3d873a4780e616388f802f086907 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:ad9cabee4c022f1aab04a71332369e0c23841062124818a4490f73337f790337 * build: only append common_env_vars if it doesn't exist --------- Co-authored-by: Owl Bot Co-authored-by: Jeff Ching --- .github/.OwlBot.lock.yaml | 2 +- .github/release-trigger.yml | 1 + .kokoro/release/common.cfg | 20 ++++++++++++++++++++ owlbot.py | 25 +++++++++++++++---------- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 35478afe3..aadf54f64 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:8dd8395defb6a5069b0b10c435058bf13980606ba1967e2b3925ed50fc3cb22f + digest: sha256:ad9cabee4c022f1aab04a71332369e0c23841062124818a4490f73337f790337 diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml index d4ca94189..243949edf 100644 --- a/.github/release-trigger.yml +++ b/.github/release-trigger.yml @@ -1 +1,2 @@ enabled: true +multiScmName: java-logging diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index e2f0e0912..5d6ed62e1 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -67,3 +67,23 @@ env_vars: { ################################################### + + +############################################# +# this section merged from .kokoro/common_env_vars.cfg using owlbot.py + +env_vars: { + key: "PRODUCT_AREA_LABEL" + value: "observability" +} +env_vars: { + key: "PRODUCT_LABEL" + value: "logging" +} +env_vars: { + key: "LANGUAGE_LABEL" + value: "java" +} + +################################################### + diff --git a/owlbot.py b/owlbot.py index dfc30a362..073dec6be 100644 --- a/owlbot.py +++ b/owlbot.py @@ -100,20 +100,25 @@ # Modify test configs # -------------------------------------------------------------------------- -# add shared environment variables to test configs -s.move( - ".kokoro/common_env_vars.cfg", - ".kokoro/common.cfg", - merge=lambda src, dst, _, : f"{dst}\n{src}", +def _append_if_not_contained(src: str, dest: str, file: str): + if src in dest: + return dest + return f"{dest}\n{src}" + +def append_new_content(src: str, dest: str): + # add shared environment variables to test configs + s.move( + src, + dest, + merge=_append_if_not_contained, ) + +append_new_content(".kokoro/common_env_vars.cfg", ".kokoro/common.cfg") + tracked_subdirs = ["continuous", "presubmit", "release", "nightly"] for subdir in tracked_subdirs: for path, subdirs, files in os.walk(f".kokoro/{subdir}"): for name in files: if name == "common.cfg": file_path = os.path.join(path, name) - s.move( - ".kokoro/common_env_vars.cfg", - file_path, - merge=lambda src, dst, _, : f"{dst}\n{src}", - ) + append_new_content(".kokoro/common_env_vars.cfg", file_path) \ No newline at end of file