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

Method getState

coderd/wsbuilder/wsbuilder.go:824–847  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

822}
823
824func (b *Builder) getState() ([]byte, error) {
825 if b.state.orphan {
826 // Orphan means empty state.
827 return nil, nil
828 }
829 if b.state.explicit != nil {
830 return *b.state.explicit, nil
831 }
832 // Default is to use state from prior build
833 bld, err := b.getLastBuild()
834 if xerrors.Is(err, sql.ErrNoRows) {
835 // last build does not exist, which implies empty state
836 return nil, nil
837 }
838 if err != nil {
839 return nil, xerrors.Errorf("get last build to get state: %w", err)
840 }
841 // nolint: gocritic // Workspace builder needs to read provisioner state for the new build.
842 state, err := b.store.GetWorkspaceBuildProvisionerStateByID(dbauthz.AsWorkspaceBuilder(b.ctx), bld.ID)
843 if err != nil {
844 return nil, xerrors.Errorf("get workspace build provisioner state: %w", err)
845 }
846 return state.ProvisionerState, nil
847}
848
849func (b *Builder) getParameters() (names, values []string, err error) {
850 if b.parameterNames != nil {

Callers 1

buildTxMethod · 0.95

Calls 5

getLastBuildMethod · 0.95
AsWorkspaceBuilderFunction · 0.92
IsMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected