Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions common/CI/package_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ def commit_message(self, ref: str) -> str:
def commit_refs(self, base: str, head: str) -> List[str]:
return self.run_lines('log', '--no-merges', '--pretty=%H', base + '..' + head)

def commit_summary(self, ref: str) -> str:
return self.run('log', '-1', '--format=%s', ref)

def fetch(self, remote: List[str]) -> None:
self.run('fetch', *remote)

Expand Down
22 changes: 19 additions & 3 deletions common/Scripts/publish_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from datetime import datetime
from dataclasses import dataclass
from typing import List, Optional
from typing import List, Optional, Tuple
from xml.etree import ElementTree
from urllib import request
from email.utils import parsedate_to_datetime
Expand Down Expand Up @@ -86,7 +86,7 @@ def run(self) -> bool:

packages = {commit: self._packages(commit) for commit in commits}
invalid = {commit: packages for commit, packages in packages.items()
if len(packages) != 1 or any(p is None for p in packages)}
if not self._change_is_valid(commit, packages)}

if len(invalid) > 0:
print('Found commits with an incorrect number of packages:')
Expand All @@ -102,6 +102,10 @@ def run(self) -> bool:
if self.render:
self._render(commit)

if self._skip_commit(commit):
print(f'Skipping commit: {self.git.commit_summary(commit)}')
continue

comment = f'BUILD {i+1}/{len(commits)}'
if self.title:
comment = f'{self.title}\n{comment}'
Expand Down Expand Up @@ -147,6 +151,18 @@ def _package_for_file(file: str) -> Optional[str]:

return str(os.path.join(*parts[0:3]))

def _skip_commit(self, commit: str) -> bool:
msg = self.git.commit_summary(commit)
return msg.startswith('[NFC]') or \
msg.startswith('common:') or \
msg.startswith('packages:') or\
msg.startswith('repo_data:') or\
msg.lower().endswith(': deprecate')

def _change_is_valid(self, commit: str, packages: List[str]) -> bool:
return self._skip_commit(commit) or \
len(packages) == 1 and not any(p is None for p in packages)

def _git_push(self) -> None:
print('Pushing to Git')
if not self.noop:
Expand All @@ -163,7 +179,7 @@ def _push_build(self, build: Build) -> int:

return int(json.loads(output)['id'])

def _build_exists(self, build: Build) -> [bool, int]:
def _build_exists(self, build: Build) -> Tuple[bool, int]:
try:
found = next(b for b in Builds().all
if b.tag == build.tag and b.status != 'FAILED')
Expand Down
Loading