File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 }}"
Original file line number Diff line number Diff 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.'
You can’t perform that action at this time.
0 commit comments