func (o Options) Run() error {
	spec, err := downwardapi.ResolveSpecFromEnv()
	if err != nil {
		return fmt.Errorf("could not resolve job spec: %v", err)
	}

	uploadTargets := map[string]gcs.UploadFunc{}

	var failed bool
	var mainRefSHA string
	if o.Log != "" {
		if failed, mainRefSHA, err = processCloneLog(o.Log, uploadTargets); err != nil {
			return err
		}
	}

	started := specToStarted(spec, mainRefSHA)

	startedData, err := json.Marshal(&started)
	if err != nil {
		return fmt.Errorf("could not marshal starting data: %v", err)
	}

	uploadTargets["started.json"] = gcs.DataUpload(bytes.NewReader(startedData))

	if err := o.Options.Run(spec, uploadTargets); err != nil {
		return fmt.Errorf("failed to upload to GCS: %v", err)
	}

	if failed {
		return errors.New("cloning the appropriate refs failed")
	}

	return nil
}
func (o Options) Run() error {
	spec, err := downwardapi.ResolveSpecFromEnv()
	if err != nil {
		return fmt.Errorf("could not resolve job spec: %v", err)
	}

	uploadTargets := map[string]gcs.UploadFunc{}

	var failed bool
	var mainRefSHA string
	if o.Log != "" {
		if failed, mainRefSHA, err = processCloneLog(o.Log, uploadTargets); err != nil {
			return err
		}
	}

	started := specToStarted(spec, mainRefSHA)

	startedData, err := json.Marshal(&started)
	if err != nil {
		return fmt.Errorf("could not marshal starting data: %v", err)
	}

	uploadTargets["started.json"] = gcs.DataUpload(bytes.NewReader(startedData))

	if err := o.Options.Run(spec, uploadTargets); err != nil {
		return fmt.Errorf("failed to upload to GCS: %v", err)
	}

	if failed {
		return errors.New("cloning the appropriate refs failed")
	}

	return nil
}
func ( o Options ) Run ( ) error { spec , err := downwardapi . ResolveSpecFromEnv ( ) if err != nil { return fmt . Errorf ( " " , err ) } uploadTargets := map [ string ] gcs . UploadFunc { } var failed bool var mainRefSHA string if o . Log != " " { if failed , mainRefSHA , err = processCloneLog ( o . Log , uploadTargets ) ; err != nil { return err } } started := specToStarted ( spec , mainRefSHA ) startedData , err := json . Marshal ( & started ) if err != nil { return fmt . Errorf ( " " , err ) } uploadTargets [ " " ] = gcs . DataUpload ( bytes . NewReader ( startedData ) ) if err := o . Options . Run ( spec , uploadTargets ) ; err != nil { return fmt . Errorf ( " " , err ) } if failed { return errors . New ( " " ) } return nil }
// Run will start the initupload job to upload the artifacts, logs and clone status.
Run will start the initupload job to upload the artifacts logs and clone status .