From 97a5c7cc8961e0d70fce100a9a13536fd497ddd9 Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Mon, 9 Sep 2024 16:34:57 +0100 Subject: [PATCH] Automation: Fixes bumpmatrix for main branch --- rake_tasks/automation.rake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rake_tasks/automation.rake b/rake_tasks/automation.rake index 7268688bd..6edce2726 100644 --- a/rake_tasks/automation.rake +++ b/rake_tasks/automation.rake @@ -104,10 +104,14 @@ namespace :automation do files.each do |file| content = File.read(file) if file == '.buildkite/pipeline.yml' + require 'yaml' + yaml = YAML.safe_load(content) branch = version.match(/([0-9]+\.[0-9]+)\.[0-9]+.*/)[1] - old_branch = content.match(/ES_YAML_TESTS_BRANCH: ([0-9.]+)/)[1] - content.gsub!(old_branch, branch) - puts "[#{old_branch}] -> [#{branch}] in #{file.gsub('./', '')}" + yaml_tests_branch = yaml['steps'][1]['env']['ES_YAML_TESTS_BRANCH'] + next if yaml_tests_branch == 'main' + + content.gsub!(yaml_tests_branch, branch) + puts "[#{yaml_tests_branch}] -> [#{branch}] in #{file.gsub('./', '')}" end match = content.match(regexp) next if match.nil?