stages: - test test-job: image: harbor.exem-oss.org/test/test-runner:latest stage: test variables: 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 old_version while IFS=: read -r name version; do old_version["$name"]=$version done < <(jq_parse "$file1") declare -a different_names while IFS=: read -r name version; do 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 $file2 $file1 cd ./old ls -l git add ./ git commit -m "버전 관리" git push origin main else echo "버전이 변한 애플리케이션이 없습니다." fi except: variables: - $CI_COMMIT_MESSAGE =~ /CI 수정/