summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2024-04-10 15:46:48 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2024-04-15 09:33:14 +0000
commit8e851c548eb78e89e407908cd3b6ce96f3e94533 (patch)
tree28e69f7883b97ebc9480cff15a0765c1997bda49
parent10c8b9c036e0c915519274c2b0a6e0c7a11748d6 (diff)
pw-*.sh: Require less $pw_token
We now need patchwork token only to submit "checks", which is done via glibc-cicd/check.py. This is initialized in pw-apply.sh, and then used transparently in pw-report.sh. Therefore, only pw-apply.sh needs to be passed "__pw_token TOKEN". Change-Id: I512d680e771ac01777931a9c7e489e8fbff16b73
-rwxr-xr-xpw-apply.sh26
-rwxr-xr-xpw-helpers.sh11
-rwxr-xr-xpw-report.sh16
-rwxr-xr-xpw-trigger.sh7
4 files changed, 17 insertions, 43 deletions
diff --git a/pw-apply.sh b/pw-apply.sh
index 6c9be79f..a7bbc974 100755
--- a/pw-apply.sh
+++ b/pw-apply.sh
@@ -36,10 +36,9 @@ rev=$(get_baseline_git "${project}_rev")
echo "Fetching baseline $url#$rev"
clone_or_update_repo "$project" "$rev" "$url" > /dev/null
-# BE CAREFUL WITH $pw_token
# shellcheck disable=SC2064
trap "pw_deinit $project" EXIT
-(set +x; pw_init "$project" "$pw_token")
+pw_init "$project"
if ! pw_series_complete_p "$project" "$series_id"; then
echo "ERROR: Series $series_id is not complete"
@@ -73,10 +72,10 @@ fi
clone_or_update_repo glibc-cicd main \
https://gitlab.com/djdelorie/glibc-cicd.git > /dev/null
-# BE CAREFUL WITH $pw_token
-set +x;
pw_check_cmd=(glibc-cicd/check.py --patch_id "$patch_id"
--context "$ci_bot")
+# BE CAREFUL WITH $pw_token
+set +x;
if [ "$pw_token" != "" ]; then
cat >> glibc-cicd/cicd-config.py <<EOF
@@ -112,11 +111,7 @@ EOF
pw_deinit "$project"
trap "" EXIT
-(
- set +x
- $scripts/pw-report.sh --check triggered --result pass --pw_dir "$pw_dir" \
- __pw_token "$pw_token"
-)
+$scripts/pw-report.sh --check triggered --result pass --pw_dir "$pw_dir"
prev_head=$(git -C "$project" rev-parse HEAD)
@@ -132,11 +127,8 @@ if [ "$patches_applied" -le "$num_patch" ]; then
apply_result="merged"
fi
- (
- set +x
- $scripts/pw-report.sh --check apply --result "$apply_result" \
- --pw_dir "$pw_dir" __pw_token "$pw_token"
- )
+ $scripts/pw-report.sh --check apply --result "$apply_result" \
+ --pw_dir "$pw_dir"
if [ $res != 0 ]; then
exit $res
@@ -162,8 +154,4 @@ git -C "$project" checkout --detach HEAD~$num_patch
done
)
-(
- set +x
- $scripts/pw-report.sh --check apply --result pass --pw_dir "$pw_dir" \
- __pw_token "$pw_token"
-)
+$scripts/pw-report.sh --check apply --result pass --pw_dir "$pw_dir"
diff --git a/pw-helpers.sh b/pw-helpers.sh
index c2d57802..5f081c09 100755
--- a/pw-helpers.sh
+++ b/pw-helpers.sh
@@ -35,7 +35,6 @@
# Initialize git-pw in $project.
# $1 -- existing git clone of $project
-# $2 -- PW API token; without it modifications fail
pw_init ()
{
(
@@ -47,13 +46,6 @@ pw_init ()
git -C "$project" config pw.project "$project"
pw_clear_cache
-
- # BE CAREFUL WITH $token
- set +x
- local token="$2"
- if [ "$token" != "" ]; then
- git -C "$project" config pw.token "$token"
- fi
)
}
@@ -66,9 +58,6 @@ pw_deinit ()
local project="$1"
rm -rf "/tmp/pw-yaml-cache-$$"
-
- # ignore error if pw.token is not set.
- git -C "$project" config --unset pw.token || true
)
}
diff --git a/pw-report.sh b/pw-report.sh
index 7b3d462e..e8e6c0c3 100755
--- a/pw-report.sh
+++ b/pw-report.sh
@@ -10,11 +10,15 @@ scripts=$(dirname $0)
convert_args_to_variables "$@"
-obligatory_variables check result pw_dir pw_token
-declare check result pw_dir pw_token
+obligatory_variables check result pw_dir
+declare check result pw_dir
verbose="${verbose-true}"
+if $verbose; then
+ set -x
+fi
+
if ! [ -d "$pw_dir" ]; then
exit 0
fi
@@ -28,15 +32,9 @@ while IFS= read -r -d '' pw_file; do
project="${pw[project]}"
build_url="${pw[${project}_build_url]}"
- # BE CAREFUL WITH $pw_token
- set +x
# shellcheck disable=SC2064
trap "pw_deinit $project" EXIT
- pw_init "$project" "$pw_token"
-
- if $verbose; then
- set -x
- fi
+ pw_init "$project"
case "$check-$result" in
triggered-*)
diff --git a/pw-trigger.sh b/pw-trigger.sh
index bddf3753..3d91deee 100755
--- a/pw-trigger.sh
+++ b/pw-trigger.sh
@@ -10,8 +10,8 @@ scripts=$(dirname $0)
convert_args_to_variables "$@"
-obligatory_variables ci_bot project pw_token out_dir
-declare ci_bot project pw_token out_dir
+obligatory_variables ci_bot project out_dir
+declare ci_bot project out_dir
verbose="${verbose-true}"
@@ -42,10 +42,9 @@ print_prereq_bots ()
)
}
-# BE CAREFUL WITH $pw_token
# shellcheck disable=SC2064
trap "pw_deinit $project" EXIT
-(set +x; pw_init "$project" "$pw_token")
+pw_init "$project"
yaml=$(mktemp)
# shellcheck disable=SC2064