json

package
v0.0.0-...-3ba65a0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Float64Type         = "float64"
	StringToFloat64Type = "stringToFloat64"
	StringType          = "string"
	BoolType            = "bool"
	InterfaceListType   = "InterfaceList"
	DontCare            = "DontCare"
	HarnessAttribute    = "harness-attribute"
)
View Source
const (
	ArtifactUploaderImage = "plugins/nexus-publish:latest"
)
View Source
const (
	CoberturaToolName = "cobertura"
)
View Source
const (
	CoverageReportImage = "plugins/coverage-report"
)
View Source
const DroneS3UploadPublish = "harnesscommunity/drone-s3-upload-publish"
View Source
const (
	FlywayRunnerPluginImage = "plugins/flyway"
)
View Source
const (
	HttpRequestPluginImage = "plugins/httpRequest"
)
View Source
const (
	Root_Id = "0000000000000000"
)
View Source
const (
	SlackPluginImage = "plugins/slack"
)

Variables

View Source
var CorberturaJenkinsToDroneParamMapperList = []JenkinsToDroneParamMapper{
	{"coberturaReportFile", "reports_path_pattern", StringType, nil},
	{"failUnstable", "fail_on_threshold", BoolType, nil},
	{"failUnhealthy", "fail_on_threshold", BoolType, nil},
	{"conditionalCoverageTargets", "threshold_branch", Float64Type, MakeThresholdGetter("conditionalCoverageTargets")},
	{"classCoverageTargets", "threshold_class", Float64Type, MakeThresholdGetter("classCoverageTargets")},
	{"fileCoverageTargets", "threshold_file", Float64Type, MakeThresholdGetter("fileCoverageTargets")},
	{"packageCoverageTargets", "threshold_package", Float64Type, MakeThresholdGetter("packageCoverageTargets")},
	{"lineCoverageTargets", "threshold_line", Float64Type, MakeThresholdGetter("lineCoverageTargets")},
	{"methodCoverageTargets", "threshold_method", Float64Type, MakeThresholdGetter("methodCoverageTargets")},
	{"tool", "tool", StringType, SetCoberturaTool},
}
View Source
var JacocoJenkinsToDroneParamMapperList = []JenkinsToDroneParamMapper{
	{"changeBuildStatus", "fail_on_threshold", BoolType, nil},
	{"classPattern", "class_directories", StringType, nil},
	{"exclusionPattern", "class_exclusion_pattern", StringType, nil},
	{"inclusionPattern", "class_inclusion_pattern", StringType, nil},
	{"execPattern", "reports_path_pattern", StringType, nil},
	{"skipCopyOfSrcFiles", "skip_source_copy", BoolType, nil},
	{"sourcePattern", "source_directories", StringType, nil},
	{"sourceExclusionPattern", "source_exclusion_pattern", StringType, nil},
	{"sourceInclusionPattern", "source_inclusion_pattern", StringType, nil},
	{"minimumBranchCoverage", "threshold_branch", StringToFloat64Type, nil},
	{"minimumClassCoverage", "threshold_class", StringToFloat64Type, nil},
	{"minimumComplexityCoverage", "threshold_complexity", StringToFloat64Type, nil},
	{"minimumInstructionCoverage", "threshold_instruction", StringToFloat64Type, nil},
	{"minimumLineCoverage", "threshold_line", StringToFloat64Type, nil},
	{"minimumMethodCoverage", "threshold_method", StringToFloat64Type, nil},
	{"tool", "tool", StringType, SetJacocoTool},
}
View Source
var JenkinsToDroneParamMapperList = []JenkinsToDroneParamMapper{
	{"url", "url", StringType, nil},
	{"httpMode", "http_method", StringType, nil},
	{"validResponseCodes", "valid_response_codes", StringType, nil},
	{"timeout", "timeout", Float64Type, nil},
	{"validResponseContent", "valid_response_body", StringType, nil},
	{"wrapAsMultipart", "wrap_as_multipart", BoolType, nil},
	{"outputFile", "output_file", StringType, nil},
	{"ignoreSslErrors", "ignore_ssl", BoolType, nil},
	{"requestBody", "request_body", StringType, nil},
	{"consoleLogResponseBody", "log_response", BoolType, nil},
	{"quiet", "quiet", BoolType, nil},
	{"contentType", "content_type", StringType, nil},
	{"customHeaders", "headers", DontCare, HeaderToStrCsv},
	{"authentication", "auth_basic", StringType, nil},
	{"acceptType", "accept_type", StringType, nil},
	{"uploadFile", "upload_file", StringType, nil},
	{"multipartName", "multipart_name", StringType, nil},
}
View Source
var JenkinsToDroneSlackSendParamMapperList = []JenkinsToDroneParamMapper{
	{"channel", "channel", StringType, nil},
	{"tokenCredentialId", "access_token", StringType, nil},
	{"username", "username", StringType, nil},
	{"color", "color", StringType, nil},
	{"message", "message", StringType, nil},
	{"iconEmoji", "icon_emoji", StringType, nil},
	{"notifyCommitters", "committers_slack_id", BoolType, nil},
}
View Source
var JenkinsToDroneSlackUploadParamMapperList = []JenkinsToDroneParamMapper{
	{"filePath", "file_path", StringType, nil},
	{"channel", "channel", StringType, nil},
	{"credentialId", "access_token", StringType, nil},
	{"initialComment", "initial_comment", StringType, nil},
	{"failOnError", "fail_on_error", BoolType, nil},
}
View Source
var JenkinsToDroneSlackUserIdFromEmailParamMapperList = []JenkinsToDroneParamMapper{
	{"email", "slack_user_email_id", StringType, nil},
}
View Source
var JenkinsToDroneSlackUserIdsFromCommittersParamMapperList = []JenkinsToDroneParamMapper{
	{"email", "slack_user_email_id", StringType, nil},
}
View Source
var JenkinsToFlywayRunnerParamMapperList = []JenkinsToDroneParamMapper{
	{"url", "url", StringType, nil},
	{"commandLineArgs", "command_line_args", StringType, nil},
	{"flywayCommand", "flyway_command", StringType, nil},
	{"locations", "locations", StringType, nil},
	{"commandLineArgs", "command_line_args", StringType, nil},
}
View Source
var JenkinsToNexusArtifactUploaderParamMapperList = []JenkinsToDroneParamMapper{
	{"nexusVersion", "nexus_version", StringType, nil},
	{"nexusUrl", "server_url", StringType, nil},
	{"protocol", "protocol", StringType, nil},
	{"groupId", "group_id", StringType, nil},
	{"repository", "repository", StringType, nil},
}

Functions

func CastTo

func CastTo[T any](jenkinsParamInterface interface{}) (T, bool)

func ConvertAllureReport

func ConvertAllureReport(node Node) *harness.Step

func ConvertAllureSteps

func ConvertAllureSteps(node Node) []*harness.Step

ConvertAllureSteps combines both Allure report generation and S3 upload into one function

func ConvertAnchore

func ConvertAnchore(node Node, variables map[string]string) *harness.Step

func ConvertAnsibleAdhoc

func ConvertAnsibleAdhoc(node Node, arguments map[string]interface{}) *harness.Step

ConvertAnsibleAdhoc creates a Harness step for Ansible Ad-Hoc plugin with dynamic parameters.

func ConvertAnsiblePlaybook

func ConvertAnsiblePlaybook(node Node, arguments map[string]interface{}) *harness.Step

ConvertAnsiblePlaybook creates a Harness step for Ansible Playbook plugin with conditional parameters.

func ConvertAnsibleVault

func ConvertAnsibleVault(node Node, arguments map[string]interface{}) *harness.Step

ConvertAnsibleVault creates a Harness step for Ansible Vault plugin with dynamic parameters.

func ConvertArchive

func ConvertArchive(node Node) []*harness.Step

func ConvertArtifactUploadJfrog

