github.com/openshift/source-to-image@v1.4.1-0.20240516041539-bf52fc02204e/pkg/util/status/build_status.go (about)

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