Browse code

Jenkinsfile: create bundles for Windows stages

CI already stores the logs of the test daemon, so we might as well
store them as artifacts

```
[2019-09-03T12:49:39.835Z] INFO: Tidying up at end of run
[2019-09-03T12:49:39.835Z] INFO: Saving daemon under test log (d:\CI-2\CI-3593e7622\dut.out) to C:\windows\TEMP\CIDUT.out
[2019-09-03T12:49:39.835Z] INFO: Saving daemon under test log (d:\CI-2\CI-3593e7622\dut.err) to C:\windows\TEMP\CIDUT.err
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6ee61f54935d77d3d5667b4a3ba8f0be6c3de23d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/09/03 22:51:41
Showing 2 changed files
... ...
@@ -760,6 +760,25 @@ pipeline {
760 760
                             }
761 761
                         }
762 762
                     }
763
+                    post {
764
+                        always {
765
+                            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
766
+                                powershell '''
767
+                                $bundleName="windowsRS1-integration"
768
+                                Write-Host -ForegroundColor Green "Creating ${bundleName}-bundles.zip"
769
+
770
+                                # archiveArtifacts does not support env-vars to , so save the artifacts in a fixed location
771
+                                Compress-Archive -Path "${env:TEMP}/CIDUT.out", "${env:TEMP}/CIDUT.err" -CompressionLevel Optimal -DestinationPath "${bundleName}-bundles.zip"
772
+                                '''
773
+
774
+                                archiveArtifacts artifacts: '*-bundles.zip', allowEmptyArchive: true
775
+                            }
776
+                        }
777
+                        cleanup {
778
+                            sh 'make clean'
779
+                            deleteDir()
780
+                        }
781
+                    }
763 782
                 }
764 783
                 stage('win-RS5') {
765 784
                     when {
... ...
@@ -800,6 +819,25 @@ pipeline {
800 800
                             }
801 801
                         }
802 802
                     }
803
+                    post {
804
+                        always {
805
+                            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', message: 'Failed to create bundles.tar.gz') {
806
+                                powershell '''
807
+                                $bundleName="windowsRS5-integration"
808
+                                Write-Host -ForegroundColor Green "Creating ${bundleName}-bundles.zip"
809
+
810
+                                # archiveArtifacts does not support env-vars to , so save the artifacts in a fixed location
811
+                                Compress-Archive -Path "${env:TEMP}/CIDUT.out", "${env:TEMP}/CIDUT.err" -CompressionLevel Optimal -DestinationPath "${bundleName}-bundles.zip"
812
+                                '''
813
+
814
+                                archiveArtifacts artifacts: '*-bundles.zip', allowEmptyArchive: true
815
+                            }
816
+                        }
817
+                        cleanup {
818
+                            sh 'make clean'
819
+                            deleteDir()
820
+                        }
821
+                    }
803 822
                 }
804 823
             }
805 824
         }
... ...
@@ -999,6 +999,10 @@ Finally {
999 999
 
1000 1000
     Set-Location "$env:SOURCES_DRIVE\$env:SOURCES_SUBDIR" -ErrorAction SilentlyContinue
1001 1001
     Nuke-Everything
1002
+
1003
+    # Restore the TEMP path
1004
+    if ($null -ne $TEMPORIG) { $env:TEMP="$TEMPORIG" }
1005
+
1002 1006
     $Dur=New-TimeSpan -Start $StartTime -End $(Get-Date)
1003 1007
     Write-Host -ForegroundColor $FinallyColour "`nINFO: executeCI.ps1 exiting at $(date). Duration $dur`n"
1004 1008