Esempio n. 1
0
func ReadBuildInfoFiles(buildName, buildNumber string) (BuildInfo, error) {
	var buildInfo []*ArtifactBuildInfoWrapper
	path, err := GetBuildDir(buildName, buildNumber)
	if err != nil {
		return nil, err
	}
	buildFiles, err := ioutils.ListFiles(path)
	if err != nil {
		return nil, err
	}
	for _, buildFile := range buildFiles {
		dir, err := ioutils.IsDir(buildFile)
		if err != nil {
			return nil, err
		}
		if dir {
			continue
		}
		if strings.HasSuffix(buildFile, BUILD_INFO_DETAILS) {
			continue
		}
		content, err := ioutils.ReadFile(buildFile)
		if err != nil {
			return nil, err
		}
		atifactBuildInfoWrapper := new(ArtifactBuildInfoWrapper)
		json.Unmarshal(content, &atifactBuildInfoWrapper)
		buildInfo = append(buildInfo, atifactBuildInfoWrapper)
	}

	return buildInfo, nil
}
Esempio n. 2
0
func ReadBuildInfoGeneralDetails(buildName, buildNumber string) (*BuildGeneralDetails, error) {
	path, err := GetBuildDir(buildName, buildNumber)
	if err != nil {
		return nil, err
	}
	path += BUILD_INFO_DETAILS
	content, err := ioutils.ReadFile(path)
	if err != nil {
		return nil, err
	}
	details := new(BuildGeneralDetails)
	json.Unmarshal(content, &details)
	return details, nil
}
Esempio n. 3
0
func readConf() (*Config, error) {
	confFilePath, err := getConFilePath()
	if err != nil {
		return nil, err
	}
	config := new(Config)
	exists, err := ioutils.IsFileExists(confFilePath)
	if err != nil {
		return nil, err
	}
	if !exists {
		return config, nil
	}
	content, err := ioutils.ReadFile(confFilePath)
	if err != nil {
		return nil, err
	}
	json.Unmarshal(content, &config)

	return config, nil
}