@@ -9,7 +9,7 @@ OPP_OPRT_SRC_BRANCH=${OPP_OPRT_SRC_BRANCH-"main"}
99# OPP_SCRIPT_ENV_URL=${OPP_SCRIPT_ENV_URL-"https://raw.githubusercontent.com/operator-framework/community-operators/master/scripts/ci/actions-env"}
1010OPP_SCRIPT_ENV_URL=${OPP_SCRIPT_ENV_URL-" https://raw.githubusercontent.com/operator-framework/community-operators/support/ci_01/ci/scripts/opp-env.sh" }
1111OPP_EXEC_USER=
12- export OPRT=1
12+ OPRT=1
1313
1414function handleError() {
1515 OPERATORS_REPO_DIR=/tmp/operators-repo
@@ -54,6 +54,8 @@ OPP_OPRT_SRC_VERSIONS=$(find operators/$OPP_OPERATOR_NAME/ -maxdepth 1 -mindepth
5454
5555git checkout upstream/$OPP_OPRT_SRC_BRANCH
5656OPP_OPRT_TARGET_VERSIONS=$( find operators/$OPP_OPERATOR_NAME / -maxdepth 1 -mindepth 1 -type d | sort | cut -d ' /' -f 3)
57+ # Unused later
58+ unset OPP_OPERATOR_NAME
5759
5860git checkout $BRANCH_NAME # > /dev/null 2>&1
5961echo " BRANCH_NAME=$BRANCH_NAME "
@@ -62,24 +64,25 @@ git pull --rebase upstream $OPP_OPRT_SRC_BRANCH || handleError
6264echo " Repo rebased over branch OPP_OPRT_SRC_BRANCH - $OPP_OPRT_SRC_BRANCH "
6365
6466[[ $OPP_MIRROR_INDEX_MULTIARCH_IMAGE != " " ]] && OPP_EXEC_USER=" $OPP_EXEC_USER -e mirror_multiarch_image=$OPP_MIRROR_INDEX_MULTIARCH_IMAGE "
65- [ -n " $IIB_INPUT_REGISTRY_USER " ] && export OPP_EXEC_USER=" $OPP_EXEC_USER -e registry_redhat_io_user=$IIB_INPUT_REGISTRY_USER "
66- [ -n " $IIB_INPUT_REGISTRY_TOKEN " ] && export OPP_EXEC_USER_SECRETS=" $OPP_EXEC_USER_SECRETS -e registry_redhat_io_token=$IIB_INPUT_REGISTRY_TOKEN "
67- export OPP_ADDED_FILES=$( git diff --diff-filter=A upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
68- export OPP_MODIFIED_FILES=$( git diff --diff-filter=M upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
69- export OPP_REMOVED_FILES=$( git diff --diff-filter=D upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
70- export OPP_RENAMED_FILES=$( git diff --diff-filter=R upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
71- export OPP_ADDED_MODIFIED_FILES=$( git diff --diff-filter=AM upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
72- export OPP_ADDED_MODIFIED_RENAMED_FILES=$( git diff --diff-filter=RAM upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
73-
74- export OPP_CURRENT_PROJECT_REPO=" $OPP_OPRT_SRC_REPO "
75- export OPP_CURRENT_PROJECT_BRANCH=" $OPP_OPRT_SRC_BRANCH "
67+ [ -n " $IIB_INPUT_REGISTRY_USER " ] && OPP_EXEC_USER=" $OPP_EXEC_USER -e registry_redhat_io_user=$IIB_INPUT_REGISTRY_USER "
68+ [ -n " $IIB_INPUT_REGISTRY_TOKEN " ] && OPP_EXEC_USER_SECRETS=" $OPP_EXEC_USER_SECRETS -e registry_redhat_io_token=$IIB_INPUT_REGISTRY_TOKEN "
69+ OPP_ADDED_FILES=$( git diff --diff-filter=A upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
70+ OPP_MODIFIED_FILES=$( git diff --diff-filter=M upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
71+ OPP_REMOVED_FILES=$( git diff --diff-filter=D upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
72+ OPP_RENAMED_FILES=$( git diff --diff-filter=R upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
73+ OPP_ADDED_MODIFIED_FILES=$( git diff --diff-filter=AM upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
74+ OPP_ADDED_MODIFIED_RENAMED_FILES=$( git diff --diff-filter=RAM upstream/$OPP_OPRT_SRC_BRANCH --name-only | tr ' \r\n' ' ' )
75+
76+ OPP_CURRENT_PROJECT_REPO=" $OPP_OPRT_SRC_REPO "
77+ OPP_CURRENT_PROJECT_BRANCH=" $OPP_OPRT_SRC_BRANCH "
7678echo " OPP_ADDED_MODIFIED_RENAMED_FILES=$OPP_ADDED_MODIFIED_RENAMED_FILES "
7779echo " OPP_REMOVED_FILES=$OPP_REMOVED_FILES "
7880
7981OPP_ALL_FILES=$( git diff --diff-filter=DRAM upstream/$OPP_OPRT_SRC_BRANCH --name-only | grep -v -E " package.yaml|ci.yaml" | cut -d ' /' -f 3 | uniq)
8082OPP_ALL_SRC_FILES=$( git diff --diff-filter=m upstream/$OPP_OPRT_SRC_BRANCH | grep " rename from" | cut -d ' ' -f3 | grep -v -E " package.yaml|ci.yaml" | cut -d ' /' -f 3 | uniq)
8183
8284OPP_ALL_FILES=" $OPP_ALL_FILES $OPP_ALL_SRC_FILES "
85+ unset OPP_ALL_SRC_FILES
8386
8487echo " OPP_OPRT_SRC_VERSIONS=$( echo $OPP_OPRT_SRC_VERSIONS | tr ' \r\n' ' ' ) "
8588echo " OPP_OPRT_TARGET_VERSIONS=$( echo $OPP_OPRT_TARGET_VERSIONS | tr ' \r\n' ' ' ) "
@@ -91,24 +94,29 @@ echo "$OPP_ALL_FILES"
9194diff <( echo " $OPP_OPRT_SRC_VERSIONS " ) <( echo " $OPP_OPRT_TARGET_VERSIONS " ) | grep -E " <|>" | cut -d ' ' -f 2
9295
9396[ -n " $OPP_ALL_FILES " ] && MY_VERS=$( diff <( echo " $OPP_OPRT_SRC_VERSIONS " ) <( echo " $OPP_OPRT_TARGET_VERSIONS " ) | grep -E " <|>" | cut -d ' ' -f 2 | grep -v -E " $OPP_ALL_FILES " || true)
97+ unset OPP_ALL_FILES
9498echo " MY_VERS=$MY_VERS "
9599if [ -n " $MY_VERS " ]; then
96100 echo " MY_VERS=$( echo $MY_VERS | tr ' \r\n' ' ' ) "
97101 MY_VERS_CHECK=$( echo $MY_VERS | tr ' \r\n' ' ' )
98102 [ -n " $MY_VERS_CHECK " ] && { echo " Error: Source repo '$OPP_OPRT_REPO ' branch='$BRANCH_NAME ' doesn't contain some changes from upstream repo '$OPP_OPRT_SRC_REPO ' branch='$OPP_OPRT_SRC_BRANCH ' !!! Please rebase first ..." ; handleError; }
99103 # [ -n "$MY_VERS_CHECK" ] && { echo "Error: Source repo '$OPP_OPRT_REPO' branch='$BRANCH_NAME' doesn't contain some changes from upstream repo '$OPP_OPRT_SRC_REPO' branch='$OPP_OPRT_SRC_BRANCH' !!! Please rebase first ..."; }
100104fi
101- BRANCH_NAME=$( echo $BRANCH_NAME | cut -d ' /' -f 2-)
102- echo " BRANCH_NAME=$BRANCH_NAME "
103- # echo "op_test_repo_branch=$OPP_OPRT_REPO/${BRANCH_NAME}" >> $GITHUB_OUTPUT
105+ unset BRANCH_NAME
104106
105107[ -z " $OPP_ADDED_FILES " ] && [ -z " $OPP_MODIFIED_FILES " ] && [ -z " $OPP_REMOVED_FILES " ] && [ -z " $OPP_RENAMED_FILES " ] && [ -z " $OPP_ADDED_MODIFIED_FILES " ] && [ -z " $OPP_ADDED_MODIFIED_RENAMED_FILES " ] && { echo " ERROR: No change detected in PR !!! Contact project maintainers about this error !!!" ; exit 1; }
106108
107109echo " OPP_THIS_PR=$OPP_THIS_PR "
108110if [ -n " $OPP_THIS_PR " ]; then
109111 curl -s -H " Accept: application/vnd.github.v3+json" https://api.github.com/repos/$OPP_THIS_REPO /pulls/$OPP_THIS_PR /reviews > /tmp/approved_list.json
110112 cat /tmp/approved_list.json
111- export OPP_APPROVED_LIST=$( cat /tmp/approved_list.json | jq -r ' [.[-1] | {user: .user.login, state: .state}] | map(select(.state == "APPROVED")) | .[].user' | tr ' \n' ' ' )
113+ OPP_APPROVED_LIST=$( cat /tmp/approved_list.json | jq -r ' [.[-1] | {user: .user.login, state: .state}] | map(select(.state == "APPROVED")) | .[].user' | tr ' \n' ' ' )
112114fi
113115echo " OPP_APPROVED_LIST=$OPP_APPROVED_LIST "
114- bash <( curl -sL $OPP_SCRIPT_ENV_URL )
116+
117+ # According to https://linux.die.net/man/2/execve,
118+ # env vars take up Bash's buffers which can lead
119+ # to error "Argument list too long".
120+ # Without exporting large variables and using source,
121+ # this can be mitigated
122+ source <( curl -sL $OPP_SCRIPT_ENV_URL )
0 commit comments