Skip to content

Commit

Permalink
Merge branch 'master' into unitTagsInstruction
Browse files Browse the repository at this point in the history
  • Loading branch information
o-liver authored Jun 10, 2024
2 parents 046c56b + 8eeba2d commit 62b29db
Show file tree
Hide file tree
Showing 53 changed files with 1,963 additions and 217 deletions.
27 changes: 21 additions & 6 deletions .mockery.yaml → .mockery.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
quiet: false
mockname: "{{.InterfaceName}}"
filename: "{{.InterfaceName}}.go"
dir: "{{.InterfaceDir}}/mocks"
outpkg: mocks
quiet: false
packages:
github.com/SAP/jenkins-library/cmd:
interfaces:
GithubRepoClient:
HadolintPiperFileUtils:
HadolintClient:
github.com/SAP/jenkins-library/pkg/config:
interfaces:
VaultClient:
github.com/SAP/jenkins-library/pkg/jenkins:
interfaces:
Artifact:
Build:
CredentialsManager:
Jenkins:
Job:
Task:
github.com/SAP/jenkins-library/pkg/kubernetes:
interfaces:
HelmExecutor:
github.com/influxdata/influxdb-client-go/v2:
config:
dir: pkg/influx/mocks
Expand All @@ -13,8 +33,3 @@ packages:
dir: pkg/influx/mocks
interfaces:
WriteAPIBlocking:
github.com/SAP/jenkins-library/pkg/config:
config:
dir: pkg/config/mocks
interfaces:
VaultClient:
8 changes: 4 additions & 4 deletions cmd/abapEnvironmentCheckoutBranch_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cmd/abapEnvironmentCloneGitRepo_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cmd/abapEnvironmentCreateTag_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cmd/abapEnvironmentPullGitRepo_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cmd/abapEnvironmentRunATCCheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ func TestHostConfig(t *testing.T) {
}

_, err := autils.GetAbapCommunicationArrangementInfo(options.AbapEnvOptions, "")
assert.EqualError(t, err, "Parameters missing. Please provide EITHER the Host of the ABAP server OR the Cloud Foundry ApiEndpoint, Organization, Space, Service Instance and a corresponding Service Key for the Communication Scenario SAP_COM_0510")
assert.EqualError(t, err, "Parameters missing. Please provide EITHER the Host of the ABAP server OR the Cloud Foundry API Endpoint, Organization, Space, Service Instance and Service Key")

_, err = autils.GetAbapCommunicationArrangementInfo(options.AbapEnvOptions, "")
assert.EqualError(t, err, "Parameters missing. Please provide EITHER the Host of the ABAP server OR the Cloud Foundry ApiEndpoint, Organization, Space, Service Instance and a corresponding Service Key for the Communication Scenario SAP_COM_0510")
assert.EqualError(t, err, "Parameters missing. Please provide EITHER the Host of the ABAP server OR the Cloud Foundry API Endpoint, Organization, Space, Service Instance and Service Key")
})

t.Run("Check Host: CF Service Key", func(t *testing.T) {
Expand Down
26 changes: 20 additions & 6 deletions cmd/codeqlExecuteScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,23 @@ func codeqlExecuteScan(config codeqlExecuteScanOptions, telemetryData *telemetry
influx.step_data.fields.codeql = true
}

func appendCodeqlQuery(cmd []string, codeqlQuery string) []string {
if len(codeqlQuery) > 0 {
cmd = append(cmd, codeqlQuery)
func appendCodeqlQuerySuite(utils codeqlExecuteScanUtils, cmd []string, querySuite, transformString string) []string {
if len(querySuite) > 0 {
if len(transformString) > 0 {
var bufferOut, bufferErr bytes.Buffer
utils.Stdout(&bufferOut)
defer utils.Stdout(log.Writer())
utils.Stderr(&bufferErr)
defer utils.Stderr(log.Writer())
if err := utils.RunExecutable("sh", []string{"-c", fmt.Sprintf("echo %s | sed -E \"%s\"", querySuite, transformString)}...); err != nil {
log.Entry().WithError(err).Error("failed to transform querySuite")
e := bufferErr.String()
log.Entry().Error(e)
} else {
querySuite = strings.TrimSpace(bufferOut.String())
}
}
cmd = append(cmd, querySuite)
}

return cmd
Expand Down Expand Up @@ -271,7 +285,7 @@ func runGithubUploadResults(config *codeqlExecuteScanOptions, repoInfo *codeql.R
func executeAnalysis(format, reportName string, customFlags map[string]string, config *codeqlExecuteScanOptions, utils codeqlExecuteScanUtils) ([]piperutils.Path, error) {
moduleTargetPath := filepath.Join(config.ModulePath, "target")
report := filepath.Join(moduleTargetPath, reportName)
cmd, err := prepareCmdForDatabaseAnalyze(customFlags, config, format, report)
cmd, err := prepareCmdForDatabaseAnalyze(utils, customFlags, config, format, report)
if err != nil {
log.Entry().Errorf("failed to prepare command for codeql database analyze (format=%s)", format)
return nil, err
Expand Down Expand Up @@ -323,11 +337,11 @@ func prepareCmdForDatabaseCreate(customFlags map[string]string, config *codeqlEx
return cmd, nil
}

func prepareCmdForDatabaseAnalyze(customFlags map[string]string, config *codeqlExecuteScanOptions, format, reportName string) ([]string, error) {
func prepareCmdForDatabaseAnalyze(utils codeqlExecuteScanUtils, customFlags map[string]string, config *codeqlExecuteScanOptions, format, reportName string) ([]string, error) {
cmd := []string{"database", "analyze", "--format=" + format, "--output=" + reportName, config.Database}
cmd = codeql.AppendThreadsAndRam(cmd, config.Threads, config.Ram, customFlags)
cmd = codeql.AppendCustomFlags(cmd, customFlags)
cmd = appendCodeqlQuery(cmd, config.QuerySuite)
cmd = appendCodeqlQuerySuite(utils, cmd, config.QuerySuite, config.TransformQuerySuite)
return cmd, nil
}

Expand Down
11 changes: 11 additions & 0 deletions cmd/codeqlExecuteScan_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 62b29db

Please sign in to comment.