build

package
v1.418.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 23 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Successful ResultState = "SUCCESSFUL"
	Warning    ResultState = "WARNING"
	Erroneous  ResultState = "ERRONEOUS"
	Aborted    ResultState = "ABORTED"

	Initializing RunState = "INITIALIZING" // Initializing : Build Framework prepared
	Accepted     RunState = "ACCEPTED"     // Accepted : Build Framework triggered
	Running      RunState = "RUNNING"      // Running : Build Framework performs build
	Finished     RunState = "FINISHED"     // Finished : Build Framework ended successful
	Failed       RunState = "FAILED"       // Failed : Build Framework endded with error

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Build added in v1.88.0

type Build struct {
	Connector   Connector
	BuildID     string      `json:"build_id"`
	RunState    RunState    `json:"run_state"`
	ResultState ResultState `json:"result_state"`
	Phase       string      `json:"phase"`
	Entitytype  string      `json:"entitytype"`
	Startedby   string      `json:"startedby"`
	StartedAt   string      `json:"started_at"`
	FinishedAt  string      `json:"finished_at"`
	Tasks       []task
	Values      []Value
}

Build : Information for all data comming from Build Framework

func GetMockBuildTestDownloadPublish added in v1.184.0

func GetMockBuildTestDownloadPublish() Build

func (*Build) DetermineFailureCause added in v1.368.0

func (b *Build) DetermineFailureCause() (string, error)

func (*Build) DownloadAllResults added in v1.184.0

func (b *Build) DownloadAllResults(basePath string, filenamePrefix string) error

DownloadAllResults : Downloads all build artefacts, saves it to basePath and the filenames can be modified with the filenamePrefix

func (*Build) DownloadResults added in v1.184.0

func (b *Build) DownloadResults(filenames []string, basePath string, filenamePrefix string) error

DownloadResults : Download results which are specified in filenames

func (*Build) EvaluteIfBuildSuccessful added in v1.184.0

func (b *Build) EvaluteIfBuildSuccessful(treatWarningsAsError bool) error

EvaluteIfBuildSuccessful : Checks the finale state of the build framework

func (*Build) Get added in v1.88.0

func (b *Build) Get() error

Get : Get all Build tasks

func (*Build) GetResult added in v1.88.0

func (b *Build) GetResult(name string) (*Result, error)

GetResult : Returns the last Build artefact created from build step

func (*Build) GetResults added in v1.184.0

func (b *Build) GetResults() error

GetResults : Gets all Build results

func (*Build) GetValues added in v1.184.0

func (b *Build) GetValues() error

GetValues : Gets all Build values

func (*Build) IsFinished added in v1.88.0

func (b *Build) IsFinished() bool

IsFinished : Returns Build run state

func (*Build) Poll added in v1.184.0

func (b *Build) Poll() error

Poll : waits for the build framework to be finished

func (*Build) PrintLogs added in v1.88.0

func (b *Build) PrintLogs() error

PrintLogs : Returns the Build logs

func (*Build) PublishAllDownloadedResults added in v1.184.0

func (b *Build) PublishAllDownloadedResults(stepname string, utils piperutils.FileUtils)

PublishAllDownloadedResults : publishes all build artefacts which were downloaded before

func (*Build) PublishDownloadedResults added in v1.184.0

func (b *Build) PublishDownloadedResults(stepname string, filenames []string, utils piperutils.FileUtils) error

PublishDownloadedResults : Publishes build artefacts specified in filenames

func (*Build) Start added in v1.88.0

func (b *Build) Start(phase string, inputValues Values) error

Start : Starts the Build Framework

type ClMock added in v1.88.0

type ClMock struct {
	Token      string
	StatusCode int
	Error      error
}

ClMock : Mock for Build Framework Client used for BF test

func (*ClMock) SendRequest added in v1.88.0

func (c *ClMock) SendRequest(method string, url string, bdy io.Reader, hdr http.Header, cookies []*http.Cookie) (*http.Response, error)

SendRequest : BF Send Fake request

func (*ClMock) SetOptions added in v1.88.0

func (c *ClMock) SetOptions(opts piperhttp.ClientOptions)

SetOptions : BF Client options

type Connector

type Connector struct {
	Client          piperhttp.Sender
	DownloadClient  piperhttp.Downloader
	Header          map[string][]string
	Baseurl         string
	Parameters      url.Values
	MaxRuntime      time.Duration // just as handover parameter for polling functions
	PollingInterval time.Duration // just as handover parameter for polling functions
}

Connector : Connector Utility Wrapping http client

func (Connector) Download

func (conn Connector) Download(appendum string, downloadPath string) error

Download : download a file via http

func (Connector) Get

func (conn Connector) Get(appendum string) ([]byte, error)

Get : http get request

func (*Connector) GetToken

func (conn *Connector) GetToken(appendum string) error

GetToken : Get the X-CRSF Token from ABAP Backend for later post

func (*Connector) InitAAKaaS

func (conn *Connector) InitAAKaaS(aAKaaSEndpoint string, username string, password string, inputclient piperhttp.Sender, originHash string, certFile string, certPass string) error

InitAAKaaS : initialize Connector for communication with AAKaaS backend

func (*Connector) InitBuildFramework added in v1.88.0

func (conn *Connector) InitBuildFramework(config ConnectorConfiguration, com abaputils.Communication, inputclient HTTPSendLoader) error

InitBuildFramework : initialize Connector for communication with ABAP SCP instance

func (Connector) Post

func (conn Connector) Post(appendum string, importBody string) ([]byte, error)

Post : http post request

func (Connector) UploadSarFile

func (conn Connector) UploadSarFile(appendum string, sarFile []byte) error

UploadSarFile : upload *.sar file

func (Connector) UploadSarFileInChunks added in v1.112.0

func (conn Connector) UploadSarFileInChunks(appendum string, fileName string, sarFile []byte) error

UploadSarFileInChunks : upload *.sar file in chunks

type ConnectorConfiguration added in v1.88.0

type ConnectorConfiguration struct {
	CfAPIEndpoint       string
	CfOrg               string
	CfSpace             string
	CfServiceInstance   string
	CfServiceKeyName    string
	Host                string
	Username            string
	Password            string
	AddonDescriptor     string
	MaxRuntimeInMinutes int
	CertificateNames    []string
	Parameters          url.Values
}

ConnectorConfiguration : Handover Structure for Connector Creation

type DownloadClientMock added in v1.88.0

type DownloadClientMock struct{}

DownloadClientMock : Mock for Download Client used for artefact test

func (*DownloadClientMock) DownloadFile added in v1.88.0

func (dc *DownloadClientMock) DownloadFile(url, filename string, header http.Header, cookies []*http.Cookie) error

DownloadFile : Empty file download

func (*DownloadClientMock) SetOptions added in v1.88.0

func (dc *DownloadClientMock) SetOptions(opts piperhttp.ClientOptions)

SetOptions : Download Client options

type GW_error added in v1.366.0

type GW_error struct {
	Error struct {
		Code    string
		Message struct {
			Lang  string
			Value string
		}
		Innererror struct {
			Application struct {
				Component_id      string
				Service_namespace string
				Service_id        string
				Service_version   string
			}
			Transactionid    string
			Timestamp        string
			Error_Resolution struct {
				SAP_Transaction string
				SAP_Note        string
			}
			Errordetails []struct {
				ContentID   string
				Code        string
				Message     string
				Propertyref string
				Severity    string
				Transition  bool
				Target      string
			}
		}
	}
}

func (*GW_error) ExtractStack added in v1.366.0

func (my_error *GW_error) ExtractStack() string

func (*GW_error) FromJson added in v1.366.0

func (my_error *GW_error) FromJson(inputJson []byte) error

type HTTPSendLoader added in v1.127.0

type HTTPSendLoader interface {
	piperhttp.Sender
	piperhttp.Downloader
}

HTTPSendLoader : combine both interfaces [sender, downloader]

type InputForPost added in v1.256.0

type InputForPost struct {
	Phase  string  `json:"phase"`
	Values []Value `json:"values"`
}

type MockClient added in v1.127.0

type MockClient struct {
	//Key = HTTP-Method + Url
	Data map[string][]http.Response
}

MockClient : use NewMockClient for construction

func GetBuildMockClient added in v1.127.0

func GetBuildMockClient() MockClient

GetBuildMockClient : Constructs a Mock Client with example build Requests/Responses

func GetBuildMockClientToRun2Times added in v1.195.0

func GetBuildMockClientToRun2Times() MockClient

GetBuildMockClientToRun2Times : Constructs a Mock Client with example build Requests/Responses, this can run two times

func GetBuildMockClientWithClient added in v1.232.0

func GetBuildMockClientWithClient() MockClient

func NewMockClient added in v1.127.0

func NewMockClient() MockClient

NewMockClient : Constructs a new Mock Client implementing piperhttp.Sender

func (*MockClient) Add added in v1.127.0

func (mc *MockClient) Add(Method, Url, Body string)

Add : adds a response with the given Body and statusOK to the mock lib

func (*MockClient) AddBody added in v1.127.0

func (mc *MockClient) AddBody(Method, Url, Body string, StatusCode int, header http.Header)

AddBody : adds a response with the given data to the mock lib

func (*MockClient) AddData added in v1.178.0

func (mc *MockClient) AddData(data MockData)

AddData : add the mock Data as response to the mock lib

func (*MockClient) AddResponse added in v1.127.0

func (mc *MockClient) AddResponse(Method, Url string, response http.Response)

AddResponse : adds a response object to the mock lib

func (*MockClient) DownloadFile added in v1.127.0

func (mc *MockClient) DownloadFile(Url, filename string, header http.Header, cookies []*http.Cookie) error

DownloadFile : Empty file download

func (*MockClient) SendRequest added in v1.127.0

func (mc *MockClient) SendRequest(Method, Url string, bdy io.Reader, hdr http.Header, cookies []*http.Cookie) (*http.Response, error)

SendRequest sets a HTTP response for a client mock

func (*MockClient) SetOptions added in v1.127.0

func (mc *MockClient) SetOptions(opts piperhttp.ClientOptions)

SetOptions : dummy as of now

type MockData added in v1.178.0

type MockData struct {
	Method     string
	Url        string
	Body       string
	StatusCode int
	Header     http.Header
}

MockData: data for the mockClient

type Result added in v1.88.0

type Result struct {
	BuildID        string `json:"build_id"`
	TaskID         int    `json:"task_id"`
	Name           string `json:"name"`
	AdditionalInfo string `json:"additional_info"`
	Mimetype       string `json:"mimetype"`
	SavedFilename  string
	DownloadPath   string
	// contains filtered or unexported fields
}

Result : Artefact from Build Framework step

func (*Result) Download added in v1.88.0

func (result *Result) Download(downloadPath string) error

Download : Provides the atrefact of build step

func (*Result) DownloadWithFilenamePrefixAndTargetDirectory added in v1.184.0

func (result *Result) DownloadWithFilenamePrefixAndTargetDirectory(basePath string, filenamePrefix string) error

DownloadWithFilenamePrefixAndTargetDirectory : downloads build artefact, saves it to basePath and the filename can be modified with the filenamePrefix

type ResultState added in v1.418.0

type ResultState string

type RunState added in v1.88.0

type RunState string

RunState : Current Status of the Build

type Value added in v1.88.0

type Value struct {
	BuildID string `json:"build_id,omitempty"`
	ValueID string `json:"value_id"`
	Value   string `json:"value"`
	// contains filtered or unexported fields
}

Value : Returns Build Runtime Value

type Values added in v1.88.0

type Values struct {
	Values []Value `json:"results"`
}

Values : Returns Build Runtime Values

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL