This commit is contained in:
정훈 변
2024-06-26 17:09:39 +09:00
parent 8e965c9687
commit e1e6c03245

View File

@@ -5,34 +5,51 @@ test-job:
image: harbor.exem-oss.org/test/test-runner:latest
stage: test
variables:
file1: "./old_version.json"
file2: "./test_json.json"
file1: "./old/old_version.json"
file2: "./new_version.json"
git_token: $TOKEN
git_user: $USER
git_url: $URL
before_script: |
git config --global user.email "sa_8001@ex-em.com"
git config --global user.name "변정훈"
git clone https://${git_user}:${git_token}@${git_url} ./old
script: |
jq_parse() {
jq -r '.[] | "\(.name):\(.version)"' "$1"
}
declare -A versions1
declare -A old_version
while IFS=: read -r name version; do
versions1["$name"]=$version
old_version["$name"]=$version
done < <(jq_parse "$file1")
declare -a different_names
while IFS=: read -r name version; do
if [[ "${versions1["$name"]}" != "$version" ]]; then
if [[ "${old_version["$name"]}" != "$version" ]]; then
different_names+=("$name$version")
fi
done < <(jq_parse "$file2")
if [ ${#different_names[@]} -gt 0 ]; then
echo "버전이 달라진 프로젝트 목록"
for name in "${different_names[@]}"; do
echo "$name"
done
cp $file1 $file2
cd ./old
ls -l
git add ./
git commit -m "버전 관리"
git push origin main
else
echo "버전이 변한 애플리케이션이 없습니다."
fi
except:
variables:
- $CI_COMMIT_MESSAGE =~ /CI 수정/