[None][infra] Lock generation pipeline update (#9084)

Signed-off-by: Yuanjing Xue <197832395+yuanjingx87@users.noreply.github.com>
This commit is contained in:
yuanjingx87 2025-11-14 10:12:25 -08:00 committed by GitHub
parent bed4e95e9f
commit 05b5336ab6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 1 deletions

View File

@ -81,7 +81,7 @@ def generate()
echo "No update that needs to be checked in"
} else {
sh "git status"
sh "git add \$(find . -type f \\( -name 'poetry.lock' -o -name 'pyproject.toml' \\))"
sh "git add \$(find . -type f \\( -name 'poetry.lock' -o -name 'pyproject.toml' -o -name 'metadata.json' \\))"
sh "git commit -s -m \"[None][infra] Check in most recent lock file from nightly pipeline\""
withCredentials([string(credentialsId: CREDENTIAL_ID, variable: 'API_TOKEN')]) {
def authedUrl = LLM_REPO.replaceFirst('https://', "https://svc_tensorrt:${API_TOKEN}@")
@ -111,6 +111,12 @@ pipeline {
timestamps()
}
triggers {
parameterizedCron('''
H 2 * * * %branchName=main;repoUrlKey=tensorrt_llm_github
''')
}
stages {
stage("Generating Poetry Locks"){
agent {

View File

@ -27,11 +27,13 @@ python3 scripts/generate_lock_files.py --path <path>/requirements.txt
"""
import argparse
import json
import os
import re
import shutil
import subprocess
import sys
from datetime import datetime, timezone
from pathlib import Path
sys.path.insert(0, os.getcwd())
@ -74,6 +76,24 @@ def get_project_info(path: str):
return {"name": name, "version": version}
def generate_metadata_json():
try:
commit_hash = subprocess.check_output(["git", "rev-parse", "HEAD"],
text=True).strip()
except subprocess.CalledProcessError as e:
print(f"Error retrieving git commit hash: {e}")
raise
data = {
"commit_hash": commit_hash,
"timestamp": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
}
with open(f"{FOLDER_SECURITY_SCANNING}/metadata.json",
"w",
encoding="utf-8") as f:
json.dump(data, f, indent=2)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Lock files generator",
@ -93,6 +113,7 @@ if __name__ == "__main__":
if os.path.exists(FOLDER_SECURITY_SCANNING):
shutil.rmtree(FOLDER_SECURITY_SCANNING)
os.mkdir(FOLDER_SECURITY_SCANNING)
generate_metadata_json()
# generate pyproject.toml and poetry.lock files in the same location
for path in paths: