// CreateRelease creates a new release.
166284
func (c *Client) CreateRelease(appID string, release *ct.Release) error {
	release.AppID = appID
	return c.Post("/releases", release, release)
}
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()
}
220512
func (h *Client) RollbackRelease(rlsName string, opts ...RollbackOption) (*rls.RollbackReleaseResponse, error) {
	reqOpts := h.opts
	for _, opt := range opts {
		opt(&reqOpts)
	}
	req := &reqOpts.rollbackReq
	req.Recreate = reqOpts.recreate
	req.Force = reqOpts.force
	req.DisableHooks = reqOpts.disableHooks
	req.DryRun = reqOpts.dryRun
	req.Name = rlsName
	ctx := NewContext()

	if reqOpts.before != nil {
		if err := reqOpts.before(ctx, req); err != nil {
			return nil, err
		}
	}
	return h.rollback(ctx, req)
}
237828
func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ...InstallOption) (*rls.InstallReleaseResponse, error) {
	for _, opt := range opts {
		opt(&c.Opts)
	}

	releaseName := c.Opts.instReq.Name
	releaseDescription := c.Opts.instReq.Description

	// Check to see if the release already exists.
	rel, err := c.ReleaseStatus(releaseName, nil)
	if err == nil && rel != nil {
		return nil, errors.New("cannot re-use a name that is still in use")
	}

	mockOpts := &MockReleaseOptions{
		Name:        releaseName,
		Chart:       chart,
		Config:      c.Opts.instReq.Values,
		Namespace:   ns,
		Description: releaseDescription,
	}

	release := ReleaseMock(mockOpts)

	if c.RenderManifests {
		if err := RenderReleaseMock(release, false); err != nil {
			return nil, err
		}
	}

	if !c.Opts.dryRun {
		c.Rels = append(c.Rels, release)
	}

	return &rls.InstallReleaseResponse{
		Release: release,
	}, nil
}
78671
func (e *ClientExecutor) Release() []error {
	errs := e.Volumes.Release()
	for _, fn := range e.Deferred {
		if err := fn(); err != nil {
			errs = append(errs, err)
		}
	}
	e.Deferred = nil
	return errs
}
90184
func (c *FakeFluxHelmReleases) Create(fluxHelmRelease *v1alpha2.FluxHelmRelease) (result *v1alpha2.FluxHelmRelease, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(fluxhelmreleasesResource, c.ns, fluxHelmRelease), &v1alpha2.FluxHelmRelease{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha2.FluxHelmRelease), err
}
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)
}
393091
func (r *Route) Release() {
	if r.ref != nil {
		r.ref.decRef()
		r.ref = nil
	}
}
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
}
1125739
func (h *Client) UpdateRelease(rlsName string, chstr string, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error) {
	// load the chart to update
	chart, err := chartutil.Load(chstr)
	if err != nil {
		return nil, err
	}

	return h.UpdateReleaseFromChart(rlsName, chart, opts...)
}
577559
func OriginalRelease(releases []*Release) *Release {

	if len(releases) == 0 {
		return nil
	}
	original := releases[0] // fall back on the first item

	for _, release := range releases {

		if !release.Date.IsZero() {

			if release.Date.Year() < original.Date.Year() || original.Date.IsZero() {
				original = release
			} else if release.Date.Year() == original.Date.Year() &&
				release.Date.Accuracy > Year {

				if original.Date.Accuracy == Year ||
					release.Date.Month() < original.Date.Month() {

					original = release

				} else if release.Date.Month() == original.Date.Month() &&
					release.Date.Accuracy > Month {

					if original.Date.Accuracy == Month ||
						release.Date.Day() < original.Date.Day() {
						original = release
					}
				}
			}
		}
	}

	return original
}
230086
func (s *Cluster) SetReleaseLabel(v string) *Cluster {
	s.ReleaseLabel = &v
	return s
}
124434
func (c *Client) ReleaseCreate(appIdentity string, slug string, options *ReleaseCreateOpts) (*Release, error) {
	params := struct {
		Slug        string  `json:"slug"`
		Description *string `json:"description,omitempty"`
	}{
		Slug: slug,
	}
	if options != nil {
		params.Description = options.Description
	}
	var releaseRes Release
	return &releaseRes, c.Post(&releaseRes, "/apps/"+appIdentity+"/releases", params)
}
312485
func (c *WS2Client) LookupRelease(id MBID, inc ...string) (*Release, error) {
	a := &Release{ID: id}
	err := c.Lookup(a, inc...)

	return a, err
}
61681
func (h *Client) InstallRelease(chstr, ns string, opts ...InstallOption) (*rls.InstallReleaseResponse, error) {
	// load the chart to install
	chart, err := chartutil.Load(chstr)
	if err != nil {
		return nil, err
	}

	return h.InstallReleaseFromChart(chart, ns, opts...)
}
562552
func (c *FakeHelmReleases) Create(helmRelease *v1beta1.HelmRelease) (result *v1beta1.HelmRelease, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(helmreleasesResource, c.ns, helmRelease), &v1beta1.HelmRelease{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1beta1.HelmRelease), err
}
505539
func (d *Deployment) HasRelease(name string) bool {
	for _, release := range d.Releases {
		if release.Name == name {
			return true
		}
	}
	return false
}