Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smoke_test: Fix Failure on Windows GitHub Workflow #571

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rlxdev
Copy link
Collaborator

@rlxdev rlxdev commented Jan 16, 2025

🗣 Description

Fixed the smoke test for the Windows workflow by correcting the use of the Python virtual environments for both OS flows. GitHub uses 2 drives in its VM/container when running a workflow on Windows, and it looks like OPA isn't handling it correctly when the current working directory is on one drive and is being passed input files on another drive. Regardless, we should be using the Python virtual environment correctly, and this fix takes care of the OPA issue as well (because OPA is run with the current working directory on the same drive as the input data).

The default OPA version used in the smoke test has been updated to v1.0.0. We really should be running the latest version of OPA for this test so we can catch any OPA issues before ScubaGoggles users encounter them.

Closes #529

🧪 Testing

Ran the smoke test workflow with both macOS and Windows runners and the tests complete successfully.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • If applicable, All future TODOs are captured in issues, which are referenced in the PR description.
  • The relevant issues PR resolves are linked preferably via closing keywords.
  • All relevant type-of-change labels have been added.
  • I have read and agree to the CONTRIBUTING.md document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated to reflect the changes in this PR.
  • Tests have been added and/or modified to cover the changes in this PR.
  • All new and existing tests pass.

✅ Pre-merge Checklist

  • This PR has been smoke tested to ensure main is in a functional state when this PR is merged.
  • Squash all commits into one PR level commit using the Squash and merge button.

✅ Post-merge Checklist

  • Delete the branch to clean up.
  • Close issues resolved by this PR if the closing keywords did not activate.

@rlxdev rlxdev added the bug This issue or pull request addresses broken functionality label Jan 16, 2025
@rlxdev rlxdev linked an issue Jan 16, 2025 that may be closed by this pull request
@rlxdev rlxdev force-pushed the 529-fix-smoke-test branch from 3d799fe to dd1d14e Compare January 16, 2025 18:49
@rlxdev rlxdev force-pushed the 529-fix-smoke-test branch from dd1d14e to 40f8602 Compare January 16, 2025 19:06
@rlxdev rlxdev self-assigned this Jan 22, 2025
@@ -32,7 +32,7 @@ on:
description: "Choose OPA version"
required: true
type: string
default: "v0.60.0"
default: "v1.0.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend we pull in the latest OPA version rather than having to manually update default version of the input variable if we want latest. Then make this input optional but override the default if there's a diff.

OPA v1.0.0 is already out of date as OPA did a patch release to [OPA v1.0.1[(https://github.com/open-policy-agent/opa/releases/tag/v1.0.1) to address Go CVEs.

I did something similar on the ScubaGear side to check for latest OPA version updates

$LatestOPAVersion = Invoke-RestMethod -Uri "https://api.github.com/repos/open-policy-agent/opa/releases/latest" | Select-Object -ExpandProperty tag_name

Bash equivalent

latest_opa_version=$(curl -s https://api.github.com/repos/open-policy-agent/opa/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/')

@@ -53,9 +53,9 @@ jobs:

# Default values for other events
else
operatingsystem_val="['macos-latest']"
operatingsystem_val="['windows-latest', 'macos-latest']"
pythonversion_val="['3.10']"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than in DownloadAndInstall.md where we indicate "v3.9 or higher", I don't see any references to a definitive minimum supported python version in the code. Recommend we move this out of the workflow in favor of a more maintainable location that doesn't require a code change when we decide to bump to v3.11, etc. Setting a GitHub secret as "MIN_PYTHON_VERSION"="3.10" may be a short-term alternative.

Copy link
Collaborator

@mitchelbaker-cisa mitchelbaker-cisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran workflow manually against windows/macos with python versions 3.10, 3.11, 3.12 and latest OPA. All passed, but had to rerun the windows 3.12 test due to Google Policy API rate limits (something to keep in mind if testing multiple versions).

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue or pull request addresses broken functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Windows Smoke Test
3 participants