Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Trigger Jenkins Job

on:
push:
branches:
- latest
paths:
- pyproject.toml

jobs:
trigger-jenkins:
runs-on: self-hosted

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Trigger Jenkins Job
env:
JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }}
run: |
HTTP_STATUS=$(curl -w "%{http_code}" -o /tmp/jenkins_response.txt -f -X POST \
"https://jenkins.superstream.ai/job/DevOps/job/Superstream/job/SDK/job/superstream-clients-python/buildWithParameters?DEPLOYMENT_TYPE=production" \
--user "team@superstream.ai:$JENKINS_TOKEN")

if [ $? -ne 0 ] || [ "$HTTP_STATUS" -ne 201 ] && [ "$HTTP_STATUS" -ne 200 ]; then
Copy link

Choose a reason for hiding this comment

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

Bug: Operator precedence causes silent failure on curl errors

The shell conditional has incorrect operator precedence due to && and || being left-associative with equal precedence. The expression [ $? -ne 0 ] || [ "$HTTP_STATUS" -ne 201 ] && [ "$HTTP_STATUS" -ne 200 ] evaluates as ((curl_fail) OR (status != 201)) AND (status != 200) instead of the intended (curl_fail) OR ((status != 201) AND (status != 200)). This means if curl fails but HTTP_STATUS is 200 (possible with partial transfers or connection resets), the failure is silently ignored and the script reports success. Parentheses are needed to group the status checks.

Fix in Cursor Fix in Web

echo "Jenkins trigger failed with HTTP status: $HTTP_STATUS"
cat /tmp/jenkins_response.txt
exit 1
fi

echo "Successfully triggered Jenkins build (HTTP $HTTP_STATUS)"