#36 Add archiveContainersLogs method
Merged 5 years ago by mikeb. Opened 5 years ago by mkovarik.
mkovarik/c3i-library gather-logs  into  master

file modified
+18
@@ -285,3 +285,21 @@ 

      echo 'Failed to sent the test result to ResultsDB.'

    }

  }

+ 

+ /**

+  * Send message with container testing results.

+  * @param project Openshift project with pods logs to archive.

+  */

+ def archiveContainersLogs(String project) {

+   dir('logs'){

+     echo "Gathering logs from Openshift project ${project}"

+     openshift.withCluster() {

+       openshift.withProject(project) {

+         openshift.selector('pods').withEach {

+           writeFile(file: it.name().minus('pod/'), text: openshift.raw("logs --all-containers ${it.name()}").out)

+         }

+       }

+     }

+   }

+   archiveArtifacts "logs/**"

+ }

Archives logs from all containers in selected openshift project.

Pull-Request has been merged by mikeb

5 years ago
Metadata