tf-sync-github-repos.yaml: sync up repos on new tag creation
Sync up repos when a new tag is created [1]
[1]: https://linaro.atlassian.net/browse/TFC-628
Signed-off-by: Arthur She <arthur.she@linaro.org>
Change-Id: I1ae3997b78192b06a76cece987c037d3bb3664d0
diff --git a/ci/tf-sync-repos.sh b/ci/tf-sync-repos.sh
index 011af75..3005a57 100755
--- a/ci/tf-sync-repos.sh
+++ b/ci/tf-sync-repos.sh
@@ -78,11 +78,18 @@
gerrit_branch=$(echo ${branch} | awk -F: '{print $1}')
gh_branch=$(echo ${branch} | awk -F: '{print $2}')
- # Only sync up the branch that triggered the job
- [ "${gerrit_branch}" != "${GERRIT_REFNAME}" ] && continue
+ # Only sync up the branch that triggered the job or new tag creatation
+ if $(echo ${GERRIT_REFNAME}|grep -q "refs\/tags"); then
+ new_tag=1
+ elif [ "${gerrit_branch}" != "${GERRIT_REFNAME}" ]; then
+ continue
+ fi
echo -e "\nFetching Gerrit ${GERRIT_PROJECT}:${gerrit_branch}\n"
git -C "${_workdir}" fetch --tags "${gerrit_repo}" "${gerrit_branch}"
echo -e "\nSyncing up to GitHub ${gh_repo}:${gh_branch}\n"
git -C "${_workdir}" push --force --tags "${gh_remote}" FETCH_HEAD:refs/heads/"${gh_branch}"
+
+ # Triggered by new tag, no need to loop other branches
+ [ "$new_tag" == "1" ] && break
done
diff --git a/tf-sync-github-repos.yaml b/tf-sync-github-repos.yaml
index 292749c..3bdad6e 100644
--- a/tf-sync-github-repos.yaml
+++ b/tf-sync-github-repos.yaml
@@ -32,81 +32,113 @@
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: TF-A/tf-a-tests
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: ci/tf-a-ci-scripts
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: TF-M/trusted-firmware-m
branches:
- branch-compare-type: PLAIN
branch-pattern: main
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: TF-M/tf-m-tests
branches:
- branch-compare-type: PLAIN
branch-pattern: main
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: TF-M/tf-m-tools
branches:
- branch-compare-type: PLAIN
branch-pattern: main
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: TF-M/tf-m-extras
branches:
- branch-compare-type: PLAIN
branch-pattern: main
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: hafnium/hafnium
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: hafnium/driver/linux
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: hafnium/prebuilts
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: hafnium/project/reference
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: hafnium/third_party/dtc
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: hafnium/third_party/googletest
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: hafnium/third_party/linux
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: ci/hafnium-job-configs
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: ci/hafnium-ci-scripts
branches:
- branch-compare-type: PLAIN
branch-pattern: master
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
- project-compare-type: PLAIN
project-pattern: TS/trusted-services
branches:
@@ -114,6 +146,8 @@
branch-pattern: main
- branch-compare-type: PLAIN
branch-pattern: integration
+ - branch-compare-type: REG_EXP
+ branch-pattern: refs/tags/.*
silent-start: true
wrappers:
- credentials-binding: