Skip to content

Commit 56d8bb6

Browse files
Fix task name truncation in ci_script plugin: use rstrip instead of rsplit
Using rsplit("_", 1)[0] dropped the last segment when there was no trailing underscore (e.g. for short ansible task names like "Deploy ceph" became "deploy"). Use rstrip("_") so we only remove a trailing underscore at the end of string. Update the script integration test expectations: ci_script_* artifact and log paths now use the full normalized task-name slug (e.g. ..._failing_script, ..._debug_enabled, ..._chdir_option). Refresh SHA1 checksums for the generated .sh wrappers and for the chdir task log; other log checksums are unchanged. Signed-off-by: Mikołaj Ciecierski <mikolaj.ciecierski@redhat.com>
1 parent edb4c11 commit 56d8bb6

2 files changed

Lines changed: 16 additions & 18 deletions

File tree

plugins/action/ci_script.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ def run(self, tmp=None, task_vars=None):
192192
# truncate the length of the name to 20 chars at max
193193
# while trying to preserve entire words
194194
t_name = (
195-
re.sub(r"[^A-Za-z0-9_]+", "_", self._task.name)
196-
.lower()[:30]
197-
.rsplit("_", 1)[0]
195+
re.sub(r"[^A-Za-z0-9_]+", "_", self._task.name).lower()[:30].rstrip("_")
198196
)
199197
chdir_path = task_args.get("chdir", None)
200198
log_path = output_dir.parent.joinpath(

tests/integration/targets/script/tasks/main.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,25 @@
7575
- name: Set files attributes
7676
ansible.builtin.set_fact:
7777
files_to_check:
78-
"/tmp/artifacts/ci_script_008_run_simple_no_failing.sh":
79-
65f8bf5f39f42bef9d127cdaee5dba2ff5319ea3
80-
"/tmp/artifacts/ci_script_009_run_simple_failing.sh":
81-
020d32682ff902f46f987e9e31a00c4202918f94
82-
"/tmp/artifacts/ci_script_010_run_with_global_debug.sh":
83-
70b4ea1a3e5190a4cfb0d405fbf7182c56dce9b3
84-
"/tmp/artifacts/ci_script_011_run_with_action_debug.sh":
85-
71ec17b1f9e674261c18d8103aedd0e0ddbdc3bd
86-
"/tmp/artifacts/ci_script_012_run_using_chdir.sh":
87-
1364e7f0a086c27267fa7dea9c919d9d7d127224
88-
"/tmp/logs/ci_script_008_run_simple_no_failing.log":
78+
"/tmp/artifacts/ci_script_008_run_simple_no_failing_script.sh":
79+
bc43101e80bb1eff0c49d572fb20527c7e3a9d0b
80+
"/tmp/artifacts/ci_script_009_run_simple_failing_script.sh":
81+
dba40c73eb61fbf09c40da7f66b67d78953f1fcf
82+
"/tmp/artifacts/ci_script_010_run_with_global_debug_enabled.sh":
83+
defedbe625d823d0d499bb8b2f8d893df15649b9
84+
"/tmp/artifacts/ci_script_011_run_with_action_debug_enabled.sh":
85+
009a5da41869d419c24c305ad6cbe4c644f9aea5
86+
"/tmp/artifacts/ci_script_012_run_using_chdir_option.sh":
87+
26a353fd5989a27902412fcd20891d584cb1050f
88+
"/tmp/logs/ci_script_008_run_simple_no_failing_script.log":
8989
1382103331d56fa62a3f0b12388aad5cdb36389d
90-
"/tmp/logs/ci_script_009_run_simple_failing.log":
90+
"/tmp/logs/ci_script_009_run_simple_failing_script.log":
9191
67dd35c6c747cc9614633e32694fe9eb5e4a53d1
92-
"/tmp/logs/ci_script_010_run_with_global_debug.log":
92+
"/tmp/logs/ci_script_010_run_with_global_debug_enabled.log":
9393
b76a03852f2d614a63af5bc6ac3e9d61a113a34b
94-
"/tmp/logs/ci_script_011_run_with_action_debug.log":
94+
"/tmp/logs/ci_script_011_run_with_action_debug_enabled.log":
9595
bb7199b9b6842f10081dc307e0fe4cf9d0ef340a
96-
"/tmp/logs/ci_script_012_run_using_chdir.log":
96+
"/tmp/logs/ci_script_012_run_using_chdir_option.log":
9797
3588d48b41e8aa6b8e19f3507abfd8770aba7f6d
9898
"/tmp/dummy/test/test-file.txt":
9999
cff41d666ec6fd5404d5d2fd89136a40ba43671e

0 commit comments

Comments
 (0)