Skip to content

Commit c88cf7a

Browse files
saikumarrsAI Assistant
andauthored
chore: resolve release workflow issues (#2357)
* chore: fix ticket ID extraction logic to retain prefix * chore: fix package.json search logic * chore: manually download the release artifact * chore: fix secret mapping issues * chore: improve slack messaging * chore: empty commit * chore: empty commit 2 * chore: address ai bot review comments * chore: address ai bot review comments --------- Co-authored-by: AI Assistant <ai@rudderstack.com>
1 parent 870bd3e commit c88cf7a

7 files changed

Lines changed: 110 additions & 17 deletions

File tree

.github/actions/release-thread-integration/action.yml

Lines changed: 101 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ inputs:
1717
slack_api_response:
1818
description: 'JSON response from Slack API containing message details'
1919
required: true
20+
slack_slugs:
21+
description: 'Slack slugs for CC'
22+
required: false
23+
default: '<!subteam^S0555JBV36D> <!subteam^S03SW7DM8P3> <!subteam^S03SHJ20350>'
24+
custom_message:
25+
description: 'Custom message to post to the release thread'
26+
required: false
27+
default: ''
2028

2129
outputs:
2230
has_thread_info:
@@ -35,14 +43,6 @@ outputs:
3543
runs:
3644
using: 'composite'
3745
steps:
38-
- name: Download release info artifact
39-
id: download-release-info
40-
continue-on-error: true
41-
uses: actions/download-artifact@v4
42-
with:
43-
name: release-info-v${{ inputs.monorepo_release_version }}-${{ inputs.release_ticket_id }}
44-
path: release-info/
45-
4646
- name: Ensure jq is installed
4747
shell: bash
4848
run: |
@@ -69,6 +69,97 @@ runs:
6969
jq --version
7070
fi
7171
72+
- name: Download release info artifact from original workflow
73+
id: download-release-info
74+
continue-on-error: true
75+
shell: bash
76+
env:
77+
GITHUB_TOKEN: ${{ github.token }}
78+
REPO: ${{ github.repository }}
79+
ARTIFACT_NAME: release-info-v${{ inputs.monorepo_release_version }}-${{ inputs.release_ticket_id }}
80+
run: |
81+
# Create directory for artifact
82+
mkdir -p release-info
83+
84+
# Find the workflow run that created this artifact
85+
# Look for the draft-new-release workflow runs
86+
echo "Searching for artifact: $ARTIFACT_NAME"
87+
88+
# Get the workflow ID for draft-new-release
89+
workflow_response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
90+
"https://api.github.com/repos/$REPO/actions/workflows/draft-new-release.yml")
91+
92+
workflow_id=$(echo "$workflow_response" | jq -r '.id')
93+
94+
if [ "$workflow_id" = "null" ] || [ -z "$workflow_id" ]; then
95+
echo "Could not find draft-new-release workflow"
96+
echo "Response: $workflow_response"
97+
exit 1
98+
fi
99+
100+
echo "Found workflow ID: $workflow_id"
101+
102+
# Get recent workflow runs (last 50 runs, completed status)
103+
runs_response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
104+
"https://api.github.com/repos/$REPO/actions/workflows/$workflow_id/runs?per_page=50&status=completed")
105+
106+
if [ "$(echo "$runs_response" | jq -r '.total_count')" = "0" ]; then
107+
echo "No completed workflow runs found"
108+
exit 1
109+
fi
110+
111+
# Find the run that has our artifact
112+
artifact_found=false
113+
run_count=$(echo "$runs_response" | jq -r '.workflow_runs | length')
114+
echo "Checking $run_count workflow runs for artifact..."
115+
116+
for i in $(seq 0 $((run_count - 1))); do
117+
run_id=$(echo "$runs_response" | jq -r ".workflow_runs[$i].id")
118+
run_name=$(echo "$runs_response" | jq -r ".workflow_runs[$i].name")
119+
run_created=$(echo "$runs_response" | jq -r ".workflow_runs[$i].created_at")
120+
121+
echo "Checking run $run_id ($run_name) created at $run_created..."
122+
123+
artifacts_response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
124+
"https://api.github.com/repos/$REPO/actions/runs/$run_id/artifacts")
125+
126+
# Check if the response contains our artifact
127+
artifact_exists=$(echo "$artifacts_response" | jq -r ".artifacts[] | select(.name == \"$ARTIFACT_NAME\") | .name // empty")
128+
129+
if [ "$artifact_exists" = "$ARTIFACT_NAME" ]; then
130+
echo "Found artifact in run $run_id"
131+
artifact_id=$(echo "$artifacts_response" | jq -r ".artifacts[] | select(.name == \"$ARTIFACT_NAME\") | .id")
132+
133+
# Download the artifact
134+
download_response=$(curl -L -w "%{http_code}" -H "Authorization: token $GITHUB_TOKEN" \
135+
"https://api.github.com/repos/$REPO/actions/artifacts/$artifact_id/zip" \
136+
-o release-info.zip)
137+
138+
http_code="${download_response: -3}"
139+
if [ "$http_code" = "200" ]; then
140+
# Extract the artifact
141+
unzip -o release-info.zip -d release-info/
142+
rm release-info.zip
143+
144+
echo "Successfully downloaded and extracted artifact"
145+
artifact_found=true
146+
break
147+
else
148+
echo "Failed to download artifact, HTTP code: $http_code"
149+
fi
150+
fi
151+
done
152+
153+
if [ "$artifact_found" = false ]; then
154+
echo "Artifact $ARTIFACT_NAME not found in recent workflow runs"
155+
echo "This could mean:"
156+
echo "1. The artifact has expired (artifacts expire after 90 days)"
157+
echo "2. The artifact was never created"
158+
echo "3. The artifact name doesn't match"
159+
160+
exit 1
161+
fi
162+
72163
- name: Extract release info
73164
id: extract-info
74165
continue-on-error: true
@@ -141,13 +232,13 @@ runs:
141232
{
142233
"channel": "${{ steps.extract-info.outputs.channel_id }}",
143234
"thread_ts": "${{ steps.extract-info.outputs.thread_ts }}",
144-
"text": ":white_check_mark: ${{ inputs.deployment_name }} deployment completed: <${{ steps.extract-message-url.outputs.message_url }}|View deployment details>\n\nCC: <!subteam^S0555JBV36D> <!subteam^S03SW7DM8P3> <!subteam^S03SHJ20350>",
235+
"text": ":white_check_mark: ${{ inputs.deployment_name }} deployment completed: <${{ steps.extract-message-url.outputs.message_url }}|View deployment details>\n\nCC: ${{ inputs.slack_slugs }}",
145236
"blocks": [
146237
{
147238
"type": "section",
148239
"text": {
149240
"type": "mrkdwn",
150-
"text": ":white_check_mark: *${{ inputs.deployment_name }} deployment completed*\n<${{ steps.extract-message-url.outputs.message_url }}|View deployment details>\n\nCC: <!subteam^S0555JBV36D> <!subteam^S03SW7DM8P3> <!subteam^S03SHJ20350>"
241+
"text": ":white_check_mark: *${{ inputs.deployment_name }} deployment completed*${{ inputs.custom_message != '' && format('\n\n{0}', inputs.custom_message) }}\n<${{ steps.extract-message-url.outputs.message_url }}|View deployment details>\n\nCC: ${{ inputs.slack_slugs }}"
151242
}
152243
}
153244
]

.github/workflows/deploy-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_DEV_S3_BUCKET_NAME }}
3939
AWS_S3_SYNC_ROLE: ${{ secrets.AWS_DEV_S3_SYNC_ROLE }}
4040
AWS_CF_DISTRIBUTION_ID: ${{ secrets.AWS_DEV_CF_DISTRIBUTION_ID }}
41-
BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }}
41+
BUGSNAG_API_KEY: ${{ secrets.RS_DEV_BUGSNAG_API_KEY }}
4242
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
4343
SLACK_RELEASE_CHANNEL_ID: ${{ secrets.SLACK_RELEASE_CHANNEL_ID_NON_PROD }}
4444

.github/workflows/deploy-prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
3434
# Extract version and ticket from branch name (format: release/3.2.1-SDK-1234 or hotfix-release/3.2.2-SDK-5678)
3535
version=$(echo "$PR_BRANCH" | sed -n 's|.*\/\([0-9]\+\.[0-9]\+\.[0-9]\+\)-.*|\1|p')
36-
ticket=$(echo "$PR_BRANCH" | sed -n 's|.*-\([^-]*\)$|\1|p')
36+
ticket=$(echo "$PR_BRANCH" | sed -n 's|.*[0-9]\+-\(.*\)$|\1|p')
3737
3838
echo "Extracted version: $version"
3939
echo "Extracted ticket: $ticket"

.github/workflows/deploy-sanity-suite.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,4 @@ jobs:
225225
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
226226
deployment_name: 'Sanity Suite'
227227
slack_api_response: ${{ steps.slack.outputs.response }}
228+
slack_slugs: '<!subteam^S0555JBV36D> <!subteam^S03SW7DM8P3>'

.github/workflows/deploy-staging.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
3636
# Extract version and ticket from branch name (format: release/3.2.1-SDK-1234 or hotfix-release/3.2.2-SDK-5678)
3737
version=$(echo "$HEAD_REF" | sed -n 's|.*\/\([0-9]\+\.[0-9]\+\.[0-9]\+\)-.*|\1|p')
38-
ticket=$(echo "$HEAD_REF" | sed -n 's|.*-\([^-]*\)$|\1|p')
38+
ticket=$(echo "$HEAD_REF" | sed -n 's|.*[0-9]\+-\(.*\)$|\1|p')
3939
4040
echo "Extracted version: $version"
4141
echo "Extracted ticket: $ticket"
@@ -63,8 +63,8 @@ jobs:
6363
AWS_ACCOUNT_ID: ${{ secrets.AWS_STAGING_ACCOUNT_ID }}
6464
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_STAGING_S3_BUCKET_NAME }}
6565
AWS_S3_SYNC_ROLE: ${{ secrets.AWS_STAGING_S3_SYNC_ROLE }}
66-
AWS_CF_DISTRIBUTION_ID: ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }}
67-
BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }}
66+
AWS_CF_DISTRIBUTION_ID: ${{ secrets.AWS_STAGING_CF_DISTRIBUTION_ID }}
67+
BUGSNAG_API_KEY: ${{ secrets.RS_STAGING_BUGSNAG_API_KEY }}
6868
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
6969
SLACK_RELEASE_CHANNEL_ID: ${{ secrets.SLACK_RELEASE_CHANNEL_ID_NON_PROD }}
7070

.github/workflows/deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ jobs:
345345
]
346346
}
347347
348-
- name: Post NPM packages publish notification to release thread
348+
- name: Post Browser SDK publish notification to release thread
349349
continue-on-error: true
350350
if: ${{ steps.slack.outcome == 'success' && inputs.monorepo_release_version != '' && inputs.release_ticket_id != '' }}
351351
uses: ./.github/actions/release-thread-integration
@@ -355,6 +355,7 @@ jobs:
355355
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
356356
deployment_name: 'JS SDK Browser Package'
357357
slack_api_response: ${{ steps.slack.outputs.response }}
358+
custom_message: ${{ inputs.environment == 'production' && 'Proceed to perform post-release testing of your changes.' || inputs.environment == 'staging' && 'Proceed to perform pre-release testing of your changes.' || '' }}
358359

359360
# All the below steps are for v1.1 SDK (legacy)
360361
- name: Copy legacy SDK artifacts to S3

scripts/collect-packages-versions.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ print_version_row() {
4444
print_version_row "package.json"
4545

4646
# All packages in packages/
47-
find packages -name package.json | while read -r pkg; do
47+
find packages -mindepth 2 -maxdepth 2 -name package.json \; | while read -r pkg; do
4848
print_version_row "$pkg"
4949
done

0 commit comments

Comments
 (0)