Skip to content

Fix workflow to use $/ syntax for repo-local paths - #1333

Open
dixonjoel wants to merge 2 commits into
mainfrom
users/jdixon/workflow-self-repo-syntax
Open

dixonjoel wants to merge 2 commits into
mainfrom
users/jdixon/workflow-self-repo-syntax

Conversation

@dixonjoel

Copy link
Copy Markdown
Collaborator

What does this Pull Request accomplish?

Fix code scanning problems found at
https://github.com/ni/measurement-plugin-python/security/code-scanning

Why should this Pull Request be merged?

Repo should use the recommended workflow syntax.

What testing has been done?

PR

@bkeryan

bkeryan commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

@dixonjoel We are seeing this behavior on other repos. It is tracked with bug AB#4147280. The workaround is to pin the workflows to 3.14.8. I prefer doing this in a separate PR so it's easier to revert.

    - Installing ni-measurement-plugin-sdk-service (3.2.0.dev0 D:/a/measurement-plugin-python/measurement-plugin-python/packages/service)
  
    CalledProcessError
  
    Command '['C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts\\python.exe', '-I', '-W', 'ignore', '-c', 'import json\nimport os\nimport platform\nimport sys\nimport sysconfig\n\nINTERPRETER_SHORT_NAMES = {\n    "python": "py",\n    "cpython": "cp",\n    "pypy": "pp",\n    "ironpython": "ip",\n    "jython": "jy",\n}\n\n\ndef interpreter_version():\n    version = sysconfig.get_config_var("interpreter_version")\n    if version:\n        version = str(version)\n    else:\n        version = _version_nodot(sys.version_info[:2])\n\n    return version\n\n\ndef _version_nodot(version):\n    return "".join(map(str, version))\n\n\nif hasattr(sys, "implementation"):\n    info = sys.implementation.version\n    iver = "{0.major}.{0.minor}.{0.micro}".format(info)\n    kind = info.releaselevel\n    if kind != "final":\n        iver += kind[0] + str(info.serial)\n\n    implementation_name = sys.implementation.name\nelse:\n    iver = "0"\n    implementation_name = platform.python_implementation().lower()\n\nenv = {\n    "implementation_name": implementation_name,\n    "implementation_version": iver,\n    "os_name": os.name,\n    "platform_machine": platform.machine(),\n    "platform_release": platform.release(),\n    "platform_system": platform.system(),\n    "platform_version": platform.version(),\n    "python_full_version": platform.python_version().rstrip("+"),\n    "platform_python_implementation": platform.python_implementation(),\n    "python_version": ".".join(platform.python_version_tuple()[:2]),\n    "sys_platform": sys.platform,\n    "version_info": tuple(sys.version_info),\n    # Extra information\n    "interpreter_name": INTERPRETER_SHORT_NAMES.get(\n        implementation_name, implementation_name\n    ),\n    "interpreter_version": interpreter_version(),\n    "sysconfig_platform": sysconfig.get_platform(),\n}\n\nprint(json.dumps(env))\n']' returned non-zero exit status 1.
  
    at C:\hostedtoolcache\windows\Python\3.14.9\x64\Lib\subprocess.py:578 in run
         574|             # We don't call process.wait() as .__exit__ does that for us.
         575|             raise
         576|         retcode = process.poll()
         577|         if check and retcode:
      >  578|             raise CalledProcessError(retcode, process.args,
         579|                                      output=stdout, stderr=stderr)
         580|     return CompletedProcess(process.args, retcode, stdout, stderr)
         581| 
         582| 
  
  The following error occurred when trying to handle this error:
  
  
    EnvCommandError
  
    Command ['C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts\\python.exe', '-I', '-W', 'ignore', '-c', 'import json\nimport os\nimport platform\nimport sys\nimport sysconfig\n\nINTERPRETER_SHORT_NAMES = {\n    "python": "py",\n    "cpython": "cp",\n    "pypy": "pp",\n    "ironpython": "ip",\n    "jython": "jy",\n}\n\n\ndef interpreter_version():\n    version = sysconfig.get_config_var("interpreter_version")\n    if version:\n        version = str(version)\n    else:\n        version = _version_nodot(sys.version_info[:2])\n\n    return version\n\n\ndef _version_nodot(version):\n    return "".join(map(str, version))\n\n\nif hasattr(sys, "implementation"):\n    info = sys.implementation.version\n    iver = "{0.major}.{0.minor}.{0.micro}".format(info)\n    kind = info.releaselevel\n    if kind != "final":\n        iver += kind[0] + str(info.serial)\n\n    implementation_name = sys.implementation.name\nelse:\n    iver = "0"\n    implementation_name = platform.python_implementation().lower()\n\nenv = {\n    "implementation_name": implementation_name,\n    "implementation_version": iver,\n    "os_name": os.name,\n    "platform_machine": platform.machine(),\n    "platform_release": platform.release(),\n    "platform_system": platform.system(),\n    "platform_version": platform.version(),\n    "python_full_version": platform.python_version().rstrip("+"),\n    "platform_python_implementation": platform.python_implementation(),\n    "python_version": ".".join(platform.python_version_tuple()[:2]),\n    "sys_platform": sys.platform,\n    "version_info": tuple(sys.version_info),\n    # Extra information\n    "interpreter_name": INTERPRETER_SHORT_NAMES.get(\n        implementation_name, implementation_name\n    ),\n    "interpreter_version": interpreter_version(),\n    "sysconfig_platform": sysconfig.get_platform(),\n}\n\nprint(json.dumps(env))\n'] errored with the following return code 1
    
    Error output:
    Could not find platform independent libraries <prefix>
    Python path configuration:
      PYTHONHOME = (not set)
      PYTHONPATH = (not set)
      program name = 'C:\Users\RUNNER~1\AppData\Local\Temp\tmpmxvo6jca\.venv\Scripts\python.exe'
      isolated = 1
      environment = 0
      user site = 0
      safe_path = 1
      import site = 1
      is in build tree = 0
      stdlib dir = 'D:\a\measurement-plugin-python\measurement-plugin-python\packages\generator\Lib'
      sys.path[0] = (not set)
      sys._base_executable = 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts\\python.exe'
      sys.base_prefix = 'D:\\a\\measurement-plugin-python\\measurement-plugin-python\\packages\\generator'
      sys.base_exec_prefix = 'D:\\a\\measurement-plugin-python\\measurement-plugin-python\\packages\\generator'
      sys.platlibdir = 'DLLs'
      sys.executable = 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts\\python.exe'
      sys.prefix = 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv'
      sys.exec_prefix = 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv'
      sys.path = [
        'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts\\python314.zip',
        'D:\\a\\measurement-plugin-python\\measurement-plugin-python\\packages\\generator',
        'D:\\a\\measurement-plugin-python\\measurement-plugin-python\\packages\\generator\\Lib',
        'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts',
      ]
    Fatal Python error: Failed to import encodings module
    Python runtime state: core initialized
    ModuleNotFoundError: No module named 'encodings'
    
    Current thread 0x00000374 (most recent call first):
      <no Python frame>
    
  
    at D:\a\_temp\poetry\home\Lib\site-packages\poetry\utils\env\base_env.py:434 in _run
        430|                 output = subprocess.check_output(
        431|                     cmd, stderr=stderr, env=env, text=True, encoding=encoding, **kwargs
        432|                 )
        433|         except CalledProcessError as e:
      > 434|             raise EnvCommandError(e)
        435| 
        436|         return output
        437| 
        438|     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:
  
  Cannot install ni-measurement-plugin-sdk-service.

@dixonjoel

Copy link
Copy Markdown
Collaborator Author

@dixonjoel We are seeing this behavior on other repos. It is tracked with bug AB#4147280. The workaround is to pin the workflows to 3.14.8. I prefer doing this in a separate PR so it's easier to revert.

    - Installing ni-measurement-plugin-sdk-service (3.2.0.dev0 D:/a/measurement-plugin-python/measurement-plugin-python/packages/service)
  
    CalledProcessError
  
    Command '['C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts\\python.exe', '-I', '-W', 'ignore', '-c', 'import json\nimport os\nimport platform\nimport sys\nimport sysconfig\n\nINTERPRETER_SHORT_NAMES = {\n    "python": "py",\n    "cpython": "cp",\n    "pypy": "pp",\n    "ironpython": "ip",\n    "jython": "jy",\n}\n\n\ndef interpreter_version():\n    version = sysconfig.get_config_var("interpreter_version")\n    if version:\n        version = str(version)\n    else:\n        version = _version_nodot(sys.version_info[:2])\n\n    return version\n\n\ndef _version_nodot(version):\n    return "".join(map(str, version))\n\n\nif hasattr(sys, "implementation"):\n    info = sys.implementation.version\n    iver = "{0.major}.{0.minor}.{0.micro}".format(info)\n    kind = info.releaselevel\n    if kind != "final":\n        iver += kind[0] + str(info.serial)\n\n    implementation_name = sys.implementation.name\nelse:\n    iver = "0"\n    implementation_name = platform.python_implementation().lower()\n\nenv = {\n    "implementation_name": implementation_name,\n    "implementation_version": iver,\n    "os_name": os.name,\n    "platform_machine": platform.machine(),\n    "platform_release": platform.release(),\n    "platform_system": platform.system(),\n    "platform_version": platform.version(),\n    "python_full_version": platform.python_version().rstrip("+"),\n    "platform_python_implementation": platform.python_implementation(),\n    "python_version": ".".join(platform.python_version_tuple()[:2]),\n    "sys_platform": sys.platform,\n    "version_info": tuple(sys.version_info),\n    # Extra information\n    "interpreter_name": INTERPRETER_SHORT_NAMES.get(\n        implementation_name, implementation_name\n    ),\n    "interpreter_version": interpreter_version(),\n    "sysconfig_platform": sysconfig.get_platform(),\n}\n\nprint(json.dumps(env))\n']' returned non-zero exit status 1.
  
    at C:\hostedtoolcache\windows\Python\3.14.9\x64\Lib\subprocess.py:578 in run
         574|             # We don't call process.wait() as .__exit__ does that for us.
         575|             raise
         576|         retcode = process.poll()
         577|         if check and retcode:
      >  578|             raise CalledProcessError(retcode, process.args,
         579|                                      output=stdout, stderr=stderr)
         580|     return CompletedProcess(process.args, retcode, stdout, stderr)
         581| 
         582| 
  
  The following error occurred when trying to handle this error:
  
  
    EnvCommandError
  
    Command ['C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts\\python.exe', '-I', '-W', 'ignore', '-c', 'import json\nimport os\nimport platform\nimport sys\nimport sysconfig\n\nINTERPRETER_SHORT_NAMES = {\n    "python": "py",\n    "cpython": "cp",\n    "pypy": "pp",\n    "ironpython": "ip",\n    "jython": "jy",\n}\n\n\ndef interpreter_version():\n    version = sysconfig.get_config_var("interpreter_version")\n    if version:\n        version = str(version)\n    else:\n        version = _version_nodot(sys.version_info[:2])\n\n    return version\n\n\ndef _version_nodot(version):\n    return "".join(map(str, version))\n\n\nif hasattr(sys, "implementation"):\n    info = sys.implementation.version\n    iver = "{0.major}.{0.minor}.{0.micro}".format(info)\n    kind = info.releaselevel\n    if kind != "final":\n        iver += kind[0] + str(info.serial)\n\n    implementation_name = sys.implementation.name\nelse:\n    iver = "0"\n    implementation_name = platform.python_implementation().lower()\n\nenv = {\n    "implementation_name": implementation_name,\n    "implementation_version": iver,\n    "os_name": os.name,\n    "platform_machine": platform.machine(),\n    "platform_release": platform.release(),\n    "platform_system": platform.system(),\n    "platform_version": platform.version(),\n    "python_full_version": platform.python_version().rstrip("+"),\n    "platform_python_implementation": platform.python_implementation(),\n    "python_version": ".".join(platform.python_version_tuple()[:2]),\n    "sys_platform": sys.platform,\n    "version_info": tuple(sys.version_info),\n    # Extra information\n    "interpreter_name": INTERPRETER_SHORT_NAMES.get(\n        implementation_name, implementation_name\n    ),\n    "interpreter_version": interpreter_version(),\n    "sysconfig_platform": sysconfig.get_platform(),\n}\n\nprint(json.dumps(env))\n'] errored with the following return code 1
    
    Error output:
    Could not find platform independent libraries <prefix>
    Python path configuration:
      PYTHONHOME = (not set)
      PYTHONPATH = (not set)
      program name = 'C:\Users\RUNNER~1\AppData\Local\Temp\tmpmxvo6jca\.venv\Scripts\python.exe'
      isolated = 1
      environment = 0
      user site = 0
      safe_path = 1
      import site = 1
      is in build tree = 0
      stdlib dir = 'D:\a\measurement-plugin-python\measurement-plugin-python\packages\generator\Lib'
      sys.path[0] = (not set)
      sys._base_executable = 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts\\python.exe'
      sys.base_prefix = 'D:\\a\\measurement-plugin-python\\measurement-plugin-python\\packages\\generator'
      sys.base_exec_prefix = 'D:\\a\\measurement-plugin-python\\measurement-plugin-python\\packages\\generator'
      sys.platlibdir = 'DLLs'
      sys.executable = 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts\\python.exe'
      sys.prefix = 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv'
      sys.exec_prefix = 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv'
      sys.path = [
        'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts\\python314.zip',
        'D:\\a\\measurement-plugin-python\\measurement-plugin-python\\packages\\generator',
        'D:\\a\\measurement-plugin-python\\measurement-plugin-python\\packages\\generator\\Lib',
        'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\tmpmxvo6jca\\.venv\\Scripts',
      ]
    Fatal Python error: Failed to import encodings module
    Python runtime state: core initialized
    ModuleNotFoundError: No module named 'encodings'
    
    Current thread 0x00000374 (most recent call first):
      <no Python frame>
    
  
    at D:\a\_temp\poetry\home\Lib\site-packages\poetry\utils\env\base_env.py:434 in _run
        430|                 output = subprocess.check_output(
        431|                     cmd, stderr=stderr, env=env, text=True, encoding=encoding, **kwargs
        432|                 )
        433|         except CalledProcessError as e:
      > 434|             raise EnvCommandError(e)
        435| 
        436|         return output
        437| 
        438|     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:
  
  Cannot install ni-measurement-plugin-sdk-service.

#1334

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

    52 files      52 suites   1h 16m 57s ⏱️
   689 tests    689 ✅     0 💤 0 ❌
20 700 runs  19 644 ✅ 1 056 💤 0 ❌

Results for commit eea825d.

♻️ This comment has been updated with latest results.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants