code: def update_jenkinsfile(source: Path) -> ChangeData:
      destination = GENERATED_DIR / source.stem
  
      data["generated_time"] = datetime.datetime.now().isoformat()
      if destination.exists():
          with open(destination) as f:
              old_generated_content = f.read()
  
          timestamp_match = re.search(
              r"^// Generated at (.*)$",
              old_generated_content,
              flags=re.MULTILINE,
          )
          if not timestamp_match:
              raise RuntimeError(
                  f"Could not find timestamp in Jenkinsfile: {destination.relative_to(TEMPLATES_DIR)}"
              )
          original_timestamp = timestamp_match.groups()[0]
  
      environment = jinja2.Environment(
          loader=jinja2.FileSystemLoader(TEMPLATES_DIR),
          undefined=jinja2.StrictUndefined,
          lstrip_blocks=True,
          trim_blocks=True,
          keep_trailing_newline=True,
      )
      template = environment.get_template(
          str(source.relative_to(TEMPLATES_DIR))
      )
      new_content = template.render(**data)
  
      if not destination.exists():
          # New file, create it from scratch
          return ChangeData(
              diff=new_content,
              content=new_content,
              source=source,
              destination=destination,
          )
  
      diff = [
          line
          for line in difflib.unified_diff(
              lines_without_generated_tag(old_generated_content),
              lines_without_generated_tag(new_content),
          )
      ]
      change = change_type(diff)
      if (
          not args.force
          and change == Change.IMAGES_ONLY
          or change == Change.NONE
      ):
          if change != Change.NONE:
              print(
                  "Detected only Docker-image name changes, skipping timestamp update"
              )
          new_content = new_content.replace(
              data["generated_time"], original_timestamp
          )
  
      diff = "".join(diff)
  
      return ChangeData(
          diff=diff,
          content=new_content,
          source=source,
          destination=destination,
      )
  
file_path: tvm/ci/jenkins/generate.py
imports: import jinja2
  import argparse
  import difflib
  import datetime
  import re
  import textwrap
  from pathlib import Path
  from typing import List, Optional
  from dataclasses import dataclass
  from data import data
label_desc: Use image node_id 3 for calling a global function with example usage: update_jenkinsfile(source) and returns: ChangeData, ChangeData