@@ -56,6 +56,14 @@ create_version_branch() {
5656 git checkout -b ${ACS_BRANCH_NAME} ${KUBERNETES_TAG_BRANCH} || true
5757}
5858
59+ version_lt () {
60+ [ " $1 " != $( printf " $1 \n$2 " | sort -V | head -n 2 | tail -n 1) ]
61+ }
62+
63+ version_ge () {
64+ [ " $1 " == $( printf " $1 \n$2 " | sort -V | head -n 2 | tail -n 1) ]
65+ }
66+
5967k8s_16_cherry_pick () {
6068 # 232fa6e5bc (HEAD -> release-1.6, origin/release-1.6) Fix the delay caused by network setup in POD Infra container
6169 # 02b1c2b9e2 Use dns policy to determine setting DNS servers on the correct NIC in Windows container
@@ -72,14 +80,14 @@ k8s_16_cherry_pick() {
7280}
7381
7482k8s_17_cherry_pick () {
75- if [ ! " ${version} " \< " 1.7.10" ] ; then
83+ if version_ge " ${version} " " 1.7.10" ; then
7684 echo " version 1.7.10 and after..."
7785 # In 1.7.10, the following commit is not needed and has conflict with 137f4cb16e
7886 # due to the out-of-order back porting into Azure 1.7. So removing it.
7987 # cee32e92f7 fix#50150: azure disk mount failure on coreos
8088 git revert --no-edit cee32e92f7 || true
8189
82- if [ ! " ${version} " \< " 1.7.12" ] ; then
90+ if version_ge " ${version} " " 1.7.12" ; then
8391 echo " version 1.7.12 and after..."
8492 # In 1.7.12, the following commits are cherry-picked in upstream and has conflict
8593 # with 137f4cb16e. So removing them.
@@ -90,14 +98,21 @@ k8s_17_cherry_pick() {
9098 git revert --no-edit 3a4abca2f7 || true # covered by commit 3aa179744f
9199 git revert --no-edit 6a2e2f47d3 || true # covered by commit 3aa179744f
92100
93- if [ ! " ${version} " \< " 1.7.13" ] ; then
101+ if version_ge " ${version} " " 1.7.13" ; then
94102 echo " version 1.7.13 and after..."
95103 # In 1.7.13, the following commit is cherry-picked in upstream and has conflict
96104 # with 137f4cb16e. So removing it.
97105 git revert --no-edit 3aa179744f || true # only for linux
98106
99- if [ ! " ${version} " \< " 1.7.14" ] ; then
107+ if version_ge " ${version} " " 1.7.14" ; then
100108 echo " version 1.7.14 and after..."
109+ if version_ge " ${version} " " 1.7.15" ; then
110+ echo " version 1.7.15 and after..."
111+ # From 1.7.15, 0d5df36f05 conflict with reverting 975d0a4bb9. We use 631e363b9d in Azure repo instead of 0d5df36f05
112+ git revert --no-edit 0d5df36f05 || true
113+ # From 1.7.15, 4d50500614 conflict with reverting 51584188ee. It is server side code so jsut revert it.
114+ git revert --no-edit 4d50500614 || true
115+ fi
101116 # From 1.7.14, 975d0a4bb9 conflict with 137f4cb16e. We use a36d59ddda in Azure repo instead of 975d0a4bb9
102117 git revert --no-edit 975d0a4bb9 || true
103118 # From 1.7.14, 51584188ee and 3a0db21dcb conflict with af3a93b07e. We use f5c45d3def in Azure repo instead of them
@@ -117,12 +132,14 @@ k8s_17_cherry_pick() {
117132 # b8fe713754 Use adapter vEthernet (HNSTransparent) on Windows host network to find node IP
118133 # From 1.7.13, acbdec96da is not needed since 060111c603 supercedes it
119134 git cherry-pick --allow-empty --keep-redundant-commits b8fe713754^..e912889a7f
120- if [ " ${version} " \< " 1.7.13" ]; then
135+ if version_lt " ${version} " " 1.7.13" ; then
136+ echo " before version 1.7.13..."
121137 git cherry-pick --allow-empty --keep-redundant-commits acbdec96da
122138 fi
123139 git cherry-pick --allow-empty --keep-redundant-commits 76d7c23f62^..32ceaa7918
124140
125- if [ ! " ${version} " \< " 1.7.14" ]; then
141+ if version_ge " ${version} " " 1.7.14" ; then
142+ echo " version 1.7.14 and after..."
126143 # From 1.7.14, 975d0a4bb9 conflict with 137f4cb16e. We use a36d59ddda in Azure repo instead of 975d0a4bb9
127144 git cherry-pick --allow-empty --keep-redundant-commits a36d59ddda
128145 # From 1.7.14, 51584188ee and 3a0db21dcb conflict with af3a93b07e. We use f5c45d3def in Azure repo instead of them
@@ -133,6 +150,12 @@ k8s_17_cherry_pick() {
133150 git cherry-pick --allow-empty --keep-redundant-commits 69c56c6037
134151
135152 git cherry-pick --allow-empty --keep-redundant-commits 3e930be6bc
153+
154+ if version_ge " ${version} " " 1.7.15" ; then
155+ echo " version 1.7.15 and after..."
156+ # From 1.7.15, 0d5df36f05 conflict with reverting 975d0a4bb9. We use 631e363b9d in Azure repo instead of 0d5df36f05
157+ git cherry-pick --allow-empty --keep-redundant-commits 631e363b9d
158+ fi
136159 fi
137160}
138161
@@ -155,26 +178,40 @@ k8s_18_cherry_pick() {
155178 # ...
156179 # 69644018c8 Use adapter vEthernet (HNSTransparent) on Windows host network to find node IP
157180
158- if [ ! " ${version} " \< " 1.8.9" ]; then
181+ if version_ge " ${version} " " 1.8.9" ; then
182+ echo " version 1.8.9 and after..."
183+ if version_ge " ${version} " " 1.8.10" ; then
184+ echo " version 1.8.10 and after..."
185+ # From 1.8.10, 5936faed37 conflict with reverting 63b4f60e43. We use 1f26b7a083 in Azure repo instead of 5936faed37
186+ git revert --no-edit 5936faed37 || true
187+ fi
159188 # From 1.8.9, 63b4f60e43 conflict with b42981f90b. We use 6a8305e419 in Azure repo instead of 63b4f60e43
160189 git revert --no-edit 63b4f60e43 || true
161190 # From 1.8.9, 40d5e0a34f conflict with 6a8305e419. We use b90d61a48c in Azure repo instead of 40d5e0a34f
162191 git revert --no-edit 40d5e0a34f || true
192+
163193 fi
164194
165195 git cherry-pick --allow-empty --keep-redundant-commits 69644018c8^..8d477271f7
166196 git cherry-pick --allow-empty --keep-redundant-commits b42981f90b^..cb29df51c0
167- if [ " ${version} " \< " 1.8.6" ]; then
197+ if version_lt " ${version} " " 1.8.6" ; then
198+ echo " before version 1.8.6..."
168199 git cherry-pick --allow-empty --keep-redundant-commits b8594873f4
169200 fi
170201 git cherry-pick --allow-empty --keep-redundant-commits d75ef50170
171202 git cherry-pick --allow-empty --keep-redundant-commits 4647f2f616^..4fd355d04a
172203
173- if [ ! " ${version} " \< " 1.8.9" ]; then
204+ if version_ge " ${version} " " 1.8.9" ; then
205+ echo " version 1.8.9 and after..."
174206 # From 1.8.9, 63b4f60e43 conflict with b42981f90b. We use 6a8305e419 in Azure repo instead of 63b4f60e43
175207 git cherry-pick --allow-empty --keep-redundant-commits 6a8305e419
176208 # From 1.8.9, 40d5e0a34f conflict with 6a8305e419. We use b90d61a48c in Azure repo instead of 40d5e0a34f
177209 git cherry-pick --allow-empty --keep-redundant-commits b90d61a48c
210+ if version_ge " ${version} " " 1.8.10" ; then
211+ echo " version 1.8.10 and after..."
212+ # From 1.8.10, 5936faed37 conflict with reverting 63b4f60e43. We use 1f26b7a083 in Azure repo instead of 5936faed37
213+ git cherry-pick --allow-empty --keep-redundant-commits 1f26b7a083
214+ fi
178215 fi
179216}
180217
0 commit comments