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

SAST tests: Creation of tests for SAST tasks #1843

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jperezdealgaba
Copy link
Contributor

Before you complete this pull request ...

Look for any open pull requests in the repository with the title "e2e-tests update" and
see if there are recent e2e-tests updates that will be applicable to your change.

@jperezdealgaba jperezdealgaba force-pushed the sast-tests branch 4 times, most recently from d895de6 to b472131 Compare January 26, 2025 18:10
@jperezdealgaba
Copy link
Contributor Author

@kdudka Would you mind giving a preliminary review? There are a few discussions needed here

workspace: tests-workspace
params:
- name: url
value: https://github.com/jperezdealgaba/test_unicode_control
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kdudka This is the repo that was used to test the original task (https://gitlab.cee.redhat.com/chhan/unicode_control_test). I moved it to GitHub as the tests couldn't resolve to the internal GitLab.
This is in my personal organization, I really think this should be moved to a more "professional" org if not choosing a different repository.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ralphbean Could we include the test data into https://github.com/konflux-ci/testrepo or another project in the konflux-ci GitHub namespace so that the tests do not depend on 3rd party repositories?

Copy link
Member

Choose a reason for hiding this comment

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

@avi-biton @yftacherzog and @gbenhaim, can I defer to you guys on @kdudka's question?

Copy link
Member

Choose a reason for hiding this comment

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

I think it will make better sense to create another repo under https://github.com/konflux-ci instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Who should be responsible for creating them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe creating a single repo called sast-testing-examples for examples? We can later there store all sast-examples and have a very big note in the README.md saying that the repo contains insecure code.

cc/ @kdudka

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good. As for the name, I would start with the test- prefix, e.g. test-data-sast. In case other test repos need to be created later on, they would be visually separated from other repos (when sorted by names).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ralphbean @gbenhaim Any update on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ralphbean @gbenhaim Any comment on this?
Note: also pinging on slack

Copy link
Member

Choose a reason for hiding this comment

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

@kdudka
Copy link
Contributor

kdudka commented Jan 27, 2025

/ok-to-test

Copy link
Contributor

@kdudka kdudka left a comment

Choose a reason for hiding this comment

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

Code-wise looks fine to me.

value: task/init/0.2/init.yaml
params:
- name: image-url
value: "quay.io/redhat-user-workloads/jperezde-tenant/tests/tests-sast-unicode-check:latest"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another aspect to discuss is the fact that this repo doesn't exist. So the upload is never done. I understand that the upload process is outside of the scope of the function.
Do we want to upload the results?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we have a meaningful image-url that could be used for testing, it would increase the test coverage. If not, we can modify the task to skip the upload in case an empty string is provided as image-url, which is how the sast-snyk-check task worked initially.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just had a chat with the team:
"for this we need the quay push secrets ..and it will be again dependent on the story that we created for enabling of secrets https://issues.redhat.com/browse/STONEBLD-3196"

So it seems that until the secrets are not incorporated into the tests, we can not upload the results

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to have the upload step covered, too. Yesterday I was fixing a regression in the upload step of the sast-coverity-check task, which was introduced by the Renovate bot: https://gitlab.cee.redhat.com/osh/cov-sa-container/-/merge_requests/63

Of course, it does not need to be part of this pull request, which is about creating some test coverage to begin with.

@jperezdealgaba jperezdealgaba force-pushed the sast-tests branch 9 times, most recently from 36ba314 to 027be37 Compare January 28, 2025 10:29
@jperezdealgaba jperezdealgaba marked this pull request as ready for review January 29, 2025 12:11
@jperezdealgaba jperezdealgaba requested a review from a team as a code owner January 29, 2025 12:11
@jperezdealgaba jperezdealgaba marked this pull request as draft January 29, 2025 12:12
@kdudka
Copy link
Contributor

kdudka commented Feb 4, 2025

/ok-to-test

@jperezdealgaba
Copy link
Contributor Author

/ok-to-test

@jperezdealgaba
Copy link
Contributor Author

@kdudka Would you mind retriggering this? There was a timeout

@kdudka
Copy link
Contributor

kdudka commented Feb 6, 2025

/ok-to-test

@sfowl
Copy link

sfowl commented Feb 11, 2025

/ok-to-test

@jperezdealgaba jperezdealgaba force-pushed the sast-tests branch 2 times, most recently from db57a54 to a109edc Compare February 12, 2025 08:11
@sfowl
Copy link

sfowl commented Feb 12, 2025

/ok-to-test

@jperezdealgaba jperezdealgaba marked this pull request as ready for review February 12, 2025 10:25
@jperezdealgaba
Copy link
Contributor Author

Tests passed and moved this out of Draft status

@sfowl
Copy link

sfowl commented Feb 13, 2025

/ok-to-test

@sfowl
Copy link

sfowl commented Feb 13, 2025

/ok-to-test

1 similar comment
@jperezdealgaba
Copy link
Contributor Author

/ok-to-test

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.

5 participants