mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
fix(cnbBuild): filter overall buildpacks key in the telemetry data (#3619)
Co-authored-by: Johannes Dillmann <j.dillmann@sap.com>
This commit is contained in:
parent
d2ef57bf5f
commit
c086f84668
@ -432,7 +432,7 @@ func runCnbBuild(config *cnbBuildOptions, telemetryData *telemetry.CustomData, t
|
||||
log.SetErrorCategory(log.ErrorConfiguration)
|
||||
return errors.Wrap(err, "failed to retrieve target image configuration")
|
||||
}
|
||||
customTelemetryData.Buildpacks.Overall = config.Buildpacks
|
||||
customTelemetryData.Buildpacks.Overall = privacy.FilterBuildpacks(config.Buildpacks)
|
||||
customTelemetryData.BuildEnv.KeyValues = privacy.FilterEnv(config.BuildEnvVars)
|
||||
telemetry.Data = append(telemetry.Data, customTelemetryData)
|
||||
|
||||
|
@ -520,7 +520,7 @@ uri = "some-buildpack"
|
||||
assert.Equal(t, "11", customData.Data[0].BuildEnv.KeyValues["BP_NODE_VERSION"])
|
||||
assert.NotContains(t, customData.Data[0].BuildEnv.KeyValues, "PROJECT_KEY")
|
||||
|
||||
assert.Contains(t, customData.Data[0].Buildpacks.Overall, "some-buildpack")
|
||||
assert.Contains(t, customData.Data[0].Buildpacks.Overall, "<redacted>")
|
||||
})
|
||||
|
||||
t.Run("success case (multiple images configured)", func(t *testing.T) {
|
||||
|
@ -85,7 +85,7 @@ func TestProjectDescriptor(t *testing.T) {
|
||||
Network: fmt.Sprintf("container:%s", registryContainer.GetContainerID()),
|
||||
})
|
||||
|
||||
container.whenRunningPiperCommand("cnbBuild", "-v", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", registryURL)
|
||||
container.whenRunningPiperCommand("cnbBuild", "-v", "--noTelemetry", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", registryURL)
|
||||
|
||||
container.assertHasOutput(t, "running command: /cnb/lifecycle/creator")
|
||||
container.assertHasOutput(t, "Dockerfile doesn't match include pattern, ignoring")
|
||||
@ -115,7 +115,7 @@ func TestZipPath(t *testing.T) {
|
||||
Network: fmt.Sprintf("container:%s", registryContainer.GetContainerID()),
|
||||
})
|
||||
|
||||
container.whenRunningPiperCommand("cnbBuild", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", registryURL, "--path", "go.zip")
|
||||
container.whenRunningPiperCommand("cnbBuild", "--noTelemetry", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", registryURL, "--path", "go.zip")
|
||||
|
||||
container.assertHasOutput(t, "running command: /cnb/lifecycle/creator")
|
||||
container.assertHasOutput(t, "Installing Go")
|
||||
@ -139,7 +139,7 @@ func TestNonZipPath(t *testing.T) {
|
||||
Network: fmt.Sprintf("container:%s", registryContainer.GetContainerID()),
|
||||
})
|
||||
|
||||
container.whenRunningPiperCommand("cnbBuild", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", registryURL, "--path", "mta.yaml")
|
||||
container.whenRunningPiperCommand("cnbBuild", "--noTelemetry", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", registryURL, "--path", "mta.yaml")
|
||||
|
||||
container.assertHasOutput(t, "Copying '/project/mta.yaml' into '/workspace' failed: application path must be a directory or zip")
|
||||
container.terminate(t)
|
||||
@ -158,7 +158,7 @@ func TestNpmCustomBuildpacksFullProject(t *testing.T) {
|
||||
Network: fmt.Sprintf("container:%s", registryContainer.GetContainerID()),
|
||||
})
|
||||
|
||||
container.whenRunningPiperCommand("cnbBuild", "--buildpacks", "gcr.io/paketo-buildpacks/nodejs:0.14.0", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", registryURL)
|
||||
container.whenRunningPiperCommand("cnbBuild", "--noTelemetry", "--buildpacks", "gcr.io/paketo-buildpacks/nodejs:0.14.0", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", registryURL)
|
||||
|
||||
container.assertHasOutput(t, "Setting custom buildpacks: '[gcr.io/paketo-buildpacks/nodejs:0.14.0]'")
|
||||
container.assertHasOutput(t, "Downloading buildpack 'gcr.io/paketo-buildpacks/nodejs:0.14.0' to /tmp/nodejs")
|
||||
@ -183,7 +183,7 @@ func TestNpmCustomBuildpacksBuildpacklessProject(t *testing.T) {
|
||||
Network: fmt.Sprintf("container:%s", registryContainer.GetContainerID()),
|
||||
})
|
||||
|
||||
container.whenRunningPiperCommand("cnbBuild", "--buildpacks", "gcr.io/paketo-buildpacks/nodejs:0.14.0", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", registryURL)
|
||||
container.whenRunningPiperCommand("cnbBuild", "--noTelemetry", "--buildpacks", "gcr.io/paketo-buildpacks/nodejs:0.14.0", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", registryURL)
|
||||
|
||||
container.assertHasOutput(t, "Setting custom buildpacks: '[gcr.io/paketo-buildpacks/nodejs:0.14.0]'")
|
||||
container.assertHasOutput(t, "Downloading buildpack 'gcr.io/paketo-buildpacks/nodejs:0.14.0' to /tmp/nodejs")
|
||||
@ -202,7 +202,7 @@ func TestWrongBuilderProject(t *testing.T) {
|
||||
TestDir: []string{"testdata", "TestMtaIntegration", "npm"},
|
||||
})
|
||||
|
||||
container.whenRunningPiperCommand("cnbBuild", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", "test")
|
||||
container.whenRunningPiperCommand("cnbBuild", "--noTelemetry", "--containerImageName", "not-found", "--containerImageTag", "0.0.1", "--containerRegistryUrl", "test")
|
||||
|
||||
container.assertHasOutput(t, "the provided dockerImage is not a valid builder")
|
||||
container.terminate(t)
|
||||
|
@ -1,5 +1,6 @@
|
||||
general:
|
||||
verbose: false
|
||||
collectTelemetryData: false
|
||||
steps:
|
||||
cnbBuild:
|
||||
bindings:
|
||||
|
@ -1,5 +1,6 @@
|
||||
general:
|
||||
verbose: true
|
||||
collectTelemetryData: false
|
||||
steps:
|
||||
cnbBuild:
|
||||
buildEnvVars:
|
||||
|
@ -1,3 +1,6 @@
|
||||
general:
|
||||
verbose: true
|
||||
collectTelemetryData: false
|
||||
steps:
|
||||
cnbBuild:
|
||||
containerRegistryUrl: localhost:5000
|
||||
|
@ -1,5 +1,6 @@
|
||||
general:
|
||||
verbose: true
|
||||
collectTelemetryData: false
|
||||
steps:
|
||||
cnbBuild:
|
||||
containerRegistryUrl: localhost:5000
|
||||
|
Loading…
x
Reference in New Issue
Block a user