Skip to content

Commit 06de3de

Browse files
committed
debugged archiving issues
1 parent 569956c commit 06de3de

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

02-Test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,18 @@
4343
msg: "JUnit test report directory not found: {{ junit_test_report }}"
4444
when: not report_dir.stat.exists
4545

46-
- name: Copy JUnit test reports to local machine
46+
- name: Find JUnit test report files
4747
ansible.builtin.find:
4848
paths: "{{ junit_test_report }}"
4949
recurse: yes
5050
file_type: file
5151
register: junit_files
5252

53+
- name: Ensure local directory for test reports exists
54+
ansible.builtin.file:
55+
path: "/tmp/{{ app_name }}/test-reports/"
56+
state: directory
57+
5358
- name: Fetch JUnit test reports
5459
ansible.builtin.fetch:
5560
src: "{{ item.path }}"

Jenkinsfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pipeline {
55
environment {
66
ANSIBLE_INVENTORY = '/home/ec2-user/JavaCalculator/hosts.ini'
77
ANSIBLE_PLAYBOOK_PATH = '/home/ec2-user/JavaCalculator'
8+
APP_NAME = 'RaviCalculator' // Ensure this variable is set for proper artifact archiving
89
}
910
stages {
1011
stage('Checkout Code for Build') {
@@ -67,7 +68,7 @@ pipeline {
6768
post {
6869
always {
6970
// Archive test reports
70-
archiveArtifacts artifacts: '/tmp/{{ app_name }}/test-reports/**', allowEmptyArchive: true
71+
archiveArtifacts artifacts: "/tmp/${APP_NAME}/test-reports/**", allowEmptyArchive: true
7172
}
7273
success {
7374
echo 'Pipeline completed successfully.'

0 commit comments

Comments
 (0)