You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/08/18 21:01:06 UTC

[GitHub] [tvm] areusch commented on a diff in pull request #12389: [ci] Check for timestamps in Jenkinsfile changes

areusch commented on code in PR #12389:
URL: https://github.com/apache/tvm/pull/12389#discussion_r949597085


##########
ci/jenkins/generate.py:
##########
@@ -72,12 +75,49 @@
 }
 
 
-def lines_without_generated_tag(content):
+def lines_without_generated_tag(content: str) -> List[str]:
     return [
         line for line in content.splitlines(keepends=True) if not line.startswith("// Generated at")
     ]
 
 
+def changed_files() -> List[str]:
+    proc = subprocess.run(
+        ["git", "diff", "origin/main", "HEAD", "--name-only"],

Review Comment:
   should we check against e.g. GIT_BRANCH to make this portable across different upstream branches?



##########
ci/jenkins/generate.py:
##########
@@ -72,12 +75,49 @@
 }
 
 
-def lines_without_generated_tag(content):
+def lines_without_generated_tag(content: str) -> List[str]:
     return [
         line for line in content.splitlines(keepends=True) if not line.startswith("// Generated at")
     ]
 
 
+def changed_files() -> List[str]:
+    proc = subprocess.run(
+        ["git", "diff", "origin/main", "HEAD", "--name-only"],
+        check=True,
+        stdout=subprocess.PIPE,
+        encoding="utf-8",
+    )
+    files = [f.strip() for f in proc.stdout.strip().split("\n")]
+    files = [f for f in files if f != ""]
+    return files
+
+
+def check_timestamp() -> None:
+    """
+    Assert that the git diff against main contains a timestamp
+    """
+    files = changed_files()
+
+    # Check the Jenkinsfile timestamp if the templates were edited
+    if any(fnmatch.fnmatch(f, "ci/jenkins/*.j2") for f in files):
+        proc = subprocess.run(
+            ["git", "diff", "origin/main", "HEAD"],

Review Comment:
   shall we limit to Jenkinsfile?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org