Пример #1
0
func execCreateRepoRest(repoConfig, repoName string) error {
	content, err := ioutil.ReadFile(repoConfig)
	if err != nil {
		return err
	}
	artHttpDetails := utils.GetArtifactoryHttpClientDetails(artifactoryDetails)
	artHttpDetails.Headers = map[string]string{"Content-Type": "application/json"}
	resp, _, err := ioutils.SendPut(*tests.RtUrl+"api/repositories/"+repoName, content, artHttpDetails)
	if err != nil {
		return err
	}
	if resp.StatusCode != 200 && resp.StatusCode != 201 {
		return errors.New("Fail to create repository. Reason local repository with key: " + repoName + " already exist\n")
	}
	log.Info("Repository", repoName, "was created.")
	return nil
}
Пример #2
0
func PublishBuildInfo(url string, content []byte, httpClientsDetails ioutils.HttpClientDetails) (resp *http.Response, body []byte, err error) {
	return ioutils.SendPut(url+"api/build/", content, httpClientsDetails)
}