github.com/SupersunnySea/draft@v0.16.0/pkg/builder/summary.go (about)

     1  package builder
     2  
     3  // SummaryStatusCode is the enumeration of the possible status codes returned for a draft up.
     4  type SummaryStatusCode int
     5  
     6  const (
     7  	// SummaryUnknown means that the status of `draft up` is in an unknown state.
     8  	SummaryUnknown SummaryStatusCode = iota
     9  	// SummaryLogging means that the status is currently gathering and exporting logs.
    10  	SummaryLogging
    11  	// SummaryStarted means that `draft up` has begun.
    12  	SummaryStarted
    13  	// SummaryOngoing means that `draft up` is ongoing and we are waiting for further information from the builder.
    14  	SummaryOngoing
    15  	// SummarySuccess means that `draft up` has succeeded.
    16  	SummarySuccess
    17  	// SummaryFailure means that `draft up` has failed. Usually this can be followed up by checking the build logs.
    18  	SummaryFailure
    19  )
    20  
    21  // SummaryStatusCodeName is the relation between summary status code enums and their respective names.
    22  var SummaryStatusCodeName = map[int]string{
    23  	0: "UNKNOWN",
    24  	1: "LOGGING",
    25  	2: "STARTED",
    26  	3: "ONGOING",
    27  	4: "SUCCESS",
    28  	5: "FAILURE",
    29  }
    30  
    31  // Summary is the message returned when executing a draft up.
    32  type Summary struct {
    33  	// StageDesc describes the particular stage this summary
    34  	// represents, e.g. "Build Docker Image." This is meant
    35  	// to be a canonical summary of the stage's intent.
    36  	StageDesc string `json:"stage_desc,omitempty"`
    37  	// status_text indicates a string description of the progress
    38  	// or completion of draft up.
    39  	StatusText string `json:"status_text,omitempty"`
    40  	// status_code indicates the status of the progress or
    41  	// completion of a draft up.
    42  	StatusCode SummaryStatusCode `json:"status_code,omitempty"`
    43  	// build_id is the build identifier associated with this draft up build.
    44  	BuildID string `json:"build_id,omitempty"`
    45  }