Merge ~alextu/plainbox-provider-pc-sanity:checkbox-remote-need-specific-out-folder into plainbox-provider-pc-sanity:master

Proposed by Alex Tu
Status: Merged
Merged at revision: 3d313ef4861c417b874f47c0d15c5dd5cc168418
Proposed branch: ~alextu/plainbox-provider-pc-sanity:checkbox-remote-need-specific-out-folder
Merge into: plainbox-provider-pc-sanity:master
Diff against target: 77 lines (+31/-4)
2 files modified
bin/screen-pkg-not-public.sh (+30/-3)
units/pc-sanity/pc-sanity-screen-oem-gaps.pxu (+1/-1)
Reviewer Review Type Date Requested Status
jeremyszu (community) Needs Fixing
Yuan-Chen Cheng Pending
OEM Solutions Group: Engineers Pending
Review via email: mp+395899@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alex Tu (alextu) wrote :

checkbox remote reject test cases writing any file in $PWD, so I moved out file to shared session folder instead.

Revision history for this message
Alex Tu (alextu) wrote :

╰─>bats test/test-screen-pkg-not-public.bats
 ✓ run_main() reflect the JOB_STATUS
 ✓ allow pkgs came from ubuntu archive
 ✓ screen out pkgs we hacked
 ✓ screen out pkgs only in unexpected archive.
 ✓ screen out pkgs not in any archive.
 ✓ screen out pkgs only on oem archive.

6 tests, 0 failures

Revision history for this message
Alex Tu (alextu) wrote :
Revision history for this message
Alex Tu (alextu) wrote :
Revision history for this message
jeremyszu (os369510) :
review: Needs Fixing
Revision history for this message
Alex Tu (alextu) wrote :
Revision history for this message
Alex Tu (alextu) wrote :

fixed the comment from reviewer.
and verified on gitlab pipeline, so I will just merge it.

https://gitlab.com/alex-tu-cc/plainbox-provider-pc-sanity/-/pipelines/238892692

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/screen-pkg-not-public.sh b/bin/screen-pkg-not-public.sh
2index a3a3ae8..c4e4db7 100755
3--- a/bin/screen-pkg-not-public.sh
4+++ b/bin/screen-pkg-not-public.sh
5@@ -10,6 +10,17 @@ oem=""
6 platform=""
7 allowlst_folder=""
8 JOB_STATUS="pass"
9+out_folder="$PWD";
10+
11+usage() {
12+cat << EOF
13+usage: $0 options
14+
15+ -h|--help Print this message
16+ --out Define the folder for generated data. The default is \$PWD
17+EOF
18+exit 1
19+}
20 clean() {
21 rm -rf "$allowlst_folder"
22 [ -z "$1" ] || exit "$1"
23@@ -46,9 +57,9 @@ prepare() {
24 pf_factory_meta_pkg="${pf_meta_pkg/oem-${oem}-/oem-${oem}-factory-}"
25 echo "[INFO] getting allowlist from $allowlist_git."
26 [ -n "$allowlist_git" ] &&\
27- allowlst_folder="$PWD"/"$(basename "$allowlist_git")" &&\
28+ allowlst_folder="$out_folder"/"$(basename "$allowlist_git")" &&\
29 rm -rf "$allowlst_folder" &&\
30- (git clone --depth=1 "$allowlist_git" || (>&2 echo "[ERROR]git clone ""$allowlist_git"" failed, please check it." | exit 1))
31+ (git -C "$out_folder" clone --depth=1 "$allowlist_git" || (>&2 echo "[ERROR]git clone ""$allowlist_git"" failed, please check it." | exit 1))
32 echo "[INFO] git hash of current allowlist: $(git -C "$allowlst_folder" rev-parse --short HEAD)"
33 }
34 pkg_need_allowing() {
35@@ -154,6 +165,22 @@ screen_pkg() {
36 }
37
38 run_main() {
39+ while [ $# -gt 0 ]
40+ do
41+ case "$1" in
42+ -h | --help)
43+ usage
44+ ;;
45+ --out)
46+ shift
47+ [ -d "$1" ] || usage
48+ out_folder="$1";
49+ ;;
50+ *)
51+ usage
52+ esac
53+ shift
54+ done
55 prepare
56 >&2 echo "[INFO] staring screen all installed packages."
57 while IFS= read -r line; do
58@@ -164,5 +191,5 @@ run_main() {
59 clean
60 }
61 if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
62- run_main
63+ run_main "$@"
64 fi
65diff --git a/units/pc-sanity/pc-sanity-screen-oem-gaps.pxu b/units/pc-sanity/pc-sanity-screen-oem-gaps.pxu
66index dbb2a75..23c5839 100644
67--- a/units/pc-sanity/pc-sanity-screen-oem-gaps.pxu
68+++ b/units/pc-sanity/pc-sanity-screen-oem-gaps.pxu
69@@ -1,7 +1,7 @@
70 plugin: shell
71 category_id: com.canonical.plainbox::miscellanea
72 id: miscellanea/screen-pkg-not-public
73-command: screen-pkg-not-public.sh
74+command: screen-pkg-not-public.sh --out "$PLAINBOX_SESSION_SHARE"
75 _summary: check if pkgs not on public archive
76 _description:
77 check if pkgs not on public archive

Subscribers

People subscribed via source and target branches