kubesphere.io/s2irun@v3.2.1+incompatible/pkg/utils/status/build_status.go (about)

     1  package status
     2  
     3  import (
     4  	"github.com/kubesphere/s2irun/pkg/api"
     5  )
     6  
     7  const (
     8  	// ReasonAssembleFailed is the reason associated with the Assemble script
     9  	// failing.
    10  	ReasonAssembleFailed api.StepFailureReason = "AssembleFailed"
    11  	// ReasonMessageAssembleFailed is the message associated with the Assemble
    12  	// script failing.
    13  	ReasonMessageAssembleFailed api.StepFailureMessage = "Assemble script failed."
    14  
    15  	// ReasonPullBuilderImageFailed is the reason associated with failing to pull
    16  	// the builder image.
    17  	ReasonPullBuilderImageFailed api.StepFailureReason = "PullBuilderImageFailed"
    18  	// ReasonMessagePullBuilderImageFailed is the message associated with failing
    19  	// to pull the builder image.
    20  	ReasonMessagePullBuilderImageFailed api.StepFailureMessage = "Failed to pull builder image."
    21  
    22  	ReasonPushImageFailed api.StepFailureReason = "PushImageFailed"
    23  
    24  	ReasonMessagePushImageFailed api.StepFailureMessage = "Failed to push the final image."
    25  
    26  	// ReasonPullRuntimeImageFailed is the reason associated with failing to pull
    27  	// the runtime image.
    28  	ReasonPullRuntimeImageFailed api.StepFailureReason = "PullRuntimeImageFailed"
    29  	// ReasonMessagePullRuntimeImageFailed is the message associated with failing
    30  	// to pull the runtime image.
    31  	ReasonMessagePullRuntimeImageFailed api.StepFailureMessage = "Failed to pull runtime image."
    32  
    33  	// ReasonPullPreviousImageFailed is the reason associated with failing to
    34  	// pull the previous image.
    35  	ReasonPullPreviousImageFailed api.StepFailureReason = "PullPreviousImageFailed"
    36  
    37  	// ReasonMessagePullPreviousImageFailed is the message associated with
    38  	// failing to pull the previous image.
    39  	ReasonMessagePullPreviousImageFailed api.StepFailureMessage = "Failed to pull the previous image for incremental build."
    40  
    41  	// ReasonCommitContainerFailed is the reason associated with failing to
    42  	// commit the container to the final image.
    43  	ReasonCommitContainerFailed api.StepFailureReason = "ContainerCommitFailed"
    44  	// ReasonMessageCommitContainerFailed is the message associated with failing to
    45  	// commit the container to the final image.
    46  	ReasonMessageCommitContainerFailed api.StepFailureMessage = "Failed to commit container."
    47  
    48  	// ReasonFetchSourceFailed is the reason associated with failing to download
    49  	// the source of the build.
    50  	ReasonFetchSourceFailed api.StepFailureReason = "FetchSourceFailed"
    51  	// ReasonMessageFetchSourceFailed is the message associated with failing to download
    52  	// the source of the build.
    53  	ReasonMessageFetchSourceFailed api.StepFailureMessage = "Failed to fetch source for build."
    54  
    55  	// ReasonDockerImageBuildFailed is the reason associated with a failed
    56  	// Docker image build.
    57  	ReasonDockerImageBuildFailed api.StepFailureReason = "DockerImageBuildFailed"
    58  	// ReasonMessageDockerImageBuildFailed is the message associated with a failed
    59  	// Docker image build.
    60  	ReasonMessageDockerImageBuildFailed api.StepFailureMessage = "Docker image build failed."
    61  
    62  	// ReasonDockerfileCreateFailed is the reason associated with failing to create a
    63  	// Dockerfile for a build.
    64  	ReasonDockerfileCreateFailed api.StepFailureReason = "DockerFileCreationFailed"
    65  	// ReasonMessageDockerfileCreateFailed is the message associated with failing to create a
    66  	// Dockerfile for a build.
    67  	ReasonMessageDockerfileCreateFailed api.StepFailureMessage = "Failed to create Dockerfile."
    68  
    69  	// ReasonInvalidArtifactsMapping is the reason associated with an
    70  	// invalid artifacts mapping of files that need to be copied.
    71  	ReasonInvalidArtifactsMapping api.StepFailureReason = "InvalidArtifactsMapping"
    72  	// ReasonMessageInvalidArtifactsMapping is the message associated with an
    73  	// invalid artifacts mapping of files that need to be copied.
    74  	ReasonMessageInvalidArtifactsMapping api.StepFailureMessage = "Invalid artifacts mapping specified."
    75  
    76  	// ReasonScriptsFetchFailed is the reason associated with a failure to
    77  	// download specified scripts in the application image.
    78  	ReasonScriptsFetchFailed api.StepFailureReason = "FetchScriptsFailed"
    79  	// ReasonMessageScriptsFetchFailed is the message associated with a failure to
    80  	// download specified scripts in the application image.
    81  	ReasonMessageScriptsFetchFailed api.StepFailureMessage = "Failed to fetch specified scripts."
    82  
    83  	// ReasonRuntimeArtifactsFetchFailed is the reason associated with a failure
    84  	// to download the specified runtime scripts.
    85  	ReasonRuntimeArtifactsFetchFailed api.StepFailureReason = "FetchRuntimeArtifactsFailed"
    86  	// ReasonMessageRuntimeArtifactsFetchFailed is the message associated with a
    87  	// failure to download the specified runtime scripts in the application
    88  	// image.
    89  	ReasonMessageRuntimeArtifactsFetchFailed api.StepFailureMessage = "Failed to fetch specified runtime artifacts."
    90  
    91  	// ReasonFSOperationFailed is the reason associated with a failed fs
    92  	// operation. Create, remove directory, copy file, etc.
    93  	ReasonFSOperationFailed api.StepFailureReason = "FileSystemOperationFailed"
    94  	// ReasonMessageFSOperationFailed is the message associated with a failed fs
    95  	// operation. Create, remove directory, copy file, etc.
    96  	ReasonMessageFSOperationFailed api.StepFailureMessage = "Failed to perform filesystem operation."
    97  
    98  	// ReasonInstallScriptsFailed is the reason associated with a failure to
    99  	// install scripts in the builder image.
   100  	ReasonInstallScriptsFailed api.StepFailureReason = "InstallScriptsFailed"
   101  	// ReasonMessageInstallScriptsFailed is the message associated with a failure to
   102  	// install scripts in the builder image.
   103  	ReasonMessageInstallScriptsFailed api.StepFailureMessage = "Failed to install specified scripts."
   104  
   105  	// ReasonGenericS2IBuildFailed is the reason associated with a broad range of
   106  	// failures.
   107  	ReasonGenericS2IBuildFailed api.StepFailureReason = "GenericS2IBuildFailed"
   108  	// ReasonMessageGenericS2iBuildFailed is the message associated with a broad
   109  	// range of failures.
   110  	ReasonMessageGenericS2iBuildFailed api.StepFailureMessage = "Generic S2I Build failure - check S2I logs for details."
   111  
   112  	// ReasonOnBuildForbidden is the failure reason associated with an image that
   113  	// uses the ONBUILD instruction when it's not allowed.
   114  	ReasonOnBuildForbidden api.StepFailureReason = "OnBuildForbidden"
   115  	// ReasonMessageOnBuildForbidden is the message associated with an image that
   116  	// uses the ONBUILD instruction when it's not allowed.
   117  	ReasonMessageOnBuildForbidden api.StepFailureMessage = "ONBUILD instructions not allowed in this context."
   118  
   119  	// ReasonAssembleUserForbidden is the failure reason associated with an image that
   120  	// uses a forbidden AssembleUser.
   121  	ReasonAssembleUserForbidden api.StepFailureReason = "AssembleUserForbidden"
   122  
   123  	// ReasonMessageAssembleUserForbidden is the failure reason associated with an image that
   124  	// uses a forbidden AssembleUser.
   125  	ReasonMessageAssembleUserForbidden api.StepFailureMessage = "Assemble user for S2I build is forbidden."
   126  )
   127  
   128  // NewFailureReason initializes a new failure reason that contains both the
   129  // reason and a message to be displayed.
   130  func NewFailureReason(reason api.StepFailureReason, message api.StepFailureMessage) api.FailureReason {
   131  	return api.FailureReason{
   132  		Reason:  reason,
   133  		Message: message,
   134  	}
   135  }