// InstallRelease installs a release and stores the release record.
970458
func (s *ReleaseServer) InstallRelease(c ctx.Context, req *services.InstallReleaseRequest) (*services.InstallReleaseResponse, error) {
	s.Log("preparing install for %s", req.Name)
	rel, err := s.prepareRelease(req)
	if err != nil {
		s.Log("failed install prepare step: %s", err)
		res := &services.InstallReleaseResponse{Release: rel}

		// On dry run, append the manifest contents to a failed release. This is
		// a stop-gap until we can revisit an error backchannel post-2.0.
		if req.DryRun && strings.HasPrefix(err.Error(), "YAML parse error") {
			err = fmt.Errorf("%s\n%s", err, rel.Manifest)
		}
		return res, err
	}

	s.Log("performing install for %s", req.Name)
	res, err := s.performRelease(rel, req)
	if err != nil {
		s.Log("failed install perform step: %s", err)
	}
	return res, err
}
1094356
func (r *ReleaseReadCloser) Release() io.ReadCloser {
	result := r.ReadCloser
	r.ReadCloser = nil
	return result
}
782602
func (t *ContainerVolumeTracker) Release() []error {
	if t == nil {
		return nil
	}
	for path := range t.paths {
		t.ReleasePath(path)
	}
	return t.errs
}
1354052
func (h *Client) install(ctx context.Context, req *rls.InstallReleaseRequest) (*rls.InstallReleaseResponse, error) {
	c, err := h.connect(ctx)
	if err != nil {
		return nil, err
	}
	defer c.Close()

	rlc := rls.NewReleaseServiceClient(c)
	return rlc.InstallRelease(ctx, req)
}
1304197
func NewRelease(gitRepo *git.Repository, r *Release, uuids []string) error {
	isExist, err := IsReleaseExist(r.RepoID, r.TagName)
	if err != nil {
		return err
	} else if isExist {
		return ErrReleaseAlreadyExist{r.TagName}
	}

	if err = createTag(gitRepo, r); err != nil {
		return err
	}
	r.LowerTagName = strings.ToLower(r.TagName)

	sess := x.NewSession()
	defer sess.Close()
	if err = sess.Begin(); err != nil {
		return err
	}

	if _, err = sess.Insert(r); err != nil {
		return fmt.Errorf("Insert: %v", err)
	}

	if len(uuids) > 0 {
		if _, err = sess.In("uuid", uuids).Cols("release_id").Update(&Attachment{ReleaseID: r.ID}); err != nil {
			return fmt.Errorf("link attachments: %v", err)
		}
	}

	if err = sess.Commit(); err != nil {
		return fmt.Errorf("Commit: %v", err)
	}

	// Only send webhook when actually published, skip drafts
	if r.IsDraft {
		return nil
	}
	r, err = GetReleaseByID(r.ID)
	if err != nil {
		return fmt.Errorf("GetReleaseByID: %v", err)
	}
	r.preparePublishWebhooks()
	return nil
}
230232
func (s *RedisStore) Release() error {
	// Skip encoding if the data is empty
	if len(s.data) == 0 {
		return nil
	}

	data, err := session.EncodeGob(s.data)
	if err != nil {
		return err
	}

	return s.c.SetEx(s.prefix+s.sid, s.duration, string(data)).Err()
}
697976
func (mount *MountInfo) Release() error {
	ret := C.ceph_release(mount.mount)
	if ret != 0 {
		log.Errorf("Release: Failed to release mount")
		return cephError(ret)
	}
	return nil
}
281078
func (o *object) Release() error {
	if o.cachedcopy != nil {
		gou.Infof("release %q vs %q", o.cachedcopy.Name(), o.cachepath)
		o.cachedcopy.Close()
		return os.Remove(o.cachepath)
	}
	os.Remove(o.cachepath)
	return nil
}
1187061
func (c *GitHubClient) CreateRelease(ctx context.Context, req *github.RepositoryRelease) (*github.RepositoryRelease, error) {

	release, res, err := c.Repositories.CreateRelease(context.TODO(), c.Owner, c.Repo, req)
	if err != nil {
		return nil, errors.Wrap(err, "failed to create a release")
	}

	if res.StatusCode != http.StatusCreated {
		return nil, errors.Errorf("create release: invalid status: %s", res.Status)
	}

	return release, nil
}
662075
func (r *Release) GetUpgradableRelease(name string) (*hapi_release.Release, error) {
	rls, err := r.HelmClient.ReleaseContent(name)
	if err != nil {
		if strings.Contains(err.Error(), "not found") {
			return nil, nil
		}
		return nil, err
	}

	release := rls.GetRelease()
	status := release.GetInfo().GetStatus()

	switch status.GetCode() {
	case hapi_release.Status_DEPLOYED:
		return release, nil
	case hapi_release.Status_FAILED:
		return nil, fmt.Errorf("release requires a rollback before it can be upgraded (%s)", status.GetCode().String())
	case hapi_release.Status_PENDING_INSTALL,
	     hapi_release.Status_PENDING_UPGRADE,
	     hapi_release.Status_PENDING_ROLLBACK:
		return nil, fmt.Errorf("operation pending for release (%s)", status.GetCode().String())
	default:
		return nil, fmt.Errorf("current state prevents it from being upgraded (%s)", status.GetCode().String())
	}
}
227214
func (s *PostgresStore) Release() error {
	// Skip encoding if the data is empty
	if len(s.data) == 0 {
		return nil
	}

	data, err := session.EncodeGob(s.data)
	if err != nil {
		return err
	}

	_, err = s.c.Exec("UPDATE session SET data=$1, expiry=$2 WHERE key=$3",
		data, time.Now().Unix(), s.sid)
	return err
}
1172654
func NewCertificateRelease(c *Certificate, r *Release) *CertificateRelease {
	return &CertificateRelease{
		Certificate: c,
		Release:     r,
	}
}
1207687
func (i *VCSInstaller) Install() error {
	repo, err := vcs.NewRepo(i.Source, i.Path())
	if err != nil {
		return err
	}

	if err := i.sync(repo); err != nil {
		return err
	}

	ref, err := i.solveVersion(repo)
	if err != nil {
		return err
	}

	if ref != "" {
		if err := i.setVersion(repo, ref); err != nil {
			return err
		}
	}

	if !isRig(repo.LocalPath()) {
		return rig.ErrDoesNotExist
	}

	return nil
}
1224228
func (oid *OID) Release() error {
	if oid == nil || oid.C_gss_OID == nil {
		return nil
	}

	switch oid.alloc {
	case allocMalloc:
		// same as with get and set, use a C helper to free(oid.C_gss_OID.elements)
		C.helper_gss_OID_desc_free_elements(oid.C_gss_OID)
		C.free(unsafe.Pointer(oid.C_gss_OID))
		oid.C_gss_OID = nil
		oid.alloc = allocNone
	}

	return nil
}
507422
func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error) {
	u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
	return s.getSingleRelease(ctx, u)
}
1075197
func UpgradeRelease(req *rudderAPI.UpgradeReleaseRequest) (*rudderAPI.UpgradeReleaseResponse, error) {
	conn, err := grpc.Dial(grpcAddr, grpc.WithInsecure())
	if err != nil {
		return nil, err
	}
	defer conn.Close()
	client := rudderAPI.NewReleaseModuleServiceClient(conn)
	return client.UpgradeRelease(context.Background(), req)
}
51160
func (c *DefaultPlanner) Release(groups []CompactionGroup) {
	c.mu.Lock()
	defer c.mu.Unlock()
	for _, g := range groups {
		for _, f := range g {
			delete(c.filesInUse, f)
		}
	}
}