Skip to content

Commit 1ebefbc

Browse files
larsvilhuberclaude
andcommitted
fix: ensure jiraticket survives eval parse_yaml in update_config.sh
Root cause: eval $(parse_yaml config.yml) inside update_config.sh was silently overwriting $jiraticket (set by the lookup) because the YAML key and pipeline variable share the same name. 00_unpack_zip.sh and other downstream scripts also call eval parse_yaml, compounding the problem. Fix: - update_config.sh: save $jiraticket before eval, restore it after so pipeline/environment value takes precedence over config.yml value - Both populate pipelines: move ./tools/update_config.sh to immediately after the jiraticket lookup (before 00_unpack_zip.sh and friends), so jiraticket is committed to config.yml before any script can clobber it Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 333122b commit 1ebefbc

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

bitbucket-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ pipelines:
245245
- projectID="${projectID:-zenodo-$ZenodoID}"
246246
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
247247
- if [ -z "$jiraticket" ] && [ -n "${openICPSRID:-}" ]; then jiraticket=$(python3 tools/jira_find_task_by_icpsr.py "$openICPSRID" 2>/dev/null || true); fi
248+
- ./tools/update_config.sh
248249
- if [ -d cache ]; then ls -lR cache/*; fi
249250
- ls -l generated/*
250251
# repeat this part
@@ -257,7 +258,6 @@ pipelines:
257258
- ./automations/21_cleanup.sh $projectID
258259
- ./automations/25_replace_report.sh
259260
- ./automations/30_cleanup_aux.sh
260-
- ./tools/update_config.sh
261261
- ./automations/20_commit_code.sh config.yml notag
262262
- git status
263263
- git push && git push --tags
@@ -422,6 +422,7 @@ pipelines:
422422
- projectID="${openICPSRID}"
423423
- projectID="${projectID:-zenodo-$ZenodoID}"
424424
- if [ -z "$jiraticket" ] && [ -n "${openICPSRID:-}" ]; then jiraticket=$(python3 tools/jira_find_task_by_icpsr.py "$openICPSRID" 2>/dev/null || true); fi
425+
- ./tools/update_config.sh
425426
- if [ -d $projectID ]; then \rm -rf $projectID; fi
426427
- if [ ! -z $openICPSRID ]; then python3 tools/download_openicpsr-private.py $openICPSRID; fi
427428
- if [ ! -z $ZenodoID ]; then python3 tools/download_zenodo_draft.py $ZenodoID; fi
@@ -442,7 +443,6 @@ pipelines:
442443
- ./automations/21_cleanup.sh $projectID
443444
- ./automations/25_replace_report.sh
444445
- ./automations/30_cleanup_aux.sh
445-
- ./tools/update_config.sh
446446
- ./automations/20_commit_code.sh config.yml notag
447447
- git status
448448
- git push

tools/update_config.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ if [ ! -f config.yml ]; then
1717
fi
1818
fi
1919

20+
# Save pipeline-provided values before eval overwrites them.
21+
# config.yml and pipeline vars share the same key name for jiraticket, so
22+
# eval $(parse_yaml ...) silently clobbers the pipeline/environment variable.
23+
_env_jiraticket="${jiraticket:-}"
24+
2025
# read parameters
2126
eval $(parse_yaml config.yml)
2227

@@ -36,7 +41,8 @@ ZenodoID="${ZenodoID:-$zenodo}"
3641
DataverseID="${DataverseID:-$dataverse}"
3742
OSFID="${OSFID:-$osf}"
3843
MainFile="${MainFile:-$main}"
39-
jiraticket="${jiraticket:-$jiraticket}"
44+
# Restore pipeline/environment value if it was set; otherwise keep config.yml value
45+
jiraticket="${_env_jiraticket:-$jiraticket}"
4046
mcid="${mcid:-$mcid}"
4147

4248
# write it back

0 commit comments

Comments
 (0)