1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-09-16 09:26:22 +02:00
This commit is contained in:
Philip Germanov
2025-03-20 17:14:06 +02:00
parent a6f92a10b2
commit 8ee3f302b5
3 changed files with 6 additions and 29 deletions

View File

@@ -56,19 +56,13 @@ func runBuildahExecute(config *buildahExecuteOptions, telemetryData *telemetry.C
// Prepare buildah command with options for container operation
cmdOpts := []string{
"bud", // The command (build-using-dockerfile)
"--storage-driver=vfs",
"--isolation=chroot", // Explicitly set isolation mode to chroot
"bud", // Using bud (build-using-dockerfile) for Dockerfile builds
"--format=docker", // Use Docker format for compatibility
"--log-level=debug", // Enable debug logging
}
// Now add all the command-specific options
budOpts := []string{
"--format=docker", // Use Docker format for compatibility
"--log-level=debug", // Enable debug logging
"--force-rm", // Remove intermediate containers
"--layers", // Enable layer caching
}
cmdOpts = append(cmdOpts, budOpts...)
// Add Dockerfile location if specified and different from context
if config.DockerfilePath != "." && config.DockerfilePath != "" {
cmdOpts = append(cmdOpts, fmt.Sprintf("-f=%s", config.DockerfilePath))
@@ -103,9 +97,6 @@ func runBuildahExecute(config *buildahExecuteOptions, telemetryData *telemetry.C
cmdOpts = append(cmdOpts, config.BuildOptions...)
}
// Add the build context directory as the final argument
cmdOpts = append(cmdOpts, ".")
// Log the command being executed (with sensitive data masked)
displayCmd := []string{}
for i, arg := range cmdOpts {

View File

@@ -344,7 +344,7 @@ func buildahExecuteMetadata() config.StepData {
},
},
Containers: []config.Container{
{Name: "buildah", Image: "quay.io/buildah/stable:latest", EnvVars: []config.EnvVar{{Name: "BUILDAH_ISOLATION", Value: "chroot"}, {Name: "STORAGE_DRIVER", Value: "vfs"}}},
{Name: "buildah", Image: "quay.io/buildah/stable:latest"},
},
Outputs: config.StepOutputs{
Resources: []config.StepResources{

View File

@@ -113,17 +113,3 @@ spec:
containers:
- name: buildah
image: quay.io/buildah/stable:latest
securityContext:
privileged: true
runAsUser: 1000
env:
- name: BUILDAH_ISOLATION
value: "chroot"
- name: STORAGE_DRIVER
value: "vfs"
volumeMounts:
- mountPath: /var/lib/containers
name: volume
volumes:
- name: volume
emptyDir: {}