File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -56,19 +56,23 @@ jobs:
56
56
version=$(rpmspec --parse "$spec" | grep -E "^Version:\s*(.*)" | awk '{print $2}')
57
57
58
58
if [[ "$name" == "fdk-aac-free" || "$name" == "redis" ]]; then
59
- # get base spec if it exits.
59
+ # get the previous spec if it exits.
60
60
previous_spec=$(git show ${{ env.base_sha }}:"$spec" 2>/dev/null)
61
61
#if the spec is a new addition, we want previous version to be empty
62
- previous_version=$(rpmspec --parse $previous_spec 2>/dev/null | grep -E "^Version:\s*(.*)" | awk '{print $2}')
62
+ previous_version=""
63
+
64
+ if [[ -n "$previous_spec" ]]; then
65
+ previous_version=$(rpmspec --parse <(git show ${{ env.base_sha }}:"$spec") | grep -E "^Version:\s*(.*)" | awk '{print $2}')
66
+ fi
63
67
echo "Previous version: $previous_version"
64
68
if [[ "$version" != "$previous_version" ]]; then
65
69
1>&2 echo "**** ERROR ****"
66
- 1>&2 echo "Spec '$spec' change is not allowed in Azure Linux."
67
- 1>&2 echo "**** ERROR 1 ****"
70
+ 1>&2 echo "Spec '$spec' update is not allowed in Azure Linux."
71
+ 1>&2 echo "**** ERROR ****"
68
72
error_found=1
69
73
fi
70
74
fi
71
- # Check if the version is greater than or equal the allowed version
75
+ # Check if the version is greater than the allowed version
72
76
if { [[ "$name" == "redis" && "$(printf '%s\n' "$version" "7.4" | sort -V | head -n1)" == "7.4" ]] || \
73
77
[[ "$name" == "packer" && "$(printf '%s\n' "$version" "1.10.0" | sort -V | head -n1)" == "1.10.0" ]] || \
74
78
[[ "$name" == "terraform" && "$(printf '%s\n' "$version" "1.6.0" | sort -V | head -n1)" == "1.6.0" ]]; }; then
You can’t perform that action at this time.
0 commit comments