OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
NPU CiP bump notification (#38411)
Jakub Koniuszewski82c116723566
diff --git a/.github/scripts/npu_cip_detect_bump.py b/.github/scripts/npu_cip_detect_bump.pynew file mode 100644index 00000000000..6fce8bc305e--- /dev/null+++ b/.github/scripts/npu_cip_detect_bump.py@@ -0,0 +1,219 @@+# Copyright (C) 2018-2026 Intel Corporation+# SPDX-License-Identifier: Apache-2.0++"""Detect NPU CiP checksum bumps and prepare GitHub Actions outputs for notification.++Used by the "Detect CiP value-level change" step of the NPU CiP Bump Notification+workflow (.github/workflows/npu_cip_bump_notification.yml). Fetches+download_compiler_libs.cmake at two revisions via the GitHub API, compares tracked+PLUGIN_COMPILER_* checksum variables, writes body.md for PR comments, and sets+step outputs consumed by npu_cip_notify_teams.py and the PR comment step.+"""++from __future__ import annotations++import base64+import json+import os+import re+import subprocess+import sys+from datetime import datetime+from pathlib import Path+from zoneinfo import ZoneInfo++ZERO_SHA = "0" * 40+SET_PATTERN = re.compile(r"set\(([^)\s]+)\s+([^)]*)\)")+++def append_step_summary(text: str) -> None:+ summary = os.environ.get("GITHUB_STEP_SUMMARY")+ if summary:+ with open(summary, "a", encoding="utf-8") as handle:+ handle.write(text)+++def set_output(name: str, value: str) -> None:+ github_output = os.environ.get("GITHUB_OUTPUT")+ if not github_output:+ return+ with open(github_output, "a", encoding="utf-8") as handle:+ if "\n" in value:+ delimiter = f"{name}_EOF"+ while delimiter in value:+ delimiter += "_"+ handle.write(f"{name}<<{delimiter}\n{value}\n{delimiter}\n")+ else:+ handle.write(f"{name}={value}\n")+++def gh_api_json(path: str) -> object | None:+ result = subprocess.run(+ ["gh", "api", path],+ capture_output=True,+ text=True,+ check=False,+ )+ if result.returncode != 0:+ return None+ try:+ return json.loads(result.stdout)+ except json.JSONDecodeError:+ return None+++def fetch_file(repo: str, file_path: str, ref: str) -> str:+ payload = gh_api_json(f"repos/{repo}/contents/{file_path}?ref={ref}")+ if not isinstance(payload, dict) or "content" not in payload:+ sys.exit(f"Failed to fetch {file_path} at ref {ref}")+ raw = payload["content"].replace("\n", "")+ return base64.b64decode(raw).decode("utf-8")+++def get_val(cmake_text: str, variable: str) -> str:+ prefix = f"set({variable}"+ for match in SET_PATTERN.finditer(cmake_text):+ if match.group(1) == variable:+ return re.sub(r"\s+", "", match.group(2))+ return ""+++def resolve_before_after() -> tuple[str, str]:+ event_name = os.environ.get("EVENT_NAME", "")+ if event_name == "workflow_dispatch":+ return os.environ.get("INPUT_BEFORE_SHA", ""), os.environ.get("INPUT_AFTER_SHA", "")+ return os.environ.get("PUSH_BEFORE_SHA", ""), os.environ.get("PUSH_AFTER_SHA", "")+++def build_mentions(logins: str) -> str:+ parts = []+ for login in logins.replace(",", " ").split():+ if login:+ parts.append(f"@{login}")+ return " ".join(parts) + (" " if parts else "")+++def main() -> None:+ file_path = os.environ.get("FILE_PATH", "")+ tracked_raw = os.environ.get("TRACKED_VARS", "")+ tracked_vars = tracked_raw.split()+ repo = os.environ["GITHUB_REPOSITORY"]+ server_url = os.environ.get("GITHUB_SERVER_URL", "https://github.com")+ ref_name = os.environ.get("GITHUB_REF_NAME", "")++ before, after = resolve_before_after()+ print(f"Comparing {file_path} between {before} and {after}")++ if not before or before == ZERO_SHA:+ message = "No usable base revision (branch creation or force-push); skipping."+ print(message)+ append_step_summary(message + "\n")+ set_output("changed", "false")+ return++ before_text = fetch_file(repo, file_path, before)+ after_text = fetch_file(repo, file_path, after)++ changed = False+ anomaly = False+ parsed_any_after = False+ rows: list[str] = []+ changes_lines: list[str] = []++ for variable in tracked_vars:+ old = get_val(before_text, variable)+ new = get_val(after_text, variable)+ if new:+ parsed_any_after = True+ if old != new:+ changed = True+ rows.append(f"| `{variable}` | `{old or '<none>'}` | `{new or '<none>'}` |")+ changes_lines.append(f"- {variable}: {old or '<none>'} -> {new or '<none>'}")++ if not parsed_any_after:+ anomaly = True+ changed = True++ set_output("changed", "true" if changed else "false")+ if not changed:+ message = "No value-level change in tracked NPU CiP variables; skipping notification."+ print(message)+ append_step_summary(message + "\n")+ return++ now = datetime.now(tz=ZoneInfo("Europe/Warsaw")).strftime("%H:%M %d/%m/%Y %Z")+ commit_url = f"{server_url}/{repo}/commit/{after}"+ branch = ref_name++ author = ""+ commit_payload = gh_api_json(f"repos/{repo}/commits/{after}")+ if isinstance(commit_payload, dict):+ commit = commit_payload.get("commit") or {}+ if isinstance(commit, dict):+ author_info = commit.get("author") or {}+ if isinstance(author_info, dict):+ author = author_info.get("name") or ""++ pr_info = ""+ pr_number = ""+ pulls = gh_api_json(f"repos/{repo}/commits/{after}/pulls")+ if isinstance(pulls, list) and pulls:+ first = pulls[0]+ if isinstance(first, dict) and first.get("number") is not None:+ pr_number = str(first["number"])+ title = first.get("title") or ""+ pr_info = f"#{pr_number} {title}".strip()++ pr_url = f"{server_url}/{repo}/pull/{pr_number}" if pr_number else ""+ mentions = build_mentions(os.environ.get("NPU_CIP_NOTIFY_LOGINS", ""))++ body_lines = [+ "### 🔔 NPU CiP bump detected",+ "",+ ]+ if mentions.strip():+ body_lines.append(mentions.rstrip())+ body_lines.append("")+ body_lines.extend([+ "| Field | Value |",+ "| --- | --- |",+ f"| Date | {now} |",+ f"| Branch | `{branch}` |",+ f"| Commit | {commit_url} |",+ ])+ if author:+ body_lines.append(f"| Author | {author} |")+ if pr_info:+ body_lines.append(f"| Pull request | {pr_info} |")+ body_lines.append("")+ if anomaly:+ body_lines.extend([+ "> ⚠️ The tracked `PLUGIN_COMPILER_*` variables could not be parsed in the new",+ "> revision. They may have been renamed — please verify this notification manually.",+ "",+ ])+ if rows:+ body_lines.extend([+ "| Variable | Old | New |",+ "| --- | --- | --- |",+ *rows,+ ])+ body_md = "\n".join(body_lines) + "\n"++ append_step_summary(body_md)+ workspace = Path(os.environ.get("GITHUB_WORKSPACE", "."))+ (workspace / "body.md").write_text(body_md, encoding="utf-8")++ changes_text = "\n".join(changes_lines) if changes_lines else "<variables could not be parsed>"+ set_output("date", now)+ set_output("branch", branch)+ set_output("commit_url", commit_url)+ set_output("author", author)+ set_output("pr_info", pr_info)+ set_output("pr_number", pr_number)+ set_output("pr_url", pr_url)+ set_output("changes", changes_text)+++if __name__ == "__main__":+ main()diff --git a/.github/scripts/npu_cip_notify_teams.py b/.github/scripts/npu_cip_notify_teams.pynew file mode 100644index 00000000000..dad57e129c8--- /dev/null+++ b/.github/scripts/npu_cip_notify_teams.py@@ -0,0 +1,95 @@+# Copyright (C) 2018-2026 Intel Corporation+# SPDX-License-Identifier: Apache-2.0++"""Post an NPU CiP bump notification as an Adaptive Card to a Microsoft Teams webhook.++Used by the "Send Teams notification" step of the NPU CiP Bump Notification workflow+(.github/workflows/npu_cip_bump_notification.yml). Follows the Adaptive Card / incoming+webhook approach of .github/scripts/agentic-workflows/notify_teams.py, but targets a+Power Automate ("Send webhook alerts to a channel") endpoint, which expects the bare+card. All content is passed via environment variables; the destination channel is+whichever channel owns the webhook in TEAMS_WEBHOOK_URL.+"""++from __future__ import annotations++import json+import os+import sys+import urllib.error+import urllib.request+++def main() -> None:+ webhook_url = os.environ.get("TEAMS_WEBHOOK_URL", "")+ if not webhook_url:+ print("TEAMS_WEBHOOK_URL not set; skipping Teams notification.")+ return++ facts = [+ {"title": "Date", "value": os.environ.get("CARD_DATE", "")},+ {"title": "Branch", "value": os.environ.get("CARD_BRANCH", "")},+ {"title": "Repository", "value": os.environ.get("CARD_REPO", "")},+ ]+ if os.environ.get("CARD_AUTHOR"):+ facts.append({"title": "Author", "value": os.environ["CARD_AUTHOR"]})+ pr_info = os.environ.get("CARD_PR_INFO", "")+ pr_url = os.environ.get("CARD_PR_URL", "")+ if pr_info:+ pr_value = f"[{pr_info}]({pr_url})" if pr_url else pr_info+ facts.append({"title": "PR", "value": pr_value})++ body = [+ {"type": "TextBlock", "text": "\U0001f514 NPU CiP bump detected",+ "weight": "Bolder", "size": "Medium", "color": "Attention", "wrap": True},+ {"type": "FactSet", "facts": facts},+ {"type": "TextBlock", "text": os.environ.get("CARD_CHANGES", ""),+ "wrap": True, "spacing": "Medium", "fontType": "Monospace"},+ ]++ # Teams @mentions require both <at> tags in the text and a matching msteams.entities+ # list; CARD_MENTION_UPNS holds comma/space separated user principal names (emails).+ raw_mentions = os.environ.get("CARD_MENTION_UPNS", "").replace(",", " ").split()+ entities = []+ for upn in raw_mentions:+ entities.append({"type": "mention", "text": f"<at>{upn}</at>",+ "mentioned": {"id": upn, "name": upn}})+ if entities:+ body.append({"type": "TextBlock", "spacing": "Medium", "wrap": True,+ "text": " ".join(entity["text"] for entity in entities)})++ actions: list[dict[str, str]] = []+ if pr_url:+ actions.append({"type": "Action.OpenUrl", "title": "View pull request", "url": pr_url})+ commit_url = os.environ.get("CARD_COMMIT_URL", "")+ if commit_url:+ actions.append({"type": "Action.OpenUrl", "title": "View commit", "url": commit_url})++ # Power Automate ("Send webhook alerts to a channel") posts the request body directly+ # as an Adaptive Card, so send the bare card rather than the classic connector's+ # {"type": "message", "attachments": [...]} envelope, which renders as an empty message.+ payload = {+ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",+ "type": "AdaptiveCard",+ "version": "1.4",+ "body": body,+ "actions": actions,+ }+ if entities:+ payload["msteams"] = {"entities": entities}++ request = urllib.request.Request(+ webhook_url,+ data=json.dumps(payload).encode("utf-8"),+ headers={"Content-Type": "application/json"},+ method="POST",+ )+ try:+ with urllib.request.urlopen(request) as response:+ print(f"Teams webhook responded with HTTP {response.status}")+ except urllib.error.HTTPError as error:+ sys.exit(f"Teams webhook failed with HTTP {error.code}: {error.read().decode('utf-8', 'replace')}")+++if __name__ == "__main__":+ main()diff --git a/.github/workflows/npu_cip_bump_notification.yml b/.github/workflows/npu_cip_bump_notification.ymlnew file mode 100644index 00000000000..73e0e743881--- /dev/null+++ b/.github/workflows/npu_cip_bump_notification.yml@@ -0,0 +1,112 @@+name: NPU CiP Bump Notification++# Notifies whenever the prebuilt NPU compiler-in-package (CiP) binaries are bumped on+# master or a release branch. A bump is detected by a value-level change of any+# PLUGIN_COMPILER_* platform SHA256 checksum in:+# src/plugins/intel_npu/cmake/download_compiler_libs.cmake+#+# Delivery:+# - GitHub: comment on the bump PR with @mentions (NPU_CIP_NOTIFY_LOGINS) so GitHub emails+# recipients from [email protected].+# - Teams: Adaptive Card to a Power Automate webhook (optional).+# workflow_dispatch is a dry-run: detect writes the run summary only (no Teams / PR comment).+# If notify logins / webhook are unset on push, delivery steps no-op but the summary still logs the bump.+#+# Configuration (repository -> Settings -> Secrets and variables -> Actions):+# Variables:+# NPU_CIP_NOTIFY_LOGINS - space/comma separated GitHub logins to @mention on the PR+# NPU_CIP_TEAMS_MENTION_UPNS - optional comma/space separated UPNs (emails) for Teams @mentions+# Secrets:+# NPU_CIP_TEAMS_WEBHOOK_URL - Teams incoming webhook URL of the destination channel++on:+ push:+ branches:+ - master+ - 'releases/**'+ paths:+ - 'src/plugins/intel_npu/cmake/download_compiler_libs.cmake'+ workflow_dispatch:+ inputs:+ before_sha:+ description: 'Base commit SHA (old revision) for dry-run comparison'+ required: true+ after_sha:+ description: 'Head commit SHA (new revision) for dry-run comparison'+ required: true++permissions: read-all++concurrency:+ group: ${{ github.workflow }}-${{ github.ref }}+ cancel-in-progress: false++jobs:+ notify-npu-cip-bump:+ runs-on: ubuntu-latest+ timeout-minutes: 30+ permissions:+ contents: read+ pull-requests: write+ env:+ FILE_PATH: src/plugins/intel_npu/cmake/download_compiler_libs.cmake+ TRACKED_VARS: >-+ PLUGIN_COMPILER_WINDOWS_2022_CHECKSUM+ PLUGIN_COMPILER_UBUNTU_22_04_CHECKSUM+ PLUGIN_COMPILER_UBUNTU_24_04_CHECKSUM+ PLUGIN_COMPILER_UBUNTU_26_04_CHECKSUM+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ steps:+ # Sparse checkout only; the repository is far too large to check out in full.+ - name: Check out notification scripts+ uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0+ with:+ sparse-checkout: .github/scripts+ sparse-checkout-cone-mode: false+ fetch-depth: 1++ - name: Detect CiP value-level change+ id: detect+ env:+ EVENT_NAME: ${{ github.event_name }}+ INPUT_BEFORE_SHA: ${{ github.event.inputs.before_sha }}+ INPUT_AFTER_SHA: ${{ github.event.inputs.after_sha }}+ PUSH_BEFORE_SHA: ${{ github.event.before }}+ PUSH_AFTER_SHA: ${{ github.sha }}+ GITHUB_SERVER_URL: ${{ github.server_url }}+ GITHUB_REF_NAME: ${{ github.ref_name }}+ NPU_CIP_NOTIFY_LOGINS: ${{ vars.NPU_CIP_NOTIFY_LOGINS }}+ run: python3 .github/scripts/npu_cip_detect_bump.py++ - name: Post GitHub notification on pull request+ if: steps.detect.outputs.changed == 'true' && github.event_name == 'push'+ env:+ NOTIFY_LOGINS: ${{ vars.NPU_CIP_NOTIFY_LOGINS }}+ PR_NUMBER: ${{ steps.detect.outputs.pr_number }}+ run: |+ set -euo pipefail+ if [[ -z "${NOTIFY_LOGINS// /}" ]]; then+ echo "NPU_CIP_NOTIFY_LOGINS not set; skipping GitHub @mention comment."+ exit 0+ fi+ if [[ -z "${PR_NUMBER}" ]]; then+ echo "::warning::No pull request linked to this bump; cannot post @mention comment."+ exit 0+ fi+ gh pr comment "${PR_NUMBER}" --repo "${GITHUB_REPOSITORY}" --body-file body.md+ echo "Posted NPU CiP bump notification to PR #${PR_NUMBER}."++ - name: Send Teams notification+ if: steps.detect.outputs.changed == 'true' && github.event_name == 'push'+ env:+ TEAMS_WEBHOOK_URL: ${{ secrets.NPU_CIP_TEAMS_WEBHOOK_URL }}+ CARD_DATE: ${{ steps.detect.outputs.date }}+ CARD_BRANCH: ${{ steps.detect.outputs.branch }}+ CARD_COMMIT_URL: ${{ steps.detect.outputs.commit_url }}+ CARD_AUTHOR: ${{ steps.detect.outputs.author }}+ CARD_PR_INFO: ${{ steps.detect.outputs.pr_info }}+ CARD_PR_URL: ${{ steps.detect.outputs.pr_url }}+ CARD_CHANGES: ${{ steps.detect.outputs.changes }}+ CARD_REPO: ${{ github.repository }}+ CARD_MENTION_UPNS: ${{ vars.NPU_CIP_TEAMS_MENTION_UPNS }}+ run: python3 .github/scripts/npu_cip_notify_teams.py