Skip to content

Conversation

@buger
Copy link
Member

@buger buger commented Oct 21, 2025

User description

TT-15781: add aggregator job to ci-test.yml (#7458)

TT-15781
Summary Add aggregated-ci-status job to tyk workflow
Type Story Story
Status Ready for Testing
Points N/A
Labels -

Description

Added the aggregator to ci

Related Issue

Motivation and Context

How This Has Been Tested

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing
    functionality to change)
  • Refactoring or add test (improvements in base code or adds test
    coverage to functionality)

Checklist

  • I ensured that the documentation is up to date
  • I explained why this PR updates go.mod in detail with reasoning
    why it's required
  • I would like a code coverage CI quality gate exception and have
    explained why

Ticket Details

TT-15781
Status In Code Review
Summary Add aggregated-ci-status job to tyk workflow

Generated at: 2025-10-21 14:02:45


Co-authored-by: sredny buitrago sredny@srednys-MacBook-Pro.local


PR Type

Enhancement


Description

  • Add CI aggregator job for PRs

  • Fails workflow if dependencies fail

  • Summarizes failed jobs from needs context

  • Runs after test job on ubuntu-latest


Diagram Walkthrough

flowchart LR
  test["test job"] --> aggregator["Aggregated CI Status job"]
  aggregator -- "checks needs[].result, fails on any non-success" --> outcome["Unified CI outcome for PR"]
Loading

File Walkthrough

Relevant files
Enhancement
ci-tests.yml
Add aggregated CI status job to workflow                                 

.github/workflows/ci-tests.yml

  • Add aggregator-ci-test job gated to pull_request.
  • Depends on test via needs and always runs.
  • Parses needs JSON with jq to collect failures.
  • Exits non-zero with failed job list or prints success.
+31/-0   

<details open>
<summary><a href="https://tyktech.atlassian.net/browse/TT-15781"
title="TT-15781" target="_blank">TT-15781</a></summary>
  <br />
  <table>
    <tr>
      <th>Summary</th>
      <td>Add aggregated-ci-status job to tyk workflow</td>
    </tr>
    <tr>
      <th>Type</th>
      <td>
<img alt="Story"
src="https://tyktech.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium"
/>
        Story
      </td>
    </tr>
    <tr>
      <th>Status</th>
      <td>Ready for Testing</td>
    </tr>
    <tr>
      <th>Points</th>
      <td>N/A</td>
    </tr>
    <tr>
      <th>Labels</th>
      <td>-</td>
    </tr>
  </table>
</details>
<!--
  do not remove this marker as it will break jira-lint's functionality.
  added_by_jira_lint
-->

---

<!-- Provide a general summary of your changes in the Title above -->

## Description

Added the aggregator to ci

## Related Issue

<!-- This project only accepts pull requests related to open issues. -->
<!-- If suggesting a new feature or change, please discuss it in an
issue first. -->
<!-- If fixing a bug, there should be an issue describing it with steps
to reproduce. -->
<!-- OSS: Please link to the issue here. Tyk: please create/link the
JIRA ticket. -->

## Motivation and Context

<!-- Why is this change required? What problem does it solve? -->

## How This Has Been Tested

<!-- Please describe in detail how you tested your changes -->
<!-- Include details of your testing environment, and the tests -->
<!-- you ran to see how your change affects other areas of the code,
etc. -->
<!-- This information is helpful for reviewers and QA. -->

## Screenshots (if appropriate)

## Types of changes

<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Refactoring or add test (improvements in base code or adds test
coverage to functionality)

## Checklist

<!-- Go over all the following points, and put an `x` in all the boxes
that apply -->
<!-- If there are no documentation updates required, mark the item as
checked. -->
<!-- Raise up any additional concerns not covered by the checklist. -->

- [ ] I ensured that the documentation is up to date
- [ ] I explained why this PR updates go.mod in detail with reasoning
why it's required
- [ ] I would like a code coverage CI quality gate exception and have
explained why

<!---TykTechnologies/jira-linter starts here-->

### Ticket Details

<details>
<summary>
<a href="https://tyktech.atlassian.net/browse/TT-15781" title="TT-15781"
target="_blank">TT-15781</a>
</summary>

|         |    |
|---------|----|
| Status  | In Code Review |
| Summary | Add aggregated-ci-status job to tyk workflow |

Generated at: 2025-10-21 14:02:45

</details>

<!---TykTechnologies/jira-linter ends here-->

---------

Co-authored-by: sredny buitrago <sredny@srednys-MacBook-Pro.local>

(cherry picked from commit 35964ac)
@buger buger requested a review from a team as a code owner October 21, 2025 18:52
@buger buger enabled auto-merge (squash) October 21, 2025 18:52
@github-actions
Copy link
Contributor

API Changes

no api changes detected
@github-actions
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix expression interpolation quoting

Using single quotes prevents expression interpolation; needs_json will literally
contain the braces string, breaking jq. Use unquoted or double-quoted interpolation
so the JSON is assigned correctly.

.github/workflows/ci-tests.yml [251]

-needs_json='${{ toJSON(needs) }}'
+needs_json=${{ toJSON(needs) }}
Suggestion importance[1-10]: 9

__

Why: Accurate: single quotes prevent ${{ }} evaluation in GitHub Actions, causing needs_json to be a literal string and breaking jq; using unquoted/double-quoted interpolation is a critical fix.

High
Aggregate all required jobs

The job only depends on test, so other required jobs can fail without being
captured. Ensure the aggregator depends on every job you want to enforce or
explicitly enumerate them. Otherwise, the aggregation may give a false green status.

.github/workflows/ci-tests.yml [245-246]

 if: ${{ always() && github.event_name == 'pull_request' }}
-needs: [ test ]
+needs: [ test, build, lint, sonar ]  # include all jobs that must be aggregated
Suggestion importance[1-10]: 6

__

Why: Correctly notes that the aggregator only depends on test, so other jobs won't be evaluated; adding all required jobs improves reliability but assumes job names not shown here.

Low
General
Differentiate non-fail outcomes

Treat cancelled, skipped, or neutral results differently from genuine failures to
avoid blocking the PR unnecessarily. Only fail on explicit failure or timed-out
results.

.github/workflows/ci-tests.yml [254-260]

 for job in $(echo "$needs_json" | jq -r 'keys[]'); do
   job_result=$(echo "$needs_json" | jq -r --arg job "$job" '.[$job].result')
-
-  if [[ "$job_result" != "success" ]]; then
-    failed+=("$job")
-  fi
+  case "$job_result" in
+    failure|timed_out)
+      failed+=("$job")
+      ;;
+    success|skipped|cancelled|neutral)
+      ;;
+    *)
+      # Unknown or null result: treat as failure to be safe
+      failed+=("$job")
+      ;;
+  esac
 done
Suggestion importance[1-10]: 5

__

Why: The logic change is reasonable and could reduce unnecessary failures, but the current PR intent may be to fail on any non-success; impact is moderate and context-dependent.

Low
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
53 Security Hotspots
72.6% Coverage on New Code (required ≥ 80%)
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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

Labels

None yet

3 participants