Skip to content

Commit a1bbc69

Browse files
authored
Enable Shellcheck in code scan. (#2046)
Signed-off-by: ZePan110 <ze.pan@intel.com>
1 parent 9923135 commit a1bbc69

13 files changed

Lines changed: 49 additions & 17 deletions

.github/workflows/pr-code-scan.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,35 @@ jobs:
6666
with:
6767
name: ${{ matrix.job_name }}
6868
path: ${{ github.workspace }}/.github/workflows/scripts/codeScan/${{ matrix.job_name }}.*
69+
70+
shell-check:
71+
runs-on: ubuntu-latest
72+
permissions:
73+
security-events: write
74+
actions: read
75+
contents: read
76+
steps:
77+
- name: Repository checkout
78+
uses: actions/checkout@v4
79+
with:
80+
fetch-depth: 0
81+
82+
- name: Get changed shell files
83+
id: get-changed-files
84+
run: |
85+
base_commit="${{ github.event.pull_request.base.sha }}"
86+
merged_commit="${{ github.sha }}"
87+
echo "base_commit=${base_commit}" >> $GITHUB_ENV
88+
echo "merged_commit=${merged_commit}" >> $GITHUB_ENV
89+
changed_files="$(git diff --name-only --diff-filter=AM ${base_commit} ${merged_commit} | grep -E '\.sh$' | tr '\n' ' ')" || true
90+
echo "changed_files=${changed_files}"
91+
echo "changed_files=${changed_files}" >> $GITHUB_ENV
92+
93+
- name: ShellCheck
94+
if: ${{ env.changed_files != '' }}
95+
uses: ludeeus/action-shellcheck@2.0.0
96+
env:
97+
SHELLCHECK_OPTS: -e SC2164 -e SC2154 -e SC2034 -e SC2155 -e SC1090 -e SC2153 -e SC2046
98+
with:
99+
path: ${{ env.changed_files }}
100+
severity: warning

.github/workflows/scripts/update_images_tag.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ function replace_image_version() {
2727
echo "version is empty"
2828
else
2929
echo "replace $repo_image:tag with $repo_image:$version"
30-
find . -name "Dockerfile" | xargs sed -i "s|$repo_image:sha[A-Za-z0-9\-]*|$repo_image:$version|g"
31-
find . -name "*.yaml" | xargs sed -i "s|$repo_image:sha[A-Za-z0-9\-]*|$repo_image:$version|g"
32-
find . -name "*.md" | xargs sed -i "s|$repo_image:sha[A-Za-z0-9\-]*|$repo_image:$version|g"
30+
find . -name "Dockerfile" -print0 | xargs -0 sed -i "s|$repo_image:sha[A-Za-z0-9\-]*|$repo_image:$version|g"
31+
find . -name "*.yaml" -print0 | xargs -0 sed -i "s|$repo_image:sha[A-Za-z0-9\-]*|$repo_image:$version|g"
32+
find . -name "*.md" -print0 | xargs -0 sed -i "s|$repo_image:sha[A-Za-z0-9\-]*|$repo_image:$version|g"
3333
fi
3434
}
3535

AgentQnA/docker_compose/amd/gpu/rocm/launch_agent_service_tgi_rocm.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ echo ${SUPERVISOR_REACT_AGENT_PORT} > ${WORKPATH}/SUPERVISOR_REACT_AGENT_PORT_tm
6666
echo ${CRAG_SERVER_PORT} > ${WORKPATH}/CRAG_SERVER_PORT_tmp
6767

6868
echo "Downloading chinook data..."
69-
echo Y | rm -R chinook-database
69+
rm -R chinook-database
7070
git clone https://github.com/lerocha/chinook-database.git
71-
echo Y | rm -R ../../../../../AgentQnA/tests/Chinook_Sqlite.sqlite
71+
rm -R ../../../../../AgentQnA/tests/Chinook_Sqlite.sqlite
7272
cp chinook-database/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite ../../../../../AgentQnA/tests
7373

7474
docker compose -f ../../../../../DocIndexRetriever/docker_compose/intel/cpu/xeon/compose.yaml up -d

AgentQnA/docker_compose/amd/gpu/rocm/launch_agent_service_vllm_rocm.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ echo ${SUPERVISOR_REACT_AGENT_PORT} > ${WORKPATH}/SUPERVISOR_REACT_AGENT_PORT_tm
6767
echo ${CRAG_SERVER_PORT} > ${WORKPATH}/CRAG_SERVER_PORT_tmp
6868

6969
echo "Downloading chinook data..."
70-
echo Y | rm -R chinook-database
70+
rm -R chinook-database
7171
git clone https://github.com/lerocha/chinook-database.git
72-
echo Y | rm -R ../../../../../AgentQnA/tests/Chinook_Sqlite.sqlite
72+
rm -R ../../../../../AgentQnA/tests/Chinook_Sqlite.sqlite
7373
cp chinook-database/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite ../../../../../AgentQnA/tests
7474

7575
docker compose -f ../../../../../DocIndexRetriever/docker_compose/intel/cpu/xeon/compose.yaml up -d

AgentQnA/docker_compose/amd/gpu/rocm/stop_agent_service_tgi_rocm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export DATAPREP_GET_FILE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/get"
4646
export DATAPREP_DELETE_FILE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/delete"
4747

4848
echo "Removing chinook data..."
49-
echo Y | rm -R chinook-database
49+
rm -R chinook-database
5050
if [ -d "chinook-database" ]; then
5151
rm -rf chinook-database
5252
fi

AgentQnA/docker_compose/amd/gpu/rocm/stop_agent_service_vllm_rocm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ echo ${SUPERVISOR_REACT_AGENT_PORT} > ${WORKPATH}/SUPERVISOR_REACT_AGENT_PORT_tm
6868
echo ${CRAG_SERVER_PORT} > ${WORKPATH}/CRAG_SERVER_PORT_tmp
6969

7070
echo "Removing chinook data..."
71-
echo Y | rm -R chinook-database
71+
rm -R chinook-database
7272
if [ -d "chinook-database" ]; then
7373
rm -rf chinook-database
7474
fi

AudioQnA/tests/test_compose_on_rocm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export MODEL_CACHE=${model_cache:-"/var/lib/GenAI/data"}
1414
WORKPATH=$(dirname "$PWD")
1515
LOG_PATH="$WORKPATH/tests"
1616
ip_address=$(hostname -I | awk '{print $1}')
17-
export PATH="~/miniconda3/bin:$PATH"
17+
export PATH="$HOME/miniconda3/bin:$PATH"
1818

1919
function build_docker_images() {
2020
opea_branch=${opea_branch:-"main"}

AudioQnA/tests/test_compose_vllm_on_rocm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export TAG=${IMAGE_TAG}
1313
WORKPATH=$(dirname "$PWD")
1414
LOG_PATH="$WORKPATH/tests"
1515
ip_address=$(hostname -I | awk '{print $1}')
16-
export PATH="~/miniconda3/bin:$PATH"
16+
export PATH="$HOME/miniconda3/bin:$PATH"
1717

1818
function build_docker_images() {
1919
opea_branch=${opea_branch:-"main"}

ChatQnA/tests/test_compose_faqgen_on_rocm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ip_address=$(hostname -I | awk '{print $1}')
1717

1818
source $WORKPATH/docker_compose/amd/gpu/rocm/set_env_faqgen.sh
1919

20-
export PATH="~/miniconda3/bin:$PATH"
20+
export PATH="$HOME/miniconda3/bin:$PATH"
2121

2222
function build_docker_images() {
2323
opea_branch=${opea_branch:-"main"}

ChatQnA/tests/test_compose_on_rocm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ip_address=$(hostname -I | awk '{print $1}')
1717

1818
source $WORKPATH/docker_compose/amd/gpu/rocm/set_env.sh
1919

20-
export PATH="~/miniconda3/bin:$PATH"
20+
export PATH="$HOME/miniconda3/bin:$PATH"
2121

2222
function build_docker_images() {
2323
opea_branch=${opea_branch:-"main"}

0 commit comments

Comments
 (0)