Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
fa5f0c2
add v0 to v1 pipeline conversion
peroxidemonke7 Sep 24, 2025
9dbe0f0
add yaml package from https://github.com/bradrydzewski/spec for v1 st…
peroxidemonke7 Sep 24, 2025
69e8f78
add parallel step conversion
peroxidemonke7 Sep 24, 2025
7a60df1
add matrix conversion, modify v1 yaml file writing
peroxidemonke7 Sep 24, 2025
07a4261
add converion for helm and jira steps, modify Duration to handle pars…
peroxidemonke7 Sep 24, 2025
9cd8ee4
add conversion for wait step
peroxidemonke7 Sep 25, 2025
6647457
add flexible field generic type to handle harness expression. Update …
peroxidemonke7 Sep 26, 2025
bf90060
modify timeout conversion
peroxidemonke7 Sep 26, 2025
8c34abb
modify k8s step conversion
peroxidemonke7 Sep 26, 2025
d81268f
add service config conversion and const.go for v1
peroxidemonke7 Sep 29, 2025
ae4cef2
add notification rules conversion
peroxidemonke7 Sep 29, 2025
81253ee
remove version from step type, modify k8s and helm step conversion to…
peroxidemonke7 Oct 3, 2025
3541509
fix failure strategy conversion for error type AllErrors, modify step…
peroxidemonke7 Oct 3, 2025
faf20bd
modify notification conversion for case where pipelineEvents is set t…
peroxidemonke7 Oct 3, 2025
6e08403
refactor; add conversion for http, eamil and approval steps
peroxidemonke7 Nov 14, 2025
144bdc0
update v0tv1 README
peroxidemonke7 Nov 14, 2025
9bfc6fc
modify unit.go
peroxidemonke7 Nov 14, 2025
7eb4b02
remove v0 and v1 flexible fields
peroxidemonke7 Nov 14, 2025
1730d10
modify unit.go
peroxidemonke7 Nov 14, 2025
938de6b
fix downgrader issue
peroxidemonke7 Nov 17, 2025
93921c3
fix parse test
peroxidemonke7 Nov 17, 2025
a9a0924
fix delegate selector conversion in step
peroxidemonke7 Nov 18, 2025
15dc928
Update convert/harness/yaml/step.go
Ompragash Nov 20, 2025
bc96dbd
add error for unknown step unmarshalling, add field_test.go, fix temp…
peroxidemonke7 Nov 21, 2025
c0cae93
add conversion for CI steps, delegate selectors at pipeline level
peroxidemonke7 Dec 1, 2025
30d4069
modify conversion for CI stage: support clone, cache, build intellige…
peroxidemonke7 Dec 1, 2025
1ebdd92
Merge branch 'master' into v0tov1
peroxidemonke7 Dec 1, 2025
d29bad4
modify clone and cache conversion for CI stage.
peroxidemonke7 Dec 1, 2025
985a6ef
add conversion for service now create and update steps; modify criter…
peroxidemonke7 Dec 3, 2025
8abb792
modify notification conversion
peroxidemonke7 Dec 3, 2025
5b13c75
fix: handle nil source in approval step, fix buildArgs typo in docker…
peroxidemonke7 Dec 3, 2025
7246e87
fix field conversion for jira and servicenow steps
peroxidemonke7 Dec 10, 2025
da0c141
add conversion for conditional execution at stage and step level
peroxidemonke7 Dec 10, 2025
b7127bf
add unit tests for build and push steps, service now steps and notifi…
peroxidemonke7 Dec 10, 2025
a0a0470
conversion fixes, add converter for background and git clone step
peroxidemonke7 Dec 18, 2025
14980db
fix environment and failure strategy conversion
peroxidemonke7 Dec 18, 2025
b791497
conversion fixes; conversion for runtime and infra in CI stage; modif…
peroxidemonke7 Dec 19, 2025
1d7a6ba
modify repeat strategy conversion
peroxidemonke7 Dec 24, 2025
a9098bf
Merge branch 'master' into v0tov1
peroxidemonke7 Dec 24, 2025
86ce06b
modify output variable conversion, vm infra conversion
peroxidemonke7 Jan 2, 2026
dc205c9
fix clone codebase conversion
peroxidemonke7 Jan 7, 2026
c9aec57
revert clone codebase conversion in stage, create stage env vars from…
peroxidemonke7 Jan 8, 2026
92240f2
update stage input to stage env var conversion
peroxidemonke7 Jan 8, 2026
2c6e722
modify v1 clone codebase and matrix strategy conversion
peroxidemonke7 Jan 12, 2026
8a1ec4b
modify k8s runtime and volumes conversion
peroxidemonke7 Jan 13, 2026
b26ea52
modify clone codebase conversion.
peroxidemonke7 Jan 13, 2026
b9543ab
modify CD steps conversion, add support for pipeline chaining
peroxidemonke7 Jan 28, 2026
7de0978
add maifest path k8s Apply and Delete step conversion
peroxidemonke7 Jan 28, 2026
7cb19ff
field type fixes
peroxidemonke7 Feb 9, 2026
b25d597
modify Cache and build Intelligence conversion
peroxidemonke7 Feb 9, 2026
1a0be3d
modify save and restore cache gcs step conversion
peroxidemonke7 Feb 9, 2026
ec0b198
modify clone ref conversion and add conversion for iacm stage and steps
peroxidemonke7 Feb 11, 2026
812641d
modify environment, service and step fields
peroxidemonke7 Feb 16, 2026
988410b
conversion fixes, add converter for bitrise step, modify github actio…
peroxidemonke7 Feb 20, 2026
37db6c1
add UTs
peroxidemonke7 Feb 20, 2026
0cd0167
Merge branch 'master' into v0tov1
peroxidemonke7 Feb 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions convert/harness/downgrader/downgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,10 @@ func (d *Downgrader) convertStepBackground(src *v1.Step) *v0.Step {
if len(spec_.Envs) > 0 {
env = &flexible.Field[map[string]interface{}]{Value: spec_.Envs}
}
var runAsUser *flexible.Field[int]
if spec_.User != "" {
runAsUser.SetString(spec_.User)
}
return &v0.Step{
ID: id,
Name: convertName(src.Name),
Expand All @@ -748,7 +752,7 @@ func (d *Downgrader) convertStepBackground(src *v1.Step) *v0.Step {
Image: spec_.Image,
ImagePullPolicy: convertImagePull(spec_.Pull),
Privileged: privileged,
RunAsUser: spec_.User,
RunAsUser: runAsUser,
PortBindings: convertPorts(spec_.Ports),
},
When: convertStepWhen(src.When, id),
Expand Down Expand Up @@ -782,6 +786,10 @@ func (d *Downgrader) convertStepPlugin(src *v1.Step) *v0.Step {
if spec_.Privileged {
privileged = &flexible.Field[bool]{Value: true}
}
var runAsUser *flexible.Field[int]
if spec_.User != "" {
runAsUser.SetString(spec_.User)
}

switch spec_.Image {
case harness.GitPluginImage:
Expand Down Expand Up @@ -830,7 +838,7 @@ func (d *Downgrader) convertStepPlugin(src *v1.Step) *v0.Step {
ImagePullPolicy: convertImagePull(spec_.Pull),
Settings: convertSettings(spec_.With),
Privileged: privileged,
RunAsUser: spec_.User,
RunAsUser: runAsUser,
},
When: convertStepWhen(src.When, id),
}
Expand Down Expand Up @@ -1032,7 +1040,7 @@ func convertCache(src *v1.Cache) *v0.Cache {
return nil
}
return &v0.Cache{
Enabled: src.Enabled,
Enabled: &flexible.Field[bool]{Value: src.Enabled},
Key: src.Key,
Paths: src.Paths,
}
Expand Down
2 changes: 1 addition & 1 deletion convert/harness/yaml/failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
FailureTypeTimeout FailureType = "Timeout"
FailureTypeUnknown FailureType = "Unknown"
FailureTypeVerification FailureType = "Verification"
FailureTypeUserMarkFail FailureType = "UserMarkFail"
FailureTypeUserMarkFail FailureType = "UserMarkedFailure"
)

type ActionType string
Expand Down
4 changes: 2 additions & 2 deletions convert/harness/yaml/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ type (

// Cache defines the cache settings.
Cache struct {
Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
Enabled *flexible.Field[bool] `json:"enabled,omitempty" yaml:"enabled,omitempty"`
Key string `json:"key,omitempty" yaml:"key,omitempty"`
Paths []string `json:"paths,omitempty" yaml:"paths,omitempty"`
Policy string `json:"policy,omitempty" yaml:"policy,omitempty"`
Override bool `json:"override,omitempty" yaml:"override,omitempty"`
Override *flexible.Field[bool] `json:"override,omitempty" yaml:"override,omitempty"`
}

// Codebase defines a codebase.
Expand Down
16 changes: 9 additions & 7 deletions convert/harness/yaml/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ type (
ImagePullPolicy string `json:"imagePullPolicy,omitempty" yaml:"imagePullPolicy,omitempty"`
IntelligenceMode *flexible.Field[bool] `json:"intelligenceMode,omitempty" yaml:"intelligenceMode,omitempty"`
Globs []string `json:"globs,omitempty" yaml:"globs,omitempty"`
RunAsUser string `json:"runAsUser,omitempty" yaml:"runAsUser,omitempty"`
RunAsUser *flexible.Field[int] `json:"runAsUser,omitempty" yaml:"runAsUser,omitempty"`
Resources *Resources `json:"resources,omitempty" yaml:"resources,omitempty"`
}

Expand Down Expand Up @@ -341,23 +341,23 @@ type (
Privileged *flexible.Field[bool] `json:"privileged,omitempty" yaml:"privileged,omitempty"`
Reports *Report `json:"reports,omitempty" yaml:"reports,omitempty"`
Resources *Resources `json:"resources,omitempty" yaml:"resources,omitempty"`
RunAsUser string `json:"runAsUser,omitempty" yaml:"runAsUser,omitempty"`
RunAsUser *flexible.Field[int] `json:"runAsUser,omitempty" yaml:"runAsUser,omitempty"`
Settings map[string]interface{} `json:"settings,omitempty" yaml:"settings,omitempty"`
Entrypoint *flexible.Field[[]string] `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"`
}

StepGitClone struct {
CommonStepSpec
Repository string `json:"repoName,omitempty" yaml:"repoNama,omitempty"`
Repository string `json:"repoName,omitempty" yaml:"repoName,omitempty"`
ConnRef string `json:"connectorRef,omitempty" yaml:"connectorRef,omitempty"`
BuildType *flexible.Field[Build] `json:"build,omitempty" yaml:"build,omitempty"`
CloneDirectory string `json:"cloneDirectory,omitempty" yaml:"cloneDirectory,omitempty"`
Privileged *flexible.Field[bool] `json:"privileged,omitempty" yaml:"privileged,omitempty"`
Depth *flexible.Field[int] `json:"depth,omitempty" yaml:"cloneDirectory,omitempty"`
Depth *flexible.Field[int] `json:"depth,omitempty" yaml:"depth,omitempty"`
Resources *Resources `json:"resources,omitempty" yaml:"resources,omitempty"`
SSLVerify string `json:"sslVerify,omitempty" yaml:"cloneDirectory,omitempty"`
SSLVerify string `json:"sslVerify,omitempty" yaml:"sslVerify,omitempty"`
RunAsUser string `json:"runAsUser,omitempty" yaml:"runAsUser,omitempty"`
Timeout string `json:"timeout,omitempty" yaml:"cloneDirectory,omitempty"`
Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
}

StepAction struct {
Expand Down Expand Up @@ -406,7 +406,7 @@ type (
PortBindings map[string]string `json:"portBindings,omitempty" yaml:"portBindings,omitempty"`
Privileged *flexible.Field[bool] `json:"privileged,omitempty" yaml:"privileged,omitempty"`
Resources *Resources `json:"resources,omitempty" yaml:"resources,omitempty"`
RunAsUser string `json:"runAsUser,omitempty" yaml:"runAsUser,omitempty"`
RunAsUser *flexible.Field[int] `json:"runAsUser,omitempty" yaml:"runAsUser,omitempty" v1path:"-"`
Reports *Report `json:"reports,omitempty" yaml:"reports,omitempty"`
Shell string `json:"shell,omitempty" yaml:"shell,omitempty"`
}
Expand Down Expand Up @@ -698,6 +698,8 @@ func (s *Step) UnmarshalJSON(data []byte) error {
s.Spec = new(StepIACMTerraformPlugin)
case StepTypeIACMOpenTofuPlugin:
s.Spec = new(StepIACMOpenTofuPlugin)
case StepTypeBitrise:
s.Spec = new(StepBitrise)
default:
// log.Printf("unknown step type while unmarshalling %s", s.Type)
return fmt.Errorf("unknown step type %s", s.Type)
Expand Down
1 change: 1 addition & 0 deletions convert/harness/yaml/step_iacm.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type (
}

StepIACMOpenTofuPlugin struct {
CommonStepSpec
Command string `json:"command,omitempty" yaml:"command,omitempty"`
Target *flexible.Field[[]string] `json:"target,omitempty" yaml:"target,omitempty"`
Replace *flexible.Field[[]string] `json:"replace,omitempty" yaml:"replace,omitempty"`
Expand Down
111 changes: 111 additions & 0 deletions convert/v0tov1/convert_helpers/convert_output_variables_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
package converthelpers

import (
"testing"

v0 "github.com/drone/go-convert/convert/harness/yaml"
v1 "github.com/drone/go-convert/convert/v0tov1/yaml"
"github.com/google/go-cmp/cmp"
)

func TestConvertOutputVariables(t *testing.T) {
tests := []struct {
name string
input []*v0.Output
expected []*v1.Output
}{
{
name: "nil input",
input: nil,
expected: []*v1.Output{},
},
{
name: "empty input",
input: []*v0.Output{},
expected: []*v1.Output{},
},
{
name: "single output with value",
input: []*v0.Output{
{Name: "MY_VAR", Value: "output_value"},
},
expected: []*v1.Output{
{Alias: "MY_VAR", Name: "output_value", Mask: false},
},
},
{
name: "single output name fallback when value is empty",
input: []*v0.Output{
{Name: "MY_VAR", Value: ""},
},
expected: []*v1.Output{
{Alias: "MY_VAR", Name: "MY_VAR", Mask: false},
},
},
{
name: "multiple outputs",
input: []*v0.Output{
{Name: "VAR_A", Value: "val_a"},
{Name: "VAR_B", Value: "val_b"},
{Name: "VAR_C", Value: "val_c"},
},
expected: []*v1.Output{
{Alias: "VAR_A", Name: "val_a", Mask: false},
{Alias: "VAR_B", Name: "val_b", Mask: false},
{Alias: "VAR_C", Name: "val_c", Mask: false},
},
},
{
name: "output with Type Secret sets mask true",
input: []*v0.Output{
{Name: "SECRET_VAR", Value: "secret_val", Type: "Secret"},
},
expected: []*v1.Output{
{Alias: "SECRET_VAR", Name: "secret_val", Mask: true},
},
},
{
name: "output with non-Secret type sets mask false",
input: []*v0.Output{
{Name: "NORMAL_VAR", Value: "normal_val", Type: "String"},
},
expected: []*v1.Output{
{Alias: "NORMAL_VAR", Name: "normal_val", Mask: false},
},
},
{
name: "nil entries in slice are skipped",
input: []*v0.Output{
{Name: "VAR_A", Value: "val_a"},
nil,
{Name: "VAR_C", Value: "val_c"},
},
expected: []*v1.Output{
{Alias: "VAR_A", Name: "val_a", Mask: false},
{Alias: "VAR_C", Name: "val_c", Mask: false},
},
},
{
name: "mixed secret and non-secret outputs",
input: []*v0.Output{
{Name: "PUBLIC", Value: "pub_val", Type: "String"},
{Name: "PRIVATE", Value: "priv_val", Type: "Secret"},
{Name: "FALLBACK", Value: ""},
},
expected: []*v1.Output{
{Alias: "PUBLIC", Name: "pub_val", Mask: false},
{Alias: "PRIVATE", Name: "priv_val", Mask: true},
{Alias: "FALLBACK", Name: "FALLBACK", Mask: false},
},
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := ConvertOutputVariables(tt.input)
if diff := cmp.Diff(tt.expected, result); diff != "" {
t.Errorf("mismatch (-want +got):\n%s", diff)
}
})
}
}
Loading