MCPcopy Index your code
hub / github.com/coder/coder / getLastBuild

Method getLastBuild

coderd/wsbuilder/wsbuilder.go:780–797  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

778}
779
780func (b *Builder) getLastBuild() (*database.WorkspaceBuild, error) {
781 if b.lastBuild != nil {
782 return b.lastBuild, nil
783 }
784 // last build might not exist, so we also store the error to prevent repeated queries
785 // for a non-existing build
786 if b.lastBuildErr != nil {
787 return nil, *b.lastBuildErr
788 }
789 bld, err := b.store.GetLatestWorkspaceBuildByWorkspaceID(b.ctx, b.workspace.ID)
790 if err != nil {
791 err = xerrors.Errorf("get workspace %s last build: %w", b.workspace.ID, err)
792 b.lastBuildErr = &err
793 return nil, err
794 }
795 b.lastBuild = &bld
796 return b.lastBuild, nil
797}
798
799// firstBuild returns true if this is the first build of the workspace, i.e. there are no prior builds.
800func (b *Builder) firstBuild() (bool, error) {

Callers 6

getTemplateVersionIDMethod · 0.95
firstBuildMethod · 0.95
getBuildNumberMethod · 0.95
getStateMethod · 0.95
getLastBuildJobMethod · 0.95

Calls 2

ErrorfMethod · 0.45

Tested by

no test coverage detected