Moved grabbing branch name out of container

This commit is contained in:
Chase King 2025-03-05 10:26:47 -05:00
parent 1bea6b2aa5
commit b1cbed58f8

View file

@ -142,12 +142,16 @@ stages:
tags: $(imageTag)
arguments: '--no-cache --pull'
- bash: |
branch_name=$(git name-rev --name-only --refs=\"refs/remotes/origin/*\" HEAD^1 | sed 's/~.*//') # Had to do it this way because Build.SourceBranchName is always 'merge' on PR
echo \"Retrieved branch name: '$branch_name'\"
jira_card_number=\"${branch_name##*/}\" # Grab everything after last '/'
# Create container for jira writeback
container_id=$(docker create \
--ipc=host \
-e JIRA_SERVER=$(JIRA_SERVER) \
-e JIRA_USERNAME=$(JIRA_USERNAME) \
-e JIRA_API_KEY=$(JIRA_API_KEY) \
-e JIRA_CARD_NUMBER=$jira_card_number \
$(dockerImageName):$(imageTag) \
bash -c "echo \"Moving Playwright reports out of subfolders...\" &&
find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \; &&
@ -159,11 +163,8 @@ stages:
# (($num_failures -eq 0)) && jira_message='Playwright tests passed!' || jira_message=\"$num_failures Playwright tests failed.\"
# TODO: Update to include test status message later
echo \"Contents of ortoni-report:\" && ls ./ortoni-report &&
branch_name=$(git name-rev --name-only --refs=\"refs/remotes/origin/*\" HEAD^1 | sed 's/~.*//') # Had to do it this way because Build.SourceBranchName is always 'merge' on PR
echo \"Retrieved branch name: '$branch_name'\"
jira_card_number=\"${branch_name##*/}\" # Grab everything after last '/'
echo \"Writing report to Jira card '$jira_card_number'...\" &&
./devops/scripts/jira_writeback.sh add_comment \"$jira_card_number\" /app/ortoni-report/ortoni-report.html \"AUTOMATED TEST RUN: $(date)\" ")
echo \"Writing report to Jira card '$JIRA_CARD_NUMBER'...\" &&
./devops/scripts/jira_writeback.sh add_comment \"$JIRA_CARD_NUMBER\" /app/ortoni-report/ortoni-report.html \"AUTOMATED TEST RUN: $(date)\" ")
# Start container and stream logs
echo "Starting merge"