Skip to content

Commit fab7b45

Browse files
Fix the image tag replace changes
1 parent b8ba12e commit fab7b45

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

deploy.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ def update_image_tag(self):
6666
end_index = yaml_content.find(' ', start_index)
6767
if end_index == -1:
6868
end_index = len(yaml_content)
69-
tag_to_replace = yaml_content[start_index+len(pattern):end_index]
69+
tag_to_replace = yaml_content[start_index+len(pattern):end_index-1]
7070
updated_yaml_content = yaml_content.replace(
7171
f'{self.docker_repo}:{tag_to_replace}',
7272
f'{self.docker_repo}:{self.new_image_tag}'
7373
)
74+
else:
75+
raise ValueError("No image tag found in the YAML content")
7476

7577
# Write the updated content back to the file
7678
with open(self.yaml_file_path, 'w') as f:
@@ -138,11 +140,9 @@ def create_pull_request(self, pr_title, pr_body):
138140
self.commit_and_push_changes()
139141
if self.check_pull_request_exists():
140142
return
141-
# Create a pull request
142-
subprocess.run(['gh', 'pr', 'create', '--base', 'main', '--head', self.branch_name, '--title', pr_title, '--body', pr_body])
143-
144-
print(f"Pull request created for branch: {self.branch_name}")
145-
143+
else:
144+
subprocess.run(['gh', 'pr', 'create', '--base', 'main', '--head', self.branch_name, '--title', pr_title, '--body', pr_body])
145+
print(f"Pull request created for branch: {self.branch_name}")
146146
except Exception as e:
147147
print(f"Error creating pull request: {e}")
148148

0 commit comments

Comments
 (0)