|
12 | 12 | from ci_config import CI |
13 | 13 | from env_helper import REPO_COPY, S3_BUILDS_BUCKET, TEMP_PATH, S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY |
14 | 14 | from git_helper import Git |
15 | | -from pr_info import PRInfo |
| 15 | +from pr_info import PRInfo, EventType |
16 | 16 | from report import FAILURE, SUCCESS, JobReport, StatusType |
17 | 17 | from stopwatch import Stopwatch |
18 | 18 | from tee_popen import TeePopen |
19 | 19 | from version_helper import ( |
20 | 20 | ClickHouseVersion, |
| 21 | + VersionType, |
21 | 22 | get_version_from_repo, |
22 | 23 | update_version_local, |
23 | 24 | ) |
@@ -164,16 +165,31 @@ def main(): |
164 | 165 | version = get_version_from_repo(git=Git(True)) |
165 | 166 | logging.info("Got version from repo %s", version.string) |
166 | 167 |
|
167 | | - official_flag = pr_info.number == 0 |
| 168 | + # official_flag = pr_info.number == 0 |
168 | 169 |
|
169 | | - version_type = "testing" |
170 | | - if is_release_pr(pr_info): |
171 | | - version_type = "stable" |
172 | | - official_flag = True |
| 170 | + # version_type = "testing" |
| 171 | + # if is_release_pr(pr_info): |
| 172 | + # version_type = "stable" |
| 173 | + # official_flag = True |
| 174 | + |
| 175 | + # NOTE(vnemkov): For Altinity Stable builds, version flavor |
| 176 | + # (last part of version, like 'altinitystable') is obtained from tag. |
| 177 | + # If there is no tag, then version is considered to be 'testing' |
| 178 | + version_type = version._flavour = VersionType.TESTING |
| 179 | + official_flag = True |
| 180 | + |
| 181 | + if pr_info.event_type == EventType.PUSH \ |
| 182 | + and pr_info.ref.startswith('/ref/tags/'): |
| 183 | + tag_name = pr_info.ref.removeprefix('/ref/tags/') |
| 184 | + version_type = tag_name.split('.')[-1] |
| 185 | + version._flavour = version_type |
| 186 | + logging.info("Using version from tag: %s => %s", tag_name, version) |
| 187 | + |
| 188 | + # TODO(vnemkov): make sure tweak part is incremented by 1 each time we merge a PR |
173 | 189 |
|
174 | 190 | update_version_local(version, version_type) |
175 | 191 |
|
176 | | - logging.info("Updated local files with version") |
| 192 | + logging.info("Updated local files with version %s", version) |
177 | 193 |
|
178 | 194 | logging.info("Build short name %s", build_name) |
179 | 195 |
|
|
0 commit comments