Skip to content

Conversion fixes, add conversion for background step, gitClone step and runtime/infra in CI stages.#312

Merged
Ompragash merged 53 commits intomasterfrom
v0tov1
Feb 16, 2026
Merged

Conversion fixes, add conversion for background step, gitClone step and runtime/infra in CI stages.#312
Ompragash merged 53 commits intomasterfrom
v0tov1

Conversation

@peroxidemonke7
Copy link
Copy Markdown
Contributor

No description provided.

peroxidemonke7 and others added 30 commits September 24, 2025 11:35
…ing of days and weeks when unmarshaling json/yaml
…delegateSelector and failureStrategy conversion
… conversion to use an empty template for step types whose conversion is yet to be implemented
Copy link
Copy Markdown
Member

@Ompragash Ompragash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Took a thorough look at the changes. Solid work overall. Found a few things that need to be addressed before we merge this in:

Must-fix:

  • StepGitClone YAML tags are broken - Repository has a typo (yaml:"repoNama"yaml:"repoName"), and Depth, SSLVerify, and Timeout all share the same yaml:"cloneDirectory" tag. Each needs its own correct tag (yaml:"depth", yaml:"sslVerify", yaml:"timeout"). This will silently break YAML unmarshalling for those fields.

  • Env type mismatch in ConvertStepBackground - StepBackground.Env is *flexible.Field[map[string]interface{}] but it's being assigned directly to v1.StepRun.Env. This needs proper type conversion.

  • Nil pointer risk in ConvertStepGitClone - if build.Spec is nil, accessing build.Spec.Branch etc. will panic. Add a nil guard for build.Spec.

  • Non-deterministic port ordering - iterating over sp.PortBindings map produces random ordering. Sort the keys first to ensure reproducible YAML output and stable tests.

  • StepIACMOpenTofuPlugin is missing CommonStepSpec embedding - StepIACMTerraformPlugin has it but StepIACMOpenTofuPlugin doesn't. Looks like an oversight since they're structurally identical otherwise.

Cleanup:

  • Missing Apache 2.0 license headers on convert_step_git_clone.go, convert_output_variables.go, and step_iacm.go
  • Mixed tabs and spaces in ConvertServiceDependencyToBackgroundStep, ConvertServiceDependenciesToBackgroundSteps, and ConvertSharedPaths - run gofmt
  • The comment // Convert size - map "flex" to "xlarge" as per your example in ConvertRuntime is misleading since the code does a direct pass-through
  • ConvertOutputVariables returns an empty slice [] instead of nil when there are no outputs, which will produce outputs: [] in YAML instead of omitting the field
  • Hardcoding shell: "sh" as default in ConvertStepBackground might not be ideal - consider leaving it empty so v1 uses its own default
  • Infrastructure, Runtime, and Volume only have UnmarshalJSON but no UnmarshalYAML - if pipeline inputs come as YAML (which they usually do), these won't deserialize correctly

Tests needed:

  • convert_step_background_test.go - cover nil input, minimal step (image only), full step with ports/reports/resources/shell/env/entrypoint, and edge cases like empty command, unknown shell values
  • convert_step_git_clone_test.go - cover nil input, branch build type, tag build type, PR build type, commitSha build type, nil build.Spec, and all optional fields (depth, sslVerify, cloneDirectory)
  • convert_output_variables_test.go - cover nil/empty input, single output, multiple outputs, output with Type: "Secret" (mask=true), output with value vs name fallback
  • convert_stage_ci_test.go - tests for ConvertRuntime (Cloud, Docker, unknown type), ConvertInfrastructureToRuntime (KubernetesDirect with full spec, VM with pool, nil infra), ConvertServiceDependencyToBackgroundStep, ConvertServiceDependenciesToBackgroundSteps, ConvertSharedPaths, ConvertInfrastructureToVolumes (all volume types: EmptyDir, PVC, HostPath, ConfigMap, Secret)
  • infrastructure_test.go / runtime_test.go - JSON unmarshalling tests for the new v0 types to make sure UnmarshalJSON dispatch works correctly for each type variant

Copy link
Copy Markdown
Member

@Ompragash Ompragash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging it for now with Harsh's approval.

@Ompragash Ompragash merged commit 826a386 into master Feb 16, 2026
1 check passed
@Ompragash
Copy link
Copy Markdown
Member

@peroxidemonke7 Let's ensure to address the quality gaps incrementally, as this repo is used for Jenkins migration-related tasks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants