// HasRelease if deployment has release
505539
func (d *Deployment) HasRelease(name string) bool {
	for _, release := range d.Releases {
		if release.Name == name {
			return true
		}
	}
	return false
}
1228260
func (c *Client) Release(acknowledgement dhcp4.Packet) error {
	release := c.ReleasePacket(&acknowledgement)
	release.PadToMinSize()

	return c.SendPacket(release)
}
719598
func (c *Client) GetAppRelease(appID string) (*ct.Release, error) {
	release := &ct.Release{}
	return release, c.Get(fmt.Sprintf("/apps/%s/release", appID), release)
}
84993
func (s *ReleaseServer) UpdateRelease(c ctx.Context, req *services.UpdateReleaseRequest) (*services.UpdateReleaseResponse, error) {
	if err := validateReleaseName(req.Name); err != nil {
		s.Log("updateRelease: Release name is invalid: %s", req.Name)
		return nil, err
	}
	s.Log("preparing update for %s", req.Name)
	currentRelease, updatedRelease, err := s.prepareUpdate(req)
	if err != nil {
		if req.Force {
			// Use the --force, Luke.
			return s.performUpdateForce(req)
		}
		return nil, err
	}

	if !req.DryRun {
		s.Log("creating updated release for %s", req.Name)
		if err := s.env.Releases.Create(updatedRelease); err != nil {
			return nil, err
		}
	}

	s.Log("performing update for %s", req.Name)
	res, err := s.performUpdate(currentRelease, updatedRelease, req)
	if err != nil {
		return res, err
	}

	if !req.DryRun {
		s.Log("updating status for updated release for %s", req.Name)
		if err := s.env.Releases.Update(updatedRelease); err != nil {
			return res, err
		}
	}

	return res, nil
}
1213192
func (c *Client) GetRelease(releaseID string) (*ct.Release, error) {
	release := &ct.Release{}
	return release, c.Get(fmt.Sprintf("/releases/%s", releaseID), release)
}
109936
func getKernelRelease() (string, error) {
	output, err := exec.Command("uname", "-r").Output()
	if err != nil {
		return "", errors.Wrap(err, "failed to get kernel release")
	}
	return strings.TrimSpace(string(output)), nil
}
444339
func (s *releasesService) CreateAndRelease(ctx context.Context, db *gorm.DB, r *Release, ss twelvefactor.StatusStream) (*Release, error) {
	r, err := s.Create(ctx, db, r)
	if err != nil {
		return r, err
	}
	// Schedule the new release onto the cluster.
	return r, s.Release(ctx, r, ss)
}
192816
func (s *ReleaseServer) RollbackRelease(c ctx.Context, req *services.RollbackReleaseRequest) (*services.RollbackReleaseResponse, error) {
	s.Log("preparing rollback of %s", req.Name)
	currentRelease, targetRelease, err := s.prepareRollback(req)
	if err != nil {
		return nil, err
	}

	if !req.DryRun {
		s.Log("creating rolled back release for %s", req.Name)
		if err := s.env.Releases.Create(targetRelease); err != nil {
			return nil, err
		}
	}
	s.Log("performing rollback of %s", req.Name)
	res, err := s.performRollback(currentRelease, targetRelease, req)
	if err != nil {
		return res, err
	}

	if !req.DryRun {
		s.Log("updating status for rolled back release for %s", req.Name)
		if err := s.env.Releases.Update(targetRelease); err != nil {
			return res, err
		}
	}

	return res, nil
}
173163
func releasesLastVersion(db *gorm.DB, appID string) (int, error) {
	var version int

	rows, err := db.Raw(`select version from releases where app_id = ? order by version desc`, appID).Rows()
	if err != nil {
		return version, err
	}
	defer rows.Close()

	for rows.Next() {
		err := rows.Scan(&version)
		return version, err
	}

	return version, nil
}
796854
func GetRelease(repoID int64, tagName string) (*Release, error) {
	isExist, err := IsReleaseExist(repoID, tagName)
	if err != nil {
		return nil, err
	} else if !isExist {
		return nil, ErrReleaseNotExist{0, tagName}
	}

	r := &Release{RepoID: repoID, LowerTagName: strings.ToLower(tagName)}
	if _, err = x.Get(r); err != nil {
		return nil, fmt.Errorf("Get: %v", err)
	}

	return r, r.LoadAttributes()
}
865427
func (r *RepoFile) Has(name string) bool {
	for _, rf := range r.Repositories {
		if rf.Name == name {
			return true
		}
	}
	return false
}
475193
func (d DirectorImpl) releaseHasCompiledPackage(releaseSlug ReleaseSlug, osVersionSlug OSVersionSlug) (bool, error) {
	release, err := d.FindRelease(releaseSlug)
	if err != nil {
		return false, err
	}

	pkgs, err := release.Packages()
	if err != nil {
		return false, err
	}

	for _, pkg := range pkgs {
		for _, compiledPkg := range pkg.CompiledPackages {
			if compiledPkg.Stemcell == osVersionSlug {
				return true, nil
			}
		}
	}

	return false, nil
}
1021597
func (c *Client) GetReleases() ([]Release, error) {
	r := c.NewRequest("GET", "/releases")
	resp, err := c.DoRequest(r)

	if err != nil {
		log.Printf("Error requesting releases  %v", err)
		return nil, err
	}
	defer resp.Body.Close()

	resBody, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Printf("Error reading releases request %v", resBody)
		return nil, err
	}

	releases := []Release{}
	err = json.Unmarshal(resBody, &releases)
	if err != nil {
		log.Printf("Error unmarshaling releases %v", err)
	}
	return releases, err
}
775826
func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error) {
	u := fmt.Sprintf("repos/%s/%s/releases", owner, repo)

	releaseReq := &repositoryReleaseRequest{
		TagName:         release.TagName,
		TargetCommitish: release.TargetCommitish,
		Name:            release.Name,
		Body:            release.Body,
		Draft:           release.Draft,
		Prerelease:      release.Prerelease,
	}

	req, err := s.client.NewRequest("POST", u, releaseReq)
	if err != nil {
		return nil, nil, err
	}

	r := new(RepositoryRelease)
	resp, err := s.client.Do(ctx, req, r)
	if err != nil {
		return nil, resp, err
	}
	return r, resp, nil
}
1284588
func (lk *consulLock) IsReleased() bool {
	lk.mutex.Lock()
	defer lk.mutex.Unlock()
	return lk.isReleased
}
546595
func FilterByRelease(version string) (CertificateFilter, error) {
	verFilter, err := regexp.Compile(version)
	if err != nil {
		return nil, err
	}

	return func(cm *CertificateMetadata) bool {
		for _, rel := range cm.Releases {
			if verFilter.MatchString(rel.Version) {
				return true
			}
		}
		return false
	}, nil
}
1082150
func sendRelease(ds *Dsync, c NetLocker, name, uid string, isReadLock bool) {
	args := LockArgs{
		UID:             uid,
		Resource:        name,
		ServerAddr:      ds.rpcClnts[ds.ownNode].ServerAddr(),
		ServiceEndpoint: ds.rpcClnts[ds.ownNode].ServiceEndpoint(),
	}
	if len(uid) == 0 {
		if _, err := c.ForceUnlock(args); err != nil {
			log("Unable to call ForceUnlock", err)
		}
	} else if isReadLock {
		if _, err := c.RUnlock(args); err != nil {
			log("Unable to call RUnlock", err)
		}
	} else {
		if _, err := c.Unlock(args); err != nil {
			log("Unable to call Unlock", err)
		}
	}
}