Skip to content

feat: add 'make test' to v2's workflow #3379

New issue

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

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

Already on ? Sign in to your account

Open
wants to merge 2 commits into
base: v2/master
Choose a base branch
from

Conversation

airween
Copy link
Member

what

This PR adds mod_security2 module's own test cases to the GH workflow.

The new job uses the same matrix as the existing one, but we can't use --enable-assertions configure option (which is important with the valid configuration, where we do not use invalid values), because then the test cases which check invalid values would throw an assert error.

why

The module's make tests command hasn't been working for some time, because the PCRE2 modifications weren't applied that code. With some recent PR's those part of code were aligned, so make test works again.

@airweenairween requested review from theseion and fzipi May 11, 2025 08:19
@@ -74,3 +74,39 @@ jobs:
- name: Show mod_security2 audit log
if: always()
run: sudo cat /var/log/apache2/modsec_audit.log

Copy link
Collaborator

Choose a reason for hiding this comment

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

Run the build job until make install, then reuse the artefacts for building and testing. Don't build the artefacts twice.

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean I should insert the rebuild module and make install part between install module and prepare config steps? (After line 40)

If yes, then that has one advantage: we do not run twice almost the whole process, and one disadvantage: in case of error we have to open the GH log. Now we can see the name of the task, eg.

test-linux (ubuntu-22.04, x32, gcc, with pcre, no study, no jit, --enable-pcre-study=no)

vs.

build-linux (ubuntu-22.04, x32, gcc, with pcre, no study, no jit, --enable-pcre-study=no)

(the whole list is here).

Copy link
Collaborator

Choose a reason for hiding this comment

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

and one disadvantage: in case of error we have to open the GH log
I don't see that as an issue.

I would continue to use two jobs. Upload the build output from the build job and then download it for the test job: https://docs..com/en/actions/writing-workflows/choosing-what-your-workflow-does/storing-and-sharing-data-from-a-workflow#passing-data-between-jobs-in-a-workflow.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, I don't understand this:

Upload the build output from the build job and then download it for the test job

We definitely must rebuild again with different configure arguments (namely without --enable-assertions), so if you take a look at line 35 and line 105, you can see that from that point the two jobs are different. We can save (and upload) available data till that point - which (I guess) makes no sense.

Copy link
Contributor

@fzipi fzipi left a comment

Choose a reason for hiding this comment

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

I'll suggest you also to pin versions to well-known hashes and do not use master for versions unless necessary.

There is a nice tool to do this.

run: ./autogen.sh
- name: configure ${{ matrix.configure.label }}
run: ./configure ${{ matrix.configure.opt }} 'CFLAGS=-Werror=format-security'
- uses: ammaraskar/gcc-problem-matcher@master
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- uses: ammaraskar/gcc-problem-matcher@master
- uses: ammaraskar/gcc-problem-matcher@0f9c86f9e693db67dacf53986e1674de5f2e5f28 # ratchet:ammaraskar/[email protected]

run: |
sudo apt-get update -y -qq
sudo apt-get install -y apache2-dev libxml2-dev liblua5.1-0-dev libcurl4-gnutls-dev libpcre2-dev pkg-config libyajl-dev apache2 apache2-bin apache2-data
- uses: actions/checkout@v2
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- uses: actions/checkout@v2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4

@airween
Copy link
Member Author

I'll suggest you also to pin versions to well-known hashes and do not use master for versions unless necessary.

There is a nice tool to do this.

Sorry to ask, what is the advantage of using this form? Why isn't good to use the current master state?

@fzipi
Copy link
Contributor

I'll suggest you also to pin versions to well-known hashes and do not use master for versions unless necessary.
There is a nice tool to do this.

Sorry to ask, what is the advantage of using this form? Why isn't good to use the current master state?

Supply chain attacks? See:

@airween
Copy link
Member Author

Supply chain attacks? See:

Thanks.

If I'm right, if we use hash's then we should have to care with new releases.

I think this PR is outside of this, so can we skip this change now? Later I try to align these as you suggested with other necessary configuration.

@fzipi
Copy link
Contributor

Sounds good. Renovatebot can take care of that, let's do it in a different pr then.

Sign up for free to join this conversation on . Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants