Skip to content

Commit

Permalink
kdevops_archive: read commit message from file
Browse files Browse the repository at this point in the history
Fix error below by creating a temporary file with commit message and use
that as input:
1. Create temporary file
2. Create temporary var with commit message
3. Write commit message to file
4. git-commit using temporary file content
5. Delete temporary file

Also, update tasks to include FQCN.

Error:
TASK [kdevops_archive : Commit the archive]
************************************
fatal: [localhost]: FAILED! => {
    "changed": true,
    "cmd": "git commit -m \"kdevops: Revert \"bringup: Use full path
when creating custom_source file\"\n\nThis adds test results for:\n
workflow: fstests\n  tree: linux\n  ref: linux\n  test number: 0001\n
test result: ok\n\nDetailed test report:\n\nKERNEL:    6.14.0-rc2\nCPUS:
8\n\nxfs_reflink_4k: 1 tests, 16 seconds\n  generic/003  Pass
13s\nTotals: 1 tests, 0 skipped, 0 failures, 0 errors, 13s\n\"\n",
    "delta": "0:00:00.006967",
    "end": "2025-02-10 02:34:48.789646",
    "rc": 1,
    "start": "2025-02-10 02:34:48.782679"
}

STDERR:

error: pathspec 'Use' did not match any file(s) known to git
error: pathspec 'full' did not match any file(s) known to git
error: pathspec 'path' did not match any file(s) known to git
error: pathspec 'when' did not match any file(s) known to git
error: pathspec 'creating' did not match any file(s) known to git
error: pathspec 'custom_source' did not match any file(s) known to git
error: pathspec 'file

This adds test results for:
  workflow: fstests
  tree: linux
  ref: linux
  test number: 0001
  test result: ok

Detailed test report:

KERNEL:    6.14.0-rc2
CPUS:      8

xfs_reflink_4k: 1 tests, 16 seconds
  generic/003  Pass     13s
Totals: 1 tests, 0 skipped, 0 failures, 0 errors, 13s
' did not match any file(s) known to git

MSG:

non-zero return code

PLAY RECAP
*********************************************************************
localhost                  : ok=53   changed=15   unreachable=0
failed=1    skipped=12   rescued=0    ignored=0

Signed-off-by: Daniel Gomez <[email protected]>
  • Loading branch information
dkruces committed Feb 10, 2025
1 parent 5649a0d commit 12e311b
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions playbooks/roles/kdevops_archive/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,15 @@
kdevops_archive_ci_test_result: "unknown"
when: not ci_result_file.stat.exists

- name: Create a temporary file for commit message
ansible.builtin.tempfile:
state: file
suffix: txt
prefix: kdevops_commit_msg_
register: tmp_commit_msg

- name: Set commit message
set_fact:
ansible.builtin.set_fact:
commit_message: |
{{ kdevops_archive_test_trigger }}: {{ kdevops_archive_test_subject }}
Expand All @@ -424,14 +431,25 @@
{{ kdevops_archive_test_commit }}
- name: Copy commit message into temporary file
ansible.builtin.copy:
content: "{{ commit_message }}"
dest: "{{ tmp_commit_msg.path }}"
mode: '0644'

- name: Commit the archive
shell: |
git commit -m "{{ commit_message }}"
ansible.builtin.shell: |
git commit --file "{{ tmp_commit_msg.path }}"
args:
chdir: "{{ kdevops_results_archive_dir }}"
environment:
GIT_LFS_SKIP_SMUDGE: "0"

- name: Remove temporary file with commit message
ansible.builtin.file:
path: "{{ tmp_commit_msg.path }}"
state: absent

- name: Push changes to remote repository
command:
cmd: git push origin main
Expand Down

0 comments on commit 12e311b

Please sign in to comment.