Skip to content

Commit 05b5336

Browse files
authored
[None][infra] Lock generation pipeline update (NVIDIA#9084)
Signed-off-by: Yuanjing Xue <[email protected]>
1 parent bed4e95 commit 05b5336

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

jenkins/GenerateLock.groovy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def generate()
8181
echo "No update that needs to be checked in"
8282
} else {
8383
sh "git status"
84-
sh "git add \$(find . -type f \\( -name 'poetry.lock' -o -name 'pyproject.toml' \\))"
84+
sh "git add \$(find . -type f \\( -name 'poetry.lock' -o -name 'pyproject.toml' -o -name 'metadata.json' \\))"
8585
sh "git commit -s -m \"[None][infra] Check in most recent lock file from nightly pipeline\""
8686
withCredentials([string(credentialsId: CREDENTIAL_ID, variable: 'API_TOKEN')]) {
8787
def authedUrl = LLM_REPO.replaceFirst('https://', "https://svc_tensorrt:${API_TOKEN}@")
@@ -111,6 +111,12 @@ pipeline {
111111
timestamps()
112112
}
113113

114+
triggers {
115+
parameterizedCron('''
116+
H 2 * * * %branchName=main;repoUrlKey=tensorrt_llm_github
117+
''')
118+
}
119+
114120
stages {
115121
stage("Generating Poetry Locks"){
116122
agent {

scripts/generate_lock_file.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@
2727
"""
2828

2929
import argparse
30+
import json
3031
import os
3132
import re
3233
import shutil
3334
import subprocess
3435
import sys
36+
from datetime import datetime, timezone
3537
from pathlib import Path
3638

3739
sys.path.insert(0, os.getcwd())
@@ -74,6 +76,24 @@ def get_project_info(path: str):
7476
return {"name": name, "version": version}
7577

7678

79+
def generate_metadata_json():
80+
try:
81+
commit_hash = subprocess.check_output(["git", "rev-parse", "HEAD"],
82+
text=True).strip()
83+
except subprocess.CalledProcessError as e:
84+
print(f"Error retrieving git commit hash: {e}")
85+
raise
86+
87+
data = {
88+
"commit_hash": commit_hash,
89+
"timestamp": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
90+
}
91+
with open(f"{FOLDER_SECURITY_SCANNING}/metadata.json",
92+
"w",
93+
encoding="utf-8") as f:
94+
json.dump(data, f, indent=2)
95+
96+
7797
if __name__ == "__main__":
7898
parser = argparse.ArgumentParser(
7999
description="Lock files generator",
@@ -93,6 +113,7 @@ def get_project_info(path: str):
93113
if os.path.exists(FOLDER_SECURITY_SCANNING):
94114
shutil.rmtree(FOLDER_SECURITY_SCANNING)
95115
os.mkdir(FOLDER_SECURITY_SCANNING)
116+
generate_metadata_json()
96117

97118
# generate pyproject.toml and poetry.lock files in the same location
98119
for path in paths:

0 commit comments

Comments
 (0)