func ConvertArtifactUploadJfrog(node Node, variables map[string]string, timeout string) *harness.Step

func ConvertBat

func ConvertBat(node Node, variables map[string]string, timeout string, dockerImage string) *harness.Step

func ConvertCheckout

func ConvertCheckout(node Node, variables map[string]string) *harness.Step

func ConvertClone

func ConvertClone(node Node) (*harness.CloneStage, *harness.Repository)

func ConvertCobertura

func ConvertCobertura(node Node, variables map[string]string) *harness.Step

func ConvertCucumber

func ConvertCucumber(node Node, parameterMap map[string]interface{}) *harness.Step

ConvertCucumber creates a Harness step for the Cucumber plugin.

func ConvertDeleteDir

func ConvertDeleteDir(node Node, variables map[string]string) *harness.Step

func ConvertDir

func ConvertDir(node Node, variables map[string]string) (*harness.Step, bool)

func ConvertDockerPushStep

func ConvertDockerPushStep(node Node, variables map[string]string, timeout string) *harness.Step

func ConvertEmailext

func ConvertEmailext(node Node, variables map[string]string, timeout string) *harness.Step

func ConvertFileCopy

func ConvertFileCopy(node Node, operation map[string]interface{}) *harness.Step

createFileCopyStep creates a Harness step for file copy operations.

func ConvertFileCreate

func ConvertFileCreate(node Node, operation map[string]interface{}) *harness.Step

createFileCreateStep creates a Harness step for file Create operations.

func ConvertFileDelete

func ConvertFileDelete(node Node, operation map[string]interface{}) *harness.Step

createFileDeleteStep creates a Harness step for file Delete operations.

func ConvertFileDownload

func ConvertFileDownload(node Node, operation map[string]interface{}) *harness.Step

createFileDownloadStep creates a Harness step for file Download operations.

func ConvertFileJoin

func ConvertFileJoin(node Node, operation map[string]interface{}) *harness.Step

createFileJoinStep creates a Harness step for file Join operations.

func ConvertFileJson

func ConvertFileJson(node Node, operation map[string]interface{}) *harness.Step

createFileJsonStep creates a Harness step for file file to json operations.

func ConvertFileRename

func ConvertFileRename(node Node, operation map[string]interface{}) *harness.Step

createFileRenameStep creates a Harness step for file Rename operations.

func ConvertFileTranform

func ConvertFileTranform(node Node, operation map[string]interface{}) *harness.Step

ConvertFileTranform creates a Harness step for file transform operations.

func ConvertFileUntar

func ConvertFileUntar(node Node, operation map[string]interface{}) *harness.Step

ConvertFileUntar creates a Harness step for file untar operations.

func ConvertFileUnzip

func ConvertFileUnzip(node Node, operation map[string]interface{}) *harness.Step

ConvertFileUnzip creates a Harness step for file unzip operations.

func ConvertFileZip

func ConvertFileZip(node Node, operation map[string]interface{}) *harness.Step

ConvertFileZip creates a Harness step for file zip operations.

func ConvertFindFiles

func ConvertFindFiles(node Node) *harness.Step

func ConvertFlywayRunner

func ConvertFlywayRunner(node Node, variables map[string]string) *harness.Step

func ConvertFolderCopy

func ConvertFolderCopy(node Node, operation map[string]interface{}) *harness.Step

ConvertFolderCopy creates a Harness step for Folder Copy operations.

func ConvertFolderCreate

func ConvertFolderCreate(node Node, operation map[string]interface{}) *harness.Step

ConvertFolderCreate creates a Harness step for Folder Create operations.

func ConvertFolderDelete

func ConvertFolderDelete(node Node, operation map[string]interface{}) *harness.Step

ConvertFolderDelete creates a Harness step for folder delete operations.

func ConvertFolderRename

func ConvertFolderRename(node Node, operation map[string]interface{}) *harness.Step

ConvertFolderRename creates a Harness step for folder rename operations.

func ConvertGatling

func ConvertGatling(node Node) *harness.Step

ConvertGatling creates a Harness step for Gatling plugin.

func ConvertHttpRequest

func ConvertHttpRequest(node Node, variables map[string]string) *harness.Step

func ConvertJacoco

func ConvertJacoco(node Node, variables map[string]string) *harness.Step

func ConvertJavadoc

func ConvertJavadoc(node Node, variables map[string]string) *harness.Step

ConvertJavadoc converts a Jenkins Node to a Harness Step with the Javadoc plugin spec.

func ConvertJiraBuildInfo

func ConvertJiraBuildInfo(node Node, variables map[string]string) *harness.Step

func ConvertJiraDeploymentInfo

func ConvertJiraDeploymentInfo(node Node, variables map[string]string) *harness.Step

func ConvertJunit

func ConvertJunit(node Node, variables map[string]string) *harness.Step

func ConvertKubeCtl

func ConvertKubeCtl(node Node, paramMap map[string]interface{}) *harness.Step

ConvertNunit creates a Harness step for nunit plugin.

func ConvertMailer

func ConvertMailer(node Node, arguments map[string]interface{}) *harness.Step

ConvertMailer creates a Harness step for nunit plugin.

func ConvertNexusArtifactUploader

func ConvertNexusArtifactUploader(node Node, variables map[string]string) *harness.Step

func ConvertNodejs

func ConvertNodejs(node Node) *harness.Step

ConvertNodejs creates a Harness step for nunit plugin.

func ConvertNotification

func ConvertNotification(node Node, parameterMap map[string]interface{}) *harness.Step

ConvertNotification creates a Harness step for Notification plugin.

func ConvertNunit

func ConvertNunit(node Node, arguments map[string]interface{}) *harness.Step

ConvertNunit creates a Harness step for nunit plugin.

func ConvertPagerDuty

func ConvertPagerDuty(node Node, arguments map[string]interface{}) *harness.Step

ConvertPagerduty creates a Harness step for nunit plugin.

func ConvertPagerDutyChangeEvent

func ConvertPagerDutyChangeEvent(node Node, arguments map[string]interface{}) *harness.Step

ConvertPagerDutyChangeEvent creates a Harness step for nunit plugin.

func ConvertPowerShell

func ConvertPowerShell(node Node, variables map[string]string, timeout string, dockerImage string) *harness.Step

func ConvertPublishHtml

func ConvertPublishHtml(node Node, variables map[string]string) *harness.Step

func ConvertPwsh

func ConvertPwsh(node Node, variables map[string]string, timeout string, dockerImage string) *harness.Step

func ConvertReadCsv

func ConvertReadCsv(node Node, variables map[string]string) *harness.Step

func ConvertReadFile

func ConvertReadFile(node Node, variables map[string]string) *harness.Step

func ConvertReadJson

func ConvertReadJson(node Node, variables map[string]string) *harness.Step

func ConvertReadMavenPom

func ConvertReadMavenPom(node Node) *harness.Step

func ConvertReadYaml

func ConvertReadYaml(node Node, variables map[string]string) *harness.Step

func ConvertSHA1

func ConvertSHA1(node Node, variables map[string]string, dockerImage string) *harness.Step

func ConvertSHA256

func ConvertSHA256(node Node, variables map[string]string, dockerImage string) *harness.Step

func ConvertSh

func ConvertSh(node Node, variables map[string]string, timeout string, dockerImage string, label string) *harness.Step

func ConvertSlackSend

func ConvertSlackSend(node Node, variables map[string]string) *harness.Step

func ConvertSlackUploadFile

