1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-09-16 09:26:22 +02:00

add toml flag

This commit is contained in:
Christopher Fenner
2025-09-11 11:33:20 +02:00
parent e6e546343c
commit b97ac3d805
3 changed files with 20 additions and 1 deletions

View File

@@ -65,7 +65,7 @@ func runPythonBuild(config *pythonBuildOptions, telemetryData *telemetry.CustomD
//TODO: use a defer func to cleanup the virtual environment
// FEATURE FLAG (com_sap_piper_featureFlag_pythonToml) to switch to new implementation of python build step
if feature.IsFeatureEnabled("pythonToml") {
if config.UseTomlFile || feature.IsFeatureEnabled("pythonToml") {
// check project descriptor
buildDescriptorFilePath, err := searchDescriptor([]string{"pyproject.toml", "setup.py"}, utils.FileExists)
if err != nil {

View File

@@ -29,6 +29,7 @@ type pythonBuildOptions struct {
BuildSettingsInfo string `json:"buildSettingsInfo,omitempty"`
VirutalEnvironmentName string `json:"virutalEnvironmentName,omitempty"`
RequirementsFilePath string `json:"requirementsFilePath,omitempty"`
UseTomlFile bool `json:"useTomlFile,omitempty"`
}
type pythonBuildCommonPipelineEnvironment struct {
@@ -203,6 +204,7 @@ func addPythonBuildFlags(cmd *cobra.Command, stepConfig *pythonBuildOptions) {
cmd.Flags().StringVar(&stepConfig.BuildSettingsInfo, "buildSettingsInfo", os.Getenv("PIPER_buildSettingsInfo"), "build settings info is typically filled by the step automatically to create information about the build settings that were used during the maven build . This information is typically used for compliance related processes.")
cmd.Flags().StringVar(&stepConfig.VirutalEnvironmentName, "virutalEnvironmentName", `piperBuild-env`, "name of the virtual environment that will be used for the build")
cmd.Flags().StringVar(&stepConfig.RequirementsFilePath, "requirementsFilePath", `requirements.txt`, "file path to the requirements.txt file needed for the sbom cycloneDx file creation.")
cmd.Flags().BoolVar(&stepConfig.UseTomlFile, "useTomlFile", false, "Determines if a pyproject.toml file should be used for dependency management.")
}
@@ -327,6 +329,15 @@ func pythonBuildMetadata() config.StepData {
Aliases: []config.Alias{},
Default: `requirements.txt`,
},
{
Name: "useTomlFile",
ResourceRef: []config.ResourceReference{},
Scope: []string{"STEPS", "STAGES", "PARAMETERS"},
Type: "bool",
Mandatory: false,
Aliases: []config.Alias{},
Default: false,
},
},
},
Containers: []config.Container{

View File

@@ -105,6 +105,14 @@ spec:
- STAGES
- PARAMETERS
default: requirements.txt
- name: useTomlFile
type: bool
default: false
description: Determines if a pyproject.toml file should be used for dependency management.
scope:
- STEPS
- STAGES
- PARAMETERS
outputs:
resources:
- name: commonPipelineEnvironment