github.com/devtron-labs/ci-runner@v0.0.0-20240518055909-b2672f3349d7/helper/LogUploadHelper.go (about)

     1  package helper
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/devtron-labs/ci-runner/util"
     6  	"log"
     7  	"path"
     8  )
     9  
    10  // UploadLogs
    11  // Checks of blob storage is configured, if yes, uploads the locally created log file to configured storage
    12  func UploadLogs(cloudHelperBaseConfig *util.CloudHelperBaseConfig) {
    13  
    14  	if !cloudHelperBaseConfig.StorageModuleConfigured {
    15  		log.Println(util.DEVTRON, "not going to upload logs as storage module not configured...")
    16  		return
    17  	}
    18  
    19  	err := UploadFileToCloud(cloudHelperBaseConfig, util.TmpLogLocation, path.Join(cloudHelperBaseConfig.BlobStorageLogKey, util.TmpLogLocation))
    20  	if err != nil {
    21  		fmt.Println("Failed to upload to blob storage with error", err)
    22  		return
    23  	}
    24  }