func ConvertSlackUploadFile(node Node, variables map[string]string) *harness.Step

func ConvertSlackUserIdFromEmail

func ConvertSlackUserIdFromEmail(node Node, variables map[string]string) *harness.Step

func ConvertSlackUserIdsFromCommitters

func ConvertSlackUserIdsFromCommitters(node Node, variables map[string]string) *harness.Step

func ConvertSleep

func ConvertSleep(node Node, variables map[string]string) *harness.Step

func ConvertSonarQualityGate

func ConvertSonarQualityGate(node Node) *harness.Step

ConvertSonarQualityGate creates a Harness step for nunit plugin.

func ConvertSynopsysDetect

func ConvertSynopsysDetect(node Node, variables map[string]string) *harness.Step

func ConvertTar

func ConvertTar(node Node, variables map[string]string) *harness.Step

func ConvertTestng

func ConvertTestng(node Node, parameterMap map[string]interface{}) *harness.Step

ConvertTestng creates a Harness step for TestNG plugin.

func ConvertToStepUsingParameterMapDelegate

func ConvertToStepUsingParameterMapDelegate(node *Node, variables map[string]string,
	tmpJenkinsToDroneParamMapperList []JenkinsToDroneParamMapper, imageName string) *harness.Step

func ConvertToStepWithProperties

func ConvertToStepWithProperties(node *Node, variables map[string]string,
	tmpJenkinsToDroneParamMapperList []JenkinsToDroneParamMapper, imageName string) *harness.Step

func ConvertUnarchive

func ConvertUnarchive(node Node, paramMap map[string]interface{}) *harness.Step

ConvertUnarchive creates a Harness step for plugin step to handle unarchiving.

func ConvertUntar

func ConvertUntar(node Node, variables map[string]string) *harness.Step

func ConvertUnzip

func ConvertUnzip(node Node, variables map[string]string) *harness.Step

func ConvertVerifySha1

func ConvertVerifySha1(node Node, variables map[string]string, dockerImage string) *harness.Step

func ConvertVerifySha256

func ConvertVerifySha256(node Node, variables map[string]string, dockerImage string) *harness.Step

func ConvertWithCredentials

func ConvertWithCredentials(node Node) map[string]string

func ConvertWriteFile

func ConvertWriteFile(node Node, variables map[string]string) *harness.Step

func ConvertWriteJSON

func ConvertWriteJSON(node Node, variables map[string]string) *harness.Step

func ConvertWriteYaml

func ConvertWriteYaml(node Node, variables map[string]string) *harness.Step

func ConvertZip

func ConvertZip(node Node, variables map[string]string) *harness.Step

func Converts3Archive

func Converts3Archive(node Node, entryMap map[string]interface{}, index int) *harness.Step

Converts3Archive creates a Harness plugin step for archiving files and uploading them to S3. It uses data from the provided node and entryMap to configure the step, and generates a unique ID for each step.

Parameters:

  • node: The Node containing context for the step.
  • entryMap: A map containing key-value pairs used to customize the step, such as excluded files.
  • index: An incremental value used to ensure each step has a unique ID.

Returns:

  • harness.Step representing the configured S3 archive plugin step.

func Converts3Upload

func Converts3Upload(node Node, entryMap map[string]interface{}, index int) *harness.Step

Converts3Upload creates a Harness plugin step for uploading files to S3. It uses data from the provided node and entryMap to configure the step and generates a unique ID for each step.

Parameters:

  • node: The Node containing context for the step.
  • entryMap: A map containing key-value pairs used to customize the step.
  • index: An incremental value used to ensure each step has a unique ID.

Returns:

  • harness.Step representing the configured S3 upload plugin step.

func Converts3UploadStep

func Converts3UploadStep(node Node) *harness.Step

func ExtractEntries

func ExtractEntries(node Node) []map[string]interface{}

func FloatStringToFloat64Val

func FloatStringToFloat64Val(s string) (float64, bool)

func GetArtifactsListString

func GetArtifactsListString(node Node) (string, error)

func GetCoberturaThreshold

func GetCoberturaThreshold(attrKey string, attrMap map[string]interface{}) (interface{}, []string, error)

func GetStepUsingParameterMapDelegate

func GetStepUsingParameterMapDelegate(node *Node,
	tmpJenkinsToDroneParamMapperList []JenkinsToDroneParamMapper, imageName string) *harness.Step

func GetStepWithProperties

func GetStepWithProperties(node *Node,
	tmpJenkinsToDroneParamMapperList []JenkinsToDroneParamMapper, imageName string) *harness.Step

func HandleExtraVars

func HandleExtraVars(arguments map[string]interface{}) string

HandleExtraVars converts extraVars into a comma-separated string of key-value pairs.

func HandleForks

func HandleForks(arguments map[string]interface{}) int

HandleForks converts the forks parameter into an integer.

func HeaderToStrCsv

func HeaderToStrCsv(node *Node, attrMap map[string]interface{}, jenkinsKey string) (interface{}, error)

func MakeThresholdGetter

func MakeThresholdGetter(attrName string) func(node *Node,
	attrMap map[string]interface{}, jenkinsKey string) (interface{}, error)

func SafeAssignWithPropertiesTyped

func SafeAssignWithPropertiesTyped(node *Node, withProperties *map[string]interface{},
	attrMap map[string]interface{}, jenkinsKey, droneKey, jenkinsParamType string,
	paramTransformFunc ParamTransform, isWarn bool)

func SanitizeForId

func SanitizeForId(spanName string, spanId string) string

func SanitizeForName

func SanitizeForName(spanName string) string

func SetCoberturaTool

func SetCoberturaTool(node *Node, attrMap map[string]interface{}, jenkinsKey string) (interface{}, error)

func SetJacocoTool

func SetJacocoTool(node *Node, attrMap map[string]interface{}, jenkinsKey string) (interface{}, error)

func ToFloat64FromString

func ToFloat64FromString(s string) (float64, error)

func ToJsonStringFromMap

func ToJsonStringFromMap[T any](m T) (string, error)

func ToJsonStringFromStruct

func ToJsonStringFromStruct[T any](v T) (string, error)

func ToMapFromJsonString

func ToMapFromJsonString[T any](jsonString string) (T, error)

func ToStringArrayFromCsvString

func ToStringArrayFromCsvString(csv string) ([]string, error)

func ToStructFromJsonString

func ToStructFromJsonString[T any](jsonStr string) (T, error)

Types

type FileSpec

type FileSpec struct {
	Pattern string `json:"pattern"`
	Target  string `json:"target"`
}

func ParseHarnessAttribute

func ParseHarnessAttribute(attr string) ([]FileSpec, error)

type JenkinsToDroneParamMapper

type JenkinsToDroneParamMapper struct {
	JenkinsParam     string
	DroneParam       string
	JenkinsParamType string
	TransformFunc    ParamTransform
}

type Node

type Node struct {
	Name          string
	Parent        string
	SpanName      string
	SpanId        string
	ParentSpanId  string
	TraceId       string
	Children      []Node
	Type          string
	ParameterMap  map[string]interface{}
	AttributesMap map[string]string
}

type ParamTransform

type ParamTransform func(node *Node, attrMap map[string]interface{}, jenkinsKey string) (interface{}, error)

type PublishHtmlParameterMap

type PublishHtmlParameterMap struct {
	ParameterMap struct {
		Target struct {
			Include     string `json:"includes"`
			ReportDir   string `json:"reportDir"`
			ReportFiles string `json:"reportFiles"`
			ReportName  string `json:"reportName"`
		} `json:"target"`
	} `json:"ParameterMap"`
}

type Spec

type Spec struct {
	Files []FileSpec `json:"files"`
}

Jump to

Keyboard shortcuts

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