-
Notifications
You must be signed in to change notification settings - Fork 42
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
CI improvements #2080
CI improvements #2080
Conversation
This pull request does not have a backport label. Could you fix it @moukoublen? 🙏
|
📊 Allure Report - 💚 No failures were reported.
|
9fa9fdc
to
beeaa52
Compare
97debbb
to
3d624d1
Compare
.github/actions/opa/action.yml
Outdated
@@ -0,0 +1,39 @@ | |||
name: 'OPA CI' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change workflow name?
name: 'OPA CI' | |
Test OPA Policies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mainly because it's not just testing; it involves fmt check, bundle building, test, opa check, and lint with Regal. So, I thought CI
better describes the steps.
But I could change it to Test OPA Policies
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6df73da
to
b1f64bf
Compare
.github/actions/aws-ci/action.yml
Outdated
name: Upload cloudbeat logs | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cloubeat-logs-ci-aws | ||
path: logs/ | ||
if-no-files-found: warn | ||
retention-days: 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@moukoublen I'm not sure if we need to store debug logs for more than a day. Enabling debug mode in the workflow and generating logs is usually a proactive action, and typically, you'll use those logs on the same day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to 1
.
@@ -51,15 +51,19 @@ runs: | |||
run: poetry run pytest -k "aws" --alluredir=./allure/results/ --clean-alluredir | |||
|
|||
- name: Upload test results | |||
if: ${{ success() || failure() }} | |||
if: ${{ always() }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several consecutive commits will cancel the workflow run, and in such cases, we don't need to upload test results. So, we can use !cancelled()
instead of always()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It used to be like that (success() || failure()
== !cancelled()
), and I specifically changed it because when we have missing results, then pytest retries, and it gets eventually canceled, so the job is marked as canceled.
In this case, we want the logs/results. That's why I changed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely clear on the scenario. Are you referring to situations where pytest is running and the results are incomplete when the job gets canceled? If the job is interrupted or canceled, I'm not convinced we need to retain the incomplete results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets say that because of some bug in code or testcase, or cloud resource configuration, we end up with some expected results to be missing.
Pytest retries trying to find the expected rule with the expected status.
In that case, the job's timeout might be reached before the pytest ends with an exit code that indicates an error.
If this happens, we must upload the test results to identify which test case didn't pass.
I don't remember the specific CI that this happened I could search.
Perhaps we could better sync pytest timeout vs job timeout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary to search for the specific run, I understand now. In this case, using always()
will address the issue, but it might introduce noise when the job is canceled due to a new commit being submitted.
Okay, let's try using always()
and see if it behaves as expected for our needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, unfortunately, it introduces a bit of noise and a small delay on consecutive commits. 😞
Let's see if it becomes a bummer we can revert back to not canceled
.
@@ -306,7 +328,7 @@ jobs: | |||
timeout-minutes: 60 | |||
permissions: | |||
pull-requests: write | |||
if: ${{ success() || failure() }} | |||
if: ${{ always() }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same applies here; I believe using !cancelled()
is better than always()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments
5246c12
to
8e44dd2
Compare
Summary of your changes
Move opa ci to new ci workflowUpdate: reverted to move to separate PR.retention-days
to 2)Screenshot/Data
Related Issues
Checklist
Introducing a new rule?