本文整理汇总了Golang中github.com/jfrogdev/jfrog-cli-go/utils/cliutils/log.Info函数的典型用法代码示例。如果您正苦于以下问题:Golang Info函数的具体用法?Golang Info怎么用?Golang Info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: GpgSignFile
func GpgSignFile(pathDetails *utils.PathDetails, passphrase string, bintrayDetails *config.BintrayDetails) error {
if bintrayDetails.User == "" {
bintrayDetails.User = pathDetails.Subject
}
url := bintrayDetails.ApiUrl + "gpg/" + pathDetails.Subject + "/" +
pathDetails.Repo + "/" + pathDetails.Path
var data string
if passphrase != "" {
data = "{ \"passphrase\": \"" + passphrase + "\" }"
}
log.Info("GPG signing file...")
httpClientsDetails := utils.GetBintrayHttpClientDetails(bintrayDetails)
resp, body, err := ioutils.SendPost(url, []byte(data), httpClientsDetails)
if err != nil {
return err
}
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("GPG signed file", pathDetails.Path, ", details:")
fmt.Println(cliutils.IndentJson(body))
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:27,代码来源:gpgsignfile.go
示例2: ShowVersion
func ShowVersion(versionDetails *utils.VersionDetails, bintrayDetails *config.BintrayDetails) error {
if bintrayDetails.User == "" {
bintrayDetails.User = versionDetails.Subject
}
version := versionDetails.Version
if versionDetails.Version == "" {
versionDetails.Version = "_latest"
version = "latest"
}
url := bintrayDetails.ApiUrl + "packages/" + versionDetails.Subject + "/" +
versionDetails.Repo + "/" + versionDetails.Package + "/versions/" + versionDetails.Version
log.Info("Getting version details...")
httpClientsDetails := utils.GetBintrayHttpClientDetails(bintrayDetails)
resp, body, _, _ := ioutils.SendGet(url, true, httpClientsDetails)
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Version", version, "details:")
fmt.Println(cliutils.IndentJson(body))
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:26,代码来源:versionshow.go
示例3: DeleteFiles
func DeleteFiles(resultItems []utils.AqlSearchResultItem, flags *DeleteFlags) error {
for _, v := range resultItems {
fileUrl, err := utils.BuildArtifactoryUrl(flags.ArtDetails.Url, v.GetFullUrl(), make(map[string]string))
if err != nil {
return err
}
if flags.DryRun {
log.Info("[Dry run] Deleting:", v.GetFullUrl())
continue
}
log.Info("Deleting:", v.GetFullUrl())
httpClientsDetails := utils.GetArtifactoryHttpClientDetails(flags.ArtDetails)
resp, body, err := ioutils.SendDelete(fileUrl, nil, httpClientsDetails)
if err != nil {
return err
}
if resp.StatusCode != 204 {
return cliutils.CheckError(errors.New("Artifactory response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Artifactory response:", resp.Status)
}
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:25,代码来源:delete.go
示例4: OfflineUpdate
func OfflineUpdate(flags *OfflineUpdatesFlags) error {
if err := buildUpdatesUrl(flags); err != nil {
return err
}
vulnerabilities, components, last_update, err := getFilesList(flags)
if err != nil {
return err
}
zipSuffix := "_" + strconv.FormatInt(last_update, 10)
xrayTempDir, err := getXrayTempDir()
if err != nil {
return err
}
if len(vulnerabilities) > 0 {
log.Info("Downloading vulnerabilities...")
if err := saveData(xrayTempDir, "vuln", zipSuffix, "", vulnerabilities); err != nil {
return err
}
} else {
log.Info("There aren't new vulnerabilities.")
}
if len(components) > 0 {
log.Info("Downloading components...")
if err := saveData(xrayTempDir, "comp", zipSuffix, "", components); err != nil {
return err
}
} else {
log.Info("There aren't new components.")
}
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:33,代码来源:offlineupdate.go
示例5: moveFile
func moveFile(sourcePath, destPath string, flags *MoveFlags, moveType MoveType) (bool, error) {
message := moveMsgs[moveType].MovingMsg + " artifact: " + sourcePath + " to: " + destPath
if flags.DryRun == true {
log.Info("[Dry run] ", message)
return true, nil
}
log.Info(message)
moveUrl := flags.ArtDetails.Url
restApi := "api/" + string(moveType) + "/" + sourcePath
requestFullUrl, err := BuildArtifactoryUrl(moveUrl, restApi, map[string]string{"to": destPath})
if err != nil {
return false, err
}
httpClientsDetails := GetArtifactoryHttpClientDetails(flags.ArtDetails)
resp, body, err := ioutils.SendPost(requestFullUrl, nil, httpClientsDetails)
if err != nil {
return false, err
}
if resp.StatusCode != 200 {
log.Error("Artifactory response: " + resp.Status + "\n" + cliutils.IndentJson(body))
}
log.Debug("Artifactory response:", resp.Status)
return resp.StatusCode == 200, nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:28,代码来源:moveutils.go
示例6: BuildPublish
func BuildPublish(buildName, buildNumber string, flags *utils.BuildInfoFlags) error {
err := utils.PreCommandSetup(flags)
if err != nil {
return err
}
buildData, err := utils.ReadBuildInfoFiles(buildName, buildNumber)
if err != nil {
return err
}
if len(buildData) == 0 {
return cliutils.CheckError(fmt.Errorf("Can't find any files related to build name: %q, number: %q", buildName, buildNumber))
}
sort.Sort(buildData)
buildInfo := createNewBuildInfo()
buildInfo.Name = buildName
buildInfo.Number = buildNumber
buildGeneralDetails, err := utils.ReadBuildInfoGeneralDetails(buildName, buildNumber)
if err != nil {
return err
}
buildInfo.Started = buildGeneralDetails.Timestamp.Format("2006-01-02T15:04:05.000-0700")
artifactsSet, dependenciesSet, env, err := prepareBuildInfoData(buildData, createIncludeFilter(flags), createExcludeFilter(flags))
if err != nil {
return err
}
if len(env) != 0 {
buildInfo.Propertires = env
}
module := createModule(buildName, artifactsSet, dependenciesSet)
buildInfo.Modules = append(buildInfo.Modules, module)
marshaledBuildInfo, err := json.Marshal(buildInfo)
if cliutils.CheckError(err) != nil {
return err
}
if flags.IsDryRun() {
fmt.Println(cliutils.IndentJson(marshaledBuildInfo))
return nil
}
httpClientsDetails := utils.GetArtifactoryHttpClientDetails(flags.ArtDetails)
utils.SetContentType("application/vnd.org.jfrog.artifactory+json", &httpClientsDetails.Headers)
log.Info("Deploying build info...")
resp, body, err := utils.PublishBuildInfo(flags.ArtDetails.Url, marshaledBuildInfo, httpClientsDetails)
if err != nil {
return err
}
if resp.StatusCode != 204 {
return cliutils.CheckError(errors.New("Artifactory response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Artifactory response:", resp.Status)
log.Info("Build info successfully deployed. Browse it in Artifactory under " + flags.ArtDetails.Url + "webapp/builds/" + buildName + "/" + buildNumber)
if err = utils.RemoveBuildDir(buildName, buildNumber); err != nil {
return err
}
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:58,代码来源:buildpublish.go
示例7: BuildClean
func BuildClean(buildName, buildNumber string) (err error) {
log.Info("Cleanning build info...")
err = utils.RemoveBuildDir(buildName, buildNumber)
if err != nil {
return
}
log.Info("Cleaned build info", buildName, "#"+buildNumber+".")
return err
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:9,代码来源:buildclean.go
示例8: BuildDistribute
func BuildDistribute(buildName, buildNumber, targetRepo string, flags *BuildDistributionFlags) error {
err := utils.PreCommandSetup(flags)
if err != nil {
return err
}
dryRun := ""
if flags.DryRun == true {
dryRun = "[Dry run] "
}
message := "Destributing build..."
log.Info(dryRun + message)
distributeUrl := flags.ArtDetails.Url
restApi := path.Join("api/build/distribute/", buildName, buildNumber)
requestFullUrl, err := utils.BuildArtifactoryUrl(distributeUrl, restApi, make(map[string]string))
if err != nil {
return err
}
data := BuildDistributionConfig{
SourceRepos: strings.Split(flags.SourceRepos, ","),
TargetRepo: targetRepo,
Publish: flags.Publish,
OverrideExistingFiles: flags.OverrideExistingFiles,
GpgPassphrase: flags.GpgPassphrase,
Async: flags.Async,
DryRun: flags.DryRun}
requestContent, err := json.Marshal(data)
if err != nil {
return cliutils.CheckError(errors.New("Failed to execute request. " + cliutils.GetDocumentationMessage()))
}
httpClientsDetails := utils.GetArtifactoryHttpClientDetails(flags.ArtDetails)
utils.SetContentType("application/json", &httpClientsDetails.Headers)
resp, body, err := ioutils.SendPost(requestFullUrl, requestContent, httpClientsDetails)
if err != nil {
return err
}
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Artifactory response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Artifactory response:", resp.Status)
if flags.Async && !flags.DryRun {
log.Info("Asynchronously distributed build", buildName, "#"+buildNumber, "to:", targetRepo, "repository, logs are avalable in Artifactory.")
return nil
}
log.Info(dryRun+"Distributed build", buildName, "#"+buildNumber, "to:", targetRepo, "repository.")
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:53,代码来源:builddistribute.go
示例9: CreateVersion
func CreateVersion(versionDetails *utils.VersionDetails, flags *utils.VersionFlags) error {
log.Info("Creating version...")
resp, body, err := doCreateVersion(versionDetails, flags, flags.BintrayDetails)
if err != nil {
return err
}
if resp.StatusCode != 201 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Created version", versionDetails.Version+", details:")
fmt.Println(cliutils.IndentJson(body))
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:14,代码来源:versioncreate.go
示例10: ShowAccessKeys
func ShowAccessKeys(bintrayDetails *config.BintrayDetails, org string) error {
path := GetAccessKeysPath(bintrayDetails, org)
httpClientsDetails := utils.GetBintrayHttpClientDetails(bintrayDetails)
log.Info("Getting access keys...")
resp, body, _, _ := ioutils.SendGet(path, true, httpClientsDetails)
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Access keys details:")
fmt.Println(cliutils.IndentJson(body))
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:14,代码来源:accesskeys.go
示例11: ShowAccessKey
func ShowAccessKey(flags *AccessKeyFlags, org string) (err error) {
url := GetAccessKeyPath(flags.BintrayDetails, flags.Id, org)
httpClientsDetails := utils.GetBintrayHttpClientDetails(flags.BintrayDetails)
log.Info("Getting access key...")
resp, body, _, _ := ioutils.SendGet(url, true, httpClientsDetails)
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Access keys details:")
fmt.Println(cliutils.IndentJson(body))
return
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:14,代码来源:accesskeys.go
示例12: uploadFiles
func uploadFiles(artifacts []cliutils.Artifact, baseUrl string, flags *UploadFlags) (totalUploaded,
totalFailed int, err error) {
size := len(artifacts)
var wg sync.WaitGroup
// Create an array of integers, to store the total file that were uploaded successfully.
// Each array item is used by a single thread.
uploadCount := make([]int, flags.Threads, flags.Threads)
matrixParams := getMatrixParams(flags)
for i := 0; i < flags.Threads; i++ {
wg.Add(1)
go func(threadId int) {
logMsgPrefix := cliutils.GetLogMsgPrefix(threadId, flags.DryRun)
for j := threadId; j < size; j += flags.Threads {
if err != nil {
break
}
url := baseUrl + artifacts[j].TargetPath + matrixParams
if !flags.DryRun {
uploaded, e := uploadFile(artifacts[j], url, logMsgPrefix, flags.BintrayDetails)
if e != nil {
err = e
break
}
if uploaded {
uploadCount[threadId]++
}
} else {
log.Info("[Dry Run] Uploading artifact:", artifacts[j].LocalPath)
uploadCount[threadId]++
}
}
wg.Done()
}(i)
}
wg.Wait()
totalUploaded = 0
for _, i := range uploadCount {
totalUploaded += i
}
log.Info("Uploaded", strconv.Itoa(totalUploaded), "artifacts.")
totalFailed = size - totalUploaded
if totalFailed > 0 {
log.Error("Failed uploading", strconv.Itoa(totalFailed), "artifacts.")
}
return
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:49,代码来源:upload.go
示例13: CreatePackage
func CreatePackage(packageDetails *utils.VersionDetails, flags *utils.PackageFlags) error {
log.Info("Creating package...")
resp, body, err := DoCreatePackage(packageDetails, flags)
if err != nil {
return err
}
if resp.StatusCode != 201 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Created package", packageDetails.Package+", details:")
fmt.Println(cliutils.IndentJson(body))
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:15,代码来源:packagecreate.go
示例14: MoveFilesWrapper
func MoveFilesWrapper(moveSpec *SpecFiles, flags *MoveFlags, moveType MoveType) (err error) {
err = PreCommandSetup(flags)
if err != nil {
return
}
var successCount int
var failedCount int
for i := 0; i < len(moveSpec.Files); i++ {
var successPartial, failedPartial int
switch moveSpec.Get(i).GetSpecType() {
case WILDCARD:
successPartial, failedPartial, err = moveWildcard(moveSpec.Get(i), flags, moveType)
case SIMPLE:
successPartial, failedPartial, err = moveSimple(moveSpec.Get(i), flags, moveType)
case AQL:
successPartial, failedPartial, err = moveAql(moveSpec.Get(i), flags, moveType)
}
successCount += successPartial
failedCount += failedPartial
if err != nil {
return
}
}
log.Info(moveMsgs[moveType].MovedMsg, strconv.Itoa(successCount), "artifacts.")
if failedCount > 0 {
err = cliutils.CheckError(errors.New("Failed " + moveMsgs[moveType].MovingMsg + " " + strconv.Itoa(failedCount) + " artifacts."))
}
return
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:33,代码来源:moveutils.go
示例15: DownloadVersion
func DownloadVersion(versionDetails *utils.VersionDetails, targetPath string, flags *utils.DownloadFlags) (totalDownloded, totalFailed int, err error) {
ioutils.CreateTempDirPath()
defer ioutils.RemoveTempDir()
if flags.BintrayDetails.User == "" {
flags.BintrayDetails.User = versionDetails.Subject
}
path := BuildDownloadVersionUrl(versionDetails, flags.BintrayDetails, flags.IncludeUnpublished)
httpClientsDetails := utils.GetBintrayHttpClientDetails(flags.BintrayDetails)
resp, body, _, _ := ioutils.SendGet(path, true, httpClientsDetails)
if resp.StatusCode != 200 {
err = cliutils.CheckError(errors.New(resp.Status + ". " + utils.ReadBintrayMessage(body)))
return
}
var results []VersionFilesResult
err = json.Unmarshal(body, &results)
if cliutils.CheckError(err) != nil {
return
}
totalDownloded, err = downloadFiles(results, versionDetails, targetPath, flags)
log.Info("Downloaded", strconv.Itoa(totalDownloded), "artifacts.")
totalFailed = len(results) - totalDownloded
return
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:25,代码来源:downloadversion.go
示例16: DeleteAccessKey
func DeleteAccessKey(flags *AccessKeyFlags, org string) error {
url := GetAccessKeyPath(flags.BintrayDetails, flags.Id, org)
httpClientsDetails := utils.GetBintrayHttpClientDetails(flags.BintrayDetails)
log.Info("Deleting access key...")
resp, body, err := ioutils.SendDelete(url, nil, httpClientsDetails)
if err != nil {
return err
}
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Deleted access key.")
return nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:16,代码来源:accesskeys.go
示例17: logDownloadTotals
func logDownloadTotals(buildDependencies [][]utils.DependenciesBuildInfo) {
var totalDownloded int
for _, v := range buildDependencies {
totalDownloded += len(v)
}
log.Info("Downloaded", strconv.Itoa(totalDownloded), "artifacts.")
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:7,代码来源:download.go
示例18: LogSearchResults
func LogSearchResults(numOfArtifacts int) {
var msgSuffix = "artifacts."
if numOfArtifacts == 1 {
msgSuffix = "artifact."
}
log.Info("Found", strconv.Itoa(numOfArtifacts), msgSuffix)
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:7,代码来源:aqlsearchutil.go
示例19: getFilesList
func getFilesList(flags *OfflineUpdatesFlags) ([]string, []string, int64, error) {
log.Info("Getting updates...")
headers := make(map[string]string)
headers["X-Xray-License"] = flags.License
httpClientDetails := ioutils.HttpClientDetails{
Headers: headers,
}
resp, body, _, err := ioutils.SendGet(updatesUrl, false, httpClientDetails)
if err != nil {
cliutils.CheckError(err)
return nil, nil, 0, err
}
if resp.StatusCode != 200 {
err := errors.New("Response: " + resp.Status)
cliutils.CheckError(err)
return nil, nil, 0, err
}
var urls FilesList
json.Unmarshal(body, &urls)
var vulnerabilities, components []string
for _, v := range urls.Urls {
if strings.Contains(v, VULNERABILITY) {
vulnerabilities = append(vulnerabilities, v)
} else if strings.Contains(v, COMPONENT) {
components = append(components, v)
}
}
return vulnerabilities, components, urls.Last_update, nil
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:29,代码来源:offlineupdate.go
示例20: GetPathsToDelete
func GetPathsToDelete(deleteSpec *utils.SpecFiles, flags *DeleteFlags) (resultItems []utils.AqlSearchResultItem, err error) {
log.Info("Searching artifacts...")
for i := 0; i < len(deleteSpec.Files); i++ {
var isDirectoryDeleteBool bool
isSimpleDirectoryDeleteBool, e := isSimpleDirectoryDelete(deleteSpec.Get(i))
if e != nil {
err = e
return
}
if !isSimpleDirectoryDeleteBool {
isDirectoryDeleteBool, e = isDirectoryDelete(deleteSpec.Get(i))
if e != nil {
err = e
return
}
}
switch {
case deleteSpec.Get(i).GetSpecType() == utils.AQL:
resultItemsTemp, e := utils.AqlSearchBySpec(deleteSpec.Get(i).Aql, flags)
if e != nil {
err = e
return
}
resultItems = append(resultItems, resultItemsTemp...)
case isSimpleDirectoryDeleteBool:
simplePathItem := utils.AqlSearchResultItem{Path: deleteSpec.Get(i).Pattern}
resultItems = append(resultItems, []utils.AqlSearchResultItem{simplePathItem}...)
case isDirectoryDeleteBool:
tempResultItems, e := utils.AqlSearchDefaultReturnFields(deleteSpec.Get(i).Pattern, true, "", flags)
if e != nil {
err = e
return
}
paths, e := getDirsForDeleteFromFilesPaths(deleteSpec.Get(i).Pattern, tempResultItems)
if e != nil {
err = e
return
}
resultItems = append(resultItems, paths...)
default:
isRecursive, e := cliutils.StringToBool(deleteSpec.Get(i).Recursive, true)
if e != nil {
err = e
return
}
tempResultItems, e := utils.AqlSearchDefaultReturnFields(deleteSpec.Get(i).Pattern,
isRecursive, deleteSpec.Get(i).Props, flags)
if e != nil {
err = e
return
}
resultItems = append(resultItems, tempResultItems...)
}
}
utils.LogSearchResults(len(resultItems))
return
}
开发者ID:JFrogDev,项目名称:jfrog-cli-go,代码行数:59,代码来源:delete.go
注:本文中的github.com/jfrogdev/jfrog-cli-go/utils/cliutils/log.Info函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论