Skip to content

Conversation

@ggbecker
Copy link
Member

@ggbecker ggbecker commented Dec 2, 2025

Description:

  • Add ATEX testing to the upstream CI workflows
  • It posts the resulting tests link as a comment to the pull request when it finishes.

Rationale:

  • This aims to replace existing testing farm individual checks to a centralized ATEX execution that can run all CI upstream tests for PRs and manage them accordingly.
  • The PR as of now, runs only a single STIG hardening test on Centos Stream 8/9/10 to be served as a proof of concept. We should eventually extend to include more tests similarly as the current upstream CI.

@ggbecker ggbecker added this to the 0.1.80 milestone Dec 2, 2025
@ggbecker ggbecker added the Test Suite Update in Test Suite. label Dec 2, 2025
@ggbecker ggbecker force-pushed the atex-workflow-tests-3 branch from f1dae23 to 301dab3 Compare December 2, 2025 12:32
@ggbecker
Copy link
Member Author

ggbecker commented Dec 2, 2025

From: https://github.com/ComplianceAsCode/content/actions/runs/19858710726/job/56915038821?pr=14203

   File "/usr/local/lib/python3.13/site-packages/atex/provisioner/testingfarm/api.py", line 507, in reserve
    if self.api.whoami()["token"]["ranch"] == "public":
       ~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/atex/provisioner/testingfarm/api.py", line 122, in whoami
    raise ValueError("whoami() requires an auth token")
ValueError: whoami() requires an auth token

I'm afraid the token will only be allowed to be used when we merge the pull request

https://github.com/ComplianceAsCode/content/pull/14203/files#diff-9581118f6672453f95900179c8eccc554c1b111682dab06bd16317909fdaf295R109

The same code with the same token is working fine on my fork: ggbecker#41

@@ -0,0 +1,88 @@
#!/usr/bin/python3
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#!/usr/bin/python3
#!/usr/bin/env python3

platform_name = f"cs{args.os_major_version}@{args.arch}"

# Hardware requirements for Testing Farm
# if args.arch == "x86_64":
Copy link
Member

Choose a reason for hiding this comment

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

Dead code should be removed, we can keep in history if needed

@@ -0,0 +1,128 @@
#!/usr/bin/python3
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#!/usr/bin/python3
#!/usr/bin/env python3

logger = logging.getLogger("ATEX")

# Parse command-line arguments
parser = argparse.ArgumentParser(description="Run tests on Testing Farm using atex")
Copy link
Member

Choose a reason for hiding this comment

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

So both of these script work, but are not structured like our other scripts (main method, parse_args, etc). Any reason for that? I would prefer that these scripts follow format of our other scripts.

libxslt-devel python3-setuptools gawk

- name: Install Python dependencies
run: pip install pcre2==0.4.0 -r requirements.txt -r test-requirements.txt
Copy link
Member

Choose a reason for hiding this comment

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

Do we just want add pcre2 to test-requirements.txt?


- name: Download test results - CentOS Stream 9
if: always()
uses: actions/download-artifact@v4
Copy link
Member

Choose a reason for hiding this comment

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

Use hashes, check latest version


- name: Download test results - CentOS Stream 10
if: always()
uses: actions/download-artifact@v4
Copy link
Member

Choose a reason for hiding this comment

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

Use hashes, check latest version


- name: Checkout ATEX HTML viewer
if: always()
uses: actions/checkout@v4
Copy link
Member

Choose a reason for hiding this comment

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

Use hashes, check latest version


# do faster queries than the default 30 secs, because we don't track
# many dozens of requests, just one
class FastRequest(api.Request):
Copy link
Member

Choose a reason for hiding this comment

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

Consider adding a docstring for why this class is needed.


- name: Run tests on Testing Farm
env:
TESTING_FARM_API_TOKEN: ${{ secrets.TESTING_FARM_API_TOKEN }}
Copy link
Member

Choose a reason for hiding this comment

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

IIRC, this will never be available since we are using pull_request.

We might need break this out into two jobs. One that builds using pull_request, then a second one that uses workflow_run to trigger the tests.

Also added restrictions to token permissions as suggested by github.
Use env in the shebang for python scripts.
Use fixed hash for github actions to prevent supply chain attacks.
Remove dead code.
Add pcre2 to the requirements.txt file.
@ggbecker
Copy link
Member Author

ggbecker commented Dec 3, 2025

I've addressed all the feedback provided and split the jobs into two workflows, one with the workflow_run as suggested by @Mab879 . Let's see how it behaves.

@openshift-ci
Copy link

openshift-ci bot commented Dec 3, 2025

@ggbecker: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-openshift-platform-compliance ccbbfcb link true /test e2e-aws-openshift-platform-compliance
ci/prow/e2e-aws-openshift-node-compliance ccbbfcb link true /test e2e-aws-openshift-node-compliance

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@Mab879 Mab879 self-assigned this Dec 3, 2025

steps:
- name: Checkout repository
uses: actions/checkout@v4
Copy link
Member

Choose a reason for hiding this comment

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

use hash, this applies other places in the PR, but I will not repeat.

with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: pr-info-9
Copy link
Member

Choose a reason for hiding this comment

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

Should this also be using the matrix? We do save this for all versions of RHEL.

libxslt-devel python3-setuptools gawk

- name: Install Python dependencies
run: pip install pcre2==0.4.0 -r requirements.txt -r test-requirements.txt
Copy link
Member

Choose a reason for hiding this comment

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

pcre2 should be in the requirements.txt file

pr_sha: ${{ steps.get_pr.outputs.pr_sha }}
steps:
- name: Download PR info
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v4
Copy link
Member

Choose a reason for hiding this comment

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

Checkout is on v6 let's upgrade to the latest. Please double check all versions of actions in this PR.

contents: read
actions: read
pull-requests: write
issues: write
Copy link
Member

Choose a reason for hiding this comment

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

Is issues: write really needed?

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

Labels

Test Suite Update in Test Suite.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants