1#!/usr/bin/env python2.7 2# Copyright 2017 gRPC authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16# Defines languages, runtimes and releases for backward compatibility testing 17 18from collections import OrderedDict 19 20 21def get_github_repo(lang): 22 return { 23 'dart': 'https://github.com/grpc/grpc-dart.git', 24 'go': 'https://github.com/grpc/grpc-go.git', 25 'java': 'https://github.com/grpc/grpc-java.git', 26 'node': 'https://github.com/grpc/grpc-node.git', 27 # all other languages use the grpc.git repo. 28 }.get(lang, 'https://github.com/grpc/grpc.git') 29 30 31def get_release_tags(lang): 32 """Returns list of known releases for given language.""" 33 return list(LANG_RELEASE_MATRIX[lang].keys()) 34 35 36def get_runtimes_for_lang_release(lang, release): 37 """Get list of valid runtimes for given release of lang.""" 38 runtimes = list(LANG_RUNTIME_MATRIX[lang]) 39 release_info = LANG_RELEASE_MATRIX[lang].get(release) 40 if release_info and release_info.runtimes: 41 runtimes = list(release_info.runtimes) 42 return runtimes 43 44 45def should_build_docker_interop_image_from_release_tag(lang): 46 # All dockerfile definitions live in grpc/grpc repository. 47 # For language that have a separate repo, we need to use 48 # dockerfile definitions from head of grpc/grpc. 49 if lang in ['go', 'java', 'node']: 50 return False 51 return True 52 53 54# Dictionary of default runtimes per language 55LANG_RUNTIME_MATRIX = { 56 'cxx': ['cxx'], # This is actually debian8. 57 'go': ['go1.8', 'go1.11'], 58 'java': ['java'], 59 'python': ['python', 'pythonasyncio'], 60 'node': ['node'], 61 'ruby': ['ruby'], 62 'php': ['php', 'php7'], 63 'csharp': ['csharp', 'csharpcoreclr'], 64} 65 66 67class ReleaseInfo: 68 """Info about a single release of a language""" 69 70 def __init__(self, patch=[], runtimes=[], testcases_file=None): 71 self.patch = patch 72 self.runtimes = runtimes 73 self.testcases_file = testcases_file 74 75 76# Dictionary of known releases for given language. 77LANG_RELEASE_MATRIX = { 78 'cxx': 79 OrderedDict([ 80 ('v1.0.1', ReleaseInfo(testcases_file='cxx__v1.0.1')), 81 ('v1.1.4', ReleaseInfo(testcases_file='cxx__v1.0.1')), 82 ('v1.2.5', ReleaseInfo(testcases_file='cxx__v1.0.1')), 83 ('v1.3.9', ReleaseInfo(testcases_file='cxx__v1.0.1')), 84 ('v1.4.2', ReleaseInfo(testcases_file='cxx__v1.0.1')), 85 ('v1.6.6', ReleaseInfo(testcases_file='cxx__v1.0.1')), 86 ('v1.7.2', ReleaseInfo(testcases_file='cxx__v1.0.1')), 87 ('v1.8.0', ReleaseInfo(testcases_file='cxx__v1.0.1')), 88 ('v1.9.1', ReleaseInfo(testcases_file='cxx__v1.0.1')), 89 ('v1.10.1', ReleaseInfo(testcases_file='cxx__v1.0.1')), 90 ('v1.11.1', ReleaseInfo(testcases_file='cxx__v1.0.1')), 91 ('v1.12.0', ReleaseInfo(testcases_file='cxx__v1.0.1')), 92 ('v1.13.0', ReleaseInfo(testcases_file='cxx__v1.0.1')), 93 ('v1.14.1', ReleaseInfo(testcases_file='cxx__v1.0.1')), 94 ('v1.15.0', ReleaseInfo(testcases_file='cxx__v1.0.1')), 95 ('v1.16.0', ReleaseInfo(testcases_file='cxx__v1.0.1')), 96 ('v1.17.1', ReleaseInfo(testcases_file='cxx__v1.0.1')), 97 ('v1.18.0', ReleaseInfo(testcases_file='cxx__v1.0.1')), 98 ('v1.19.0', ReleaseInfo(testcases_file='cxx__v1.0.1')), 99 ('v1.20.0', ReleaseInfo()), 100 ('v1.21.4', ReleaseInfo()), 101 ('v1.22.0', ReleaseInfo()), 102 ('v1.22.1', ReleaseInfo()), 103 ('v1.23.0', ReleaseInfo()), 104 ('v1.24.0', ReleaseInfo()), 105 ('v1.25.0', ReleaseInfo()), 106 ('v1.26.0', ReleaseInfo()), 107 ('v1.27.3', ReleaseInfo()), 108 ('v1.30.0', ReleaseInfo()), 109 ]), 110 'go': 111 OrderedDict([ 112 ('v1.0.5', 113 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 114 ('v1.2.1', 115 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 116 ('v1.3.0', 117 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 118 ('v1.4.2', 119 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 120 ('v1.5.2', 121 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 122 ('v1.6.0', 123 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 124 ('v1.7.4', 125 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 126 ('v1.8.2', 127 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 128 ('v1.9.2', 129 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 130 ('v1.10.1', 131 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 132 ('v1.11.3', 133 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 134 ('v1.12.2', 135 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 136 ('v1.13.0', 137 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 138 ('v1.14.0', 139 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 140 ('v1.15.0', 141 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 142 ('v1.16.0', 143 ReleaseInfo(runtimes=['go1.8'], testcases_file='go__v1.0.5')), 144 ('v1.17.0', 145 ReleaseInfo(runtimes=['go1.11'], testcases_file='go__v1.0.5')), 146 ('v1.18.0', 147 ReleaseInfo(runtimes=['go1.11'], testcases_file='go__v1.0.5')), 148 ('v1.19.0', 149 ReleaseInfo(runtimes=['go1.11'], testcases_file='go__v1.0.5')), 150 ('v1.20.0', ReleaseInfo(runtimes=['go1.11'])), 151 ('v1.21.3', ReleaseInfo(runtimes=['go1.11'])), 152 ('v1.22.3', ReleaseInfo(runtimes=['go1.11'])), 153 ('v1.23.1', ReleaseInfo(runtimes=['go1.11'])), 154 ('v1.24.0', ReleaseInfo(runtimes=['go1.11'])), 155 ('v1.25.0', ReleaseInfo(runtimes=['go1.11'])), 156 ('v1.26.0', ReleaseInfo(runtimes=['go1.11'])), 157 ('v1.27.1', ReleaseInfo(runtimes=['go1.11'])), 158 ('v1.28.0', ReleaseInfo(runtimes=['go1.11'])), 159 ('v1.29.0', ReleaseInfo(runtimes=['go1.11'])), 160 ]), 161 'java': 162 OrderedDict([ 163 ('v1.0.3', 164 ReleaseInfo(runtimes=['java_oracle8'], 165 testcases_file='java__v1.0.3')), 166 ('v1.1.2', 167 ReleaseInfo(runtimes=['java_oracle8'], 168 testcases_file='java__v1.0.3')), 169 ('v1.2.0', 170 ReleaseInfo(runtimes=['java_oracle8'], 171 testcases_file='java__v1.0.3')), 172 ('v1.3.1', 173 ReleaseInfo(runtimes=['java_oracle8'], 174 testcases_file='java__v1.0.3')), 175 ('v1.4.0', 176 ReleaseInfo(runtimes=['java_oracle8'], 177 testcases_file='java__v1.0.3')), 178 ('v1.5.0', 179 ReleaseInfo(runtimes=['java_oracle8'], 180 testcases_file='java__v1.0.3')), 181 ('v1.6.1', 182 ReleaseInfo(runtimes=['java_oracle8'], 183 testcases_file='java__v1.0.3')), 184 ('v1.7.1', ReleaseInfo(testcases_file='java__v1.0.3')), 185 ('v1.8.0', 186 ReleaseInfo(runtimes=['java_oracle8'], 187 testcases_file='java__v1.0.3')), 188 ('v1.9.1', 189 ReleaseInfo(runtimes=['java_oracle8'], 190 testcases_file='java__v1.0.3')), 191 ('v1.10.1', 192 ReleaseInfo(runtimes=['java_oracle8'], 193 testcases_file='java__v1.0.3')), 194 ('v1.11.0', 195 ReleaseInfo(runtimes=['java_oracle8'], 196 testcases_file='java__v1.0.3')), 197 ('v1.12.1', ReleaseInfo(testcases_file='java__v1.0.3')), 198 ('v1.13.2', ReleaseInfo(testcases_file='java__v1.0.3')), 199 ('v1.14.0', 200 ReleaseInfo(runtimes=['java_oracle8'], 201 testcases_file='java__v1.0.3')), 202 ('v1.15.1', ReleaseInfo(testcases_file='java__v1.0.3')), 203 ('v1.16.1', 204 ReleaseInfo(runtimes=['java_oracle8'], 205 testcases_file='java__v1.0.3')), 206 ('v1.17.2', ReleaseInfo(testcases_file='java__v1.0.3')), 207 ('v1.18.0', 208 ReleaseInfo(runtimes=['java_oracle8'], 209 testcases_file='java__v1.0.3')), 210 ('v1.19.0', 211 ReleaseInfo(runtimes=['java_oracle8'], 212 testcases_file='java__v1.0.3')), 213 ('v1.20.0', ReleaseInfo(runtimes=['java_oracle8'])), 214 ('v1.21.1', ReleaseInfo()), 215 ('v1.22.2', ReleaseInfo()), 216 ('v1.23.0', ReleaseInfo()), 217 ('v1.24.0', ReleaseInfo()), 218 ('v1.25.0', ReleaseInfo()), 219 ('v1.26.1', ReleaseInfo()), 220 ('v1.27.2', ReleaseInfo()), 221 ('v1.28.1', ReleaseInfo()), 222 ('v1.29.0', ReleaseInfo()), 223 ('v1.30.2', ReleaseInfo()), 224 ]), 225 'python': 226 OrderedDict([ 227 ('v1.0.x', 228 ReleaseInfo(runtimes=['python'], testcases_file='python__v1.0.x')), 229 ('v1.1.4', 230 ReleaseInfo(runtimes=['python'], testcases_file='python__v1.0.x')), 231 ('v1.2.5', 232 ReleaseInfo(runtimes=['python'], testcases_file='python__v1.0.x')), 233 ('v1.3.9', 234 ReleaseInfo(runtimes=['python'], testcases_file='python__v1.0.x')), 235 ('v1.4.2', 236 ReleaseInfo(runtimes=['python'], testcases_file='python__v1.0.x')), 237 ('v1.6.6', 238 ReleaseInfo(runtimes=['python'], testcases_file='python__v1.0.x')), 239 ('v1.7.2', 240 ReleaseInfo(runtimes=['python'], testcases_file='python__v1.0.x')), 241 ('v1.8.1', 242 ReleaseInfo(runtimes=['python'], testcases_file='python__v1.0.x')), 243 ('v1.9.1', 244 ReleaseInfo(runtimes=['python'], testcases_file='python__v1.0.x')), 245 ('v1.10.1', 246 ReleaseInfo(runtimes=['python'], testcases_file='python__v1.0.x')), 247 ('v1.11.1', 248 ReleaseInfo(runtimes=['python'], 249 testcases_file='python__v1.11.1')), 250 ('v1.12.0', 251 ReleaseInfo(runtimes=['python'], 252 testcases_file='python__v1.11.1')), 253 ('v1.13.0', 254 ReleaseInfo(runtimes=['python'], 255 testcases_file='python__v1.11.1')), 256 ('v1.14.1', 257 ReleaseInfo(runtimes=['python'], 258 testcases_file='python__v1.11.1')), 259 ('v1.15.0', 260 ReleaseInfo(runtimes=['python'], 261 testcases_file='python__v1.11.1')), 262 ('v1.16.0', 263 ReleaseInfo(runtimes=['python'], 264 testcases_file='python__v1.11.1')), 265 ('v1.17.1', 266 ReleaseInfo(runtimes=['python'], 267 testcases_file='python__v1.11.1')), 268 ('v1.18.0', ReleaseInfo(runtimes=['python'])), 269 ('v1.19.0', ReleaseInfo(runtimes=['python'])), 270 ('v1.20.0', ReleaseInfo(runtimes=['python'])), 271 ('v1.21.4', ReleaseInfo(runtimes=['python'])), 272 ('v1.22.0', ReleaseInfo(runtimes=['python'])), 273 ('v1.22.1', ReleaseInfo(runtimes=['python'])), 274 ('v1.23.0', ReleaseInfo(runtimes=['python'])), 275 ('v1.24.0', ReleaseInfo(runtimes=['python'])), 276 ('v1.25.0', ReleaseInfo(runtimes=['python'])), 277 ('v1.26.0', ReleaseInfo(runtimes=['python'])), 278 ('v1.27.3', ReleaseInfo(runtimes=['python'])), 279 ('v1.30.0', ReleaseInfo(runtimes=['python'])), 280 ]), 281 'node': 282 OrderedDict([ 283 ('v1.0.1', ReleaseInfo(testcases_file='node__v1.0.1')), 284 ('v1.1.4', ReleaseInfo(testcases_file='node__v1.1.4')), 285 ('v1.2.5', ReleaseInfo(testcases_file='node__v1.1.4')), 286 ('v1.3.9', ReleaseInfo(testcases_file='node__v1.1.4')), 287 ('v1.4.2', ReleaseInfo(testcases_file='node__v1.1.4')), 288 ('v1.6.6', ReleaseInfo(testcases_file='node__v1.1.4')), 289 # TODO: https://github.com/grpc/grpc-node/issues/235. 290 # ('v1.7.2', ReleaseInfo()), 291 ('v1.8.4', ReleaseInfo()), 292 ('v1.9.1', ReleaseInfo()), 293 ('v1.10.0', ReleaseInfo()), 294 ('v1.11.3', ReleaseInfo()), 295 ('v1.12.4', ReleaseInfo()), 296 ]), 297 'ruby': 298 OrderedDict([ 299 ('v1.0.1', 300 ReleaseInfo(patch=[ 301 'tools/dockerfile/interoptest/grpc_interop_ruby/Dockerfile', 302 'tools/dockerfile/interoptest/grpc_interop_ruby/build_interop.sh', 303 ], 304 testcases_file='ruby__v1.0.1')), 305 ('v1.1.4', ReleaseInfo(testcases_file='ruby__v1.1.4')), 306 ('v1.2.5', ReleaseInfo(testcases_file='ruby__v1.1.4')), 307 ('v1.3.9', ReleaseInfo(testcases_file='ruby__v1.1.4')), 308 ('v1.4.2', ReleaseInfo(testcases_file='ruby__v1.1.4')), 309 ('v1.6.6', ReleaseInfo(testcases_file='ruby__v1.1.4')), 310 ('v1.7.2', ReleaseInfo(testcases_file='ruby__v1.1.4')), 311 ('v1.8.0', ReleaseInfo(testcases_file='ruby__v1.1.4')), 312 ('v1.9.1', ReleaseInfo(testcases_file='ruby__v1.1.4')), 313 ('v1.10.1', ReleaseInfo(testcases_file='ruby__v1.1.4')), 314 ('v1.11.1', ReleaseInfo(testcases_file='ruby__v1.1.4')), 315 ('v1.12.0', ReleaseInfo(testcases_file='ruby__v1.1.4')), 316 ('v1.13.0', ReleaseInfo(testcases_file='ruby__v1.1.4')), 317 ('v1.14.1', ReleaseInfo(testcases_file='ruby__v1.1.4')), 318 ('v1.15.0', ReleaseInfo(testcases_file='ruby__v1.1.4')), 319 ('v1.16.0', ReleaseInfo(testcases_file='ruby__v1.1.4')), 320 ('v1.17.1', ReleaseInfo(testcases_file='ruby__v1.1.4')), 321 ('v1.18.0', 322 ReleaseInfo(patch=[ 323 'tools/dockerfile/interoptest/grpc_interop_ruby/build_interop.sh', 324 ])), 325 ('v1.19.0', ReleaseInfo()), 326 ('v1.20.0', ReleaseInfo()), 327 ('v1.21.4', ReleaseInfo()), 328 ('v1.22.0', ReleaseInfo()), 329 ('v1.22.1', ReleaseInfo()), 330 ('v1.23.0', ReleaseInfo()), 331 ('v1.24.0', ReleaseInfo()), 332 ('v1.25.0', ReleaseInfo()), 333 # TODO: https://github.com/grpc/grpc/issues/18262. 334 # If you are not encountering the error in above issue 335 # go ahead and upload the docker image for new releases. 336 ('v1.26.0', ReleaseInfo()), 337 ('v1.27.3', ReleaseInfo()), 338 ('v1.30.0', ReleaseInfo()), 339 ]), 340 'php': 341 OrderedDict([ 342 ('v1.0.1', ReleaseInfo(testcases_file='php__v1.0.1')), 343 ('v1.1.4', ReleaseInfo(testcases_file='php__v1.0.1')), 344 ('v1.2.5', ReleaseInfo(testcases_file='php__v1.0.1')), 345 ('v1.3.9', ReleaseInfo(testcases_file='php__v1.0.1')), 346 ('v1.4.2', ReleaseInfo(testcases_file='php__v1.0.1')), 347 ('v1.6.6', ReleaseInfo(testcases_file='php__v1.0.1')), 348 ('v1.7.2', ReleaseInfo(testcases_file='php__v1.0.1')), 349 ('v1.8.0', ReleaseInfo(testcases_file='php__v1.0.1')), 350 ('v1.9.1', ReleaseInfo(testcases_file='php__v1.0.1')), 351 ('v1.10.1', ReleaseInfo(testcases_file='php__v1.0.1')), 352 ('v1.11.1', ReleaseInfo(testcases_file='php__v1.0.1')), 353 ('v1.12.0', ReleaseInfo(testcases_file='php__v1.0.1')), 354 ('v1.13.0', ReleaseInfo(testcases_file='php__v1.0.1')), 355 ('v1.14.1', ReleaseInfo(testcases_file='php__v1.0.1')), 356 ('v1.15.0', ReleaseInfo(testcases_file='php__v1.0.1')), 357 ('v1.16.0', ReleaseInfo(testcases_file='php__v1.0.1')), 358 ('v1.17.1', ReleaseInfo(testcases_file='php__v1.0.1')), 359 ('v1.18.0', ReleaseInfo()), 360 # v1.19 and v1.20 were deliberately omitted here because of an issue. 361 # See https://github.com/grpc/grpc/issues/18264 362 ('v1.21.4', ReleaseInfo()), 363 ('v1.22.0', ReleaseInfo()), 364 ('v1.22.1', ReleaseInfo()), 365 ('v1.23.0', ReleaseInfo()), 366 ('v1.24.0', ReleaseInfo()), 367 ('v1.25.0', ReleaseInfo()), 368 ('v1.26.0', ReleaseInfo()), 369 ('v1.27.3', ReleaseInfo()), 370 ('v1.30.0', ReleaseInfo()), 371 ]), 372 'csharp': 373 OrderedDict([ 374 ('v1.0.1', 375 ReleaseInfo(patch=[ 376 'tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile', 377 'tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile', 378 ], 379 testcases_file='csharp__v1.1.4')), 380 ('v1.1.4', ReleaseInfo(testcases_file='csharp__v1.1.4')), 381 ('v1.2.5', ReleaseInfo(testcases_file='csharp__v1.1.4')), 382 ('v1.3.9', ReleaseInfo(testcases_file='csharp__v1.3.9')), 383 ('v1.4.2', ReleaseInfo(testcases_file='csharp__v1.3.9')), 384 ('v1.6.6', ReleaseInfo(testcases_file='csharp__v1.3.9')), 385 ('v1.7.2', ReleaseInfo(testcases_file='csharp__v1.3.9')), 386 ('v1.8.0', ReleaseInfo(testcases_file='csharp__v1.3.9')), 387 ('v1.9.1', ReleaseInfo(testcases_file='csharp__v1.3.9')), 388 ('v1.10.1', ReleaseInfo(testcases_file='csharp__v1.3.9')), 389 ('v1.11.1', ReleaseInfo(testcases_file='csharp__v1.3.9')), 390 ('v1.12.0', ReleaseInfo(testcases_file='csharp__v1.3.9')), 391 ('v1.13.0', ReleaseInfo(testcases_file='csharp__v1.3.9')), 392 ('v1.14.1', ReleaseInfo(testcases_file='csharp__v1.3.9')), 393 ('v1.15.0', ReleaseInfo(testcases_file='csharp__v1.3.9')), 394 ('v1.16.0', ReleaseInfo(testcases_file='csharp__v1.3.9')), 395 ('v1.17.1', ReleaseInfo(testcases_file='csharp__v1.3.9')), 396 ('v1.18.0', ReleaseInfo(testcases_file='csharp__v1.18.0')), 397 ('v1.19.0', ReleaseInfo(testcases_file='csharp__v1.18.0')), 398 ('v1.20.0', ReleaseInfo()), 399 ('v1.21.4', ReleaseInfo()), 400 ('v1.22.0', ReleaseInfo()), 401 ('v1.22.1', ReleaseInfo()), 402 ('v1.23.0', ReleaseInfo()), 403 ('v1.24.0', ReleaseInfo()), 404 ('v1.25.0', ReleaseInfo()), 405 ('v1.26.0', ReleaseInfo()), 406 ('v1.27.3', ReleaseInfo()), 407 ('v1.30.0', ReleaseInfo()), 408 ]), 409} 410