Skip to content
Merged
17 changes: 13 additions & 4 deletions .github/workflows/reusable-build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,24 @@ jobs:
- id: determine_splunk
env:
wfe_run_on_splunk_latest: ${{ inputs.wfe-run-on-splunk-latest }}
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is removed, then input inputs.wfe-run-on-splunk-latest is never referenced in the workflow, meaning it's reduntant.

Copy link
Contributor

Choose a reason for hiding this comment

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

run: |
if [[ "$wfe_run_on_splunk_latest" == "" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Right now wfe_run_on_splunk_latest is set to false at the top of the workflow, so this condition never passes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, the previous logic never recalculated because the input defaulted to false, which is why the condition was refactored to explicitly evaluate branch and event instead of relying on an empty value.

wfe_run_on_splunk_latest="${{ github.event_name == 'schedule' || !((github.base_ref == 'main' || github.ref_name == 'main') || ((github.base_ref == 'develop' || github.ref_name == 'develop') && github.event_name == 'push')) }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Because the variable is never empty, this block never runs and the value is never recalculated based on the branch or event. That means the logic below is effectively skipped every time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, this was the core issue, and the fix ensures the value is always recomputed based on schedule, input, branch, and event as required by Jira.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think wfe_run_on_splunk_latest would be calculated correctly if we actually reached this code block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is old commit which is removed this empty input code in the latest finalized commit.

run: |
if [[ "${{ github.event_name }}" == "schedule" ]]; then
wfe_run_on_splunk_latest="true"

else
if [[ "${{ github.base_ref }}" == "main" || "${{ github.ref_name }}" == "main" ]] || \
[[ "${{ github.ref_name }}" == "develop" && "${{ github.event_name }}" == "push" ]]; then
wfe_run_on_splunk_latest="false"
else
wfe_run_on_splunk_latest="true"
fi
fi
if [[ "$wfe_run_on_splunk_latest" == "true" ]]; then
echo "matrixSplunk=${{ toJson(steps.matrix.outputs.latestSplunk) }}" >> "$GITHUB_OUTPUT"
else
echo "matrixSplunk=${{toJson(steps.matrix.outputs.supportedSplunk) }}" >> "$GITHUB_OUTPUT"
echo "matrixSplunk=${{ toJson(steps.matrix.outputs.supportedSplunk) }}" >> "$GITHUB_OUTPUT"
fi

- name: job summary
run: |
splunk_version_list=$(echo '${{ steps.determine_splunk.outputs.matrixSplunk }}' | jq -r '.[].version')
Expand Down
Loading