Skip to content

Commit

Permalink
.sync/workflows/codeql-platform: Update irrelevant plugin removal dir
Browse files Browse the repository at this point in the history
Updates the directory used for irrelevant plugin removal in this
workflow to match codeql.yml which using the pytool directory rather
than the directory the CodeQL plugin is found in.

This is important because the CodeQL plugin moved from .pytool to
BaseTools in Mu release 202311 so the plugin dir needs to be fixed
rather than relative to the CodeQL plugin location.

Signed-off-by: Michael Kubacki <[email protected]>
  • Loading branch information
makubacki committed Feb 7, 2024
1 parent 170b872 commit 7760245
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions .sync/workflows/leaf/codeql-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,32 @@ jobs:
working-directory: "Z:"
run: stuart_update -c ${{ matrix.build_file }} -t DEBUG -a ${{ matrix.archs }} TOOL_CHAIN_TAG=${{ matrix.tool_chain_tag }} --codeql

- name: Find pytool Plugin Directory
id: find_pytool_dir
shell: python
run: |
import os
import sys
from pathlib import Path
# Find the plugin directory that contains the Compiler plugin
plugin_dir = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('.pytool/Plugin/CompilerPlugin'))
# This should only be found once
if len(plugin_dir) == 1:
# If the directory is found get the parent Plugin directory
plugin_dir = str(plugin_dir[0].parent)
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f'pytool_plugin_dir={plugin_dir}', file=fh)
else:
print("::error title=Workspace Error!::Failed to find Mu Basecore .pytool/Plugin directory!")
sys.exit(1)
- name: Remove CI Plugins Irrelevant to CodeQL
shell: python
env:
CODEQL_PLUGIN_DIR: ${{ steps.find_dir.outputs.codeql_plugin_dir }}
PYTOOL_PLUGIN_DIR: ${{ steps.find_pytool_dir.outputs.pytool_plugin_dir }}
run: |
import os
import shutil
Expand All @@ -388,7 +410,7 @@ jobs:
# Only these two plugins are needed for CodeQL
plugins_to_keep = ['CodeQL', 'CompilerPlugin']
plugin_dir = Path(os.environ['CODEQL_PLUGIN_DIR']).parent.absolute()
plugin_dir = Path(os.environ['PYTOOL_PLUGIN_DIR']).absolute()
if plugin_dir.is_dir():
for dir in plugin_dir.iterdir():
if str(dir.stem) not in plugins_to_keep:
Expand Down

0 comments on commit 7760245

Please sign in to comment.