Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Mark resource & data template report-outputs-completed: "true" #12544

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
27 changes: 23 additions & 4 deletions cmd/argoexec/commands/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,37 @@ package commands
import (
"context"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

func NewDataCommand() *cobra.Command {
command := cobra.Command{
Use: "data",
Short: "Process data",
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()
wfExecutor := initExecutor()
return wfExecutor.Data(ctx)
Run: func(cmd *cobra.Command, args []string) {
ctx := cmd.Context()
agilgur5 marked this conversation as resolved.
Show resolved Hide resolved
err := execData(ctx)
if err != nil {
log.Fatalf("%+v", err)
}
},
}
return &command
}

func execData(ctx context.Context) error {
wfExecutor := initExecutor()
defer wfExecutor.HandleError(ctx)
agilgur5 marked this conversation as resolved.
Show resolved Hide resolved

// Create a new empty (placeholder) task result with LabelKeyReportOutputsCompleted set to false.
wfExecutor.InitializeOutput(ctx)
defer wfExecutor.FinalizeOutput(ctx) //Ensures the LabelKeyReportOutputsCompleted is set to true.
shuangkun marked this conversation as resolved.
Show resolved Hide resolved

err := wfExecutor.Data(ctx)
if err != nil {
wfExecutor.AddError(err)
return err
}
return nil
}
2 changes: 2 additions & 0 deletions cmd/argoexec/commands/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ func NewResourceCommand() *cobra.Command {
func execResource(ctx context.Context, action string) error {
wfExecutor := initExecutor()
defer wfExecutor.HandleError(ctx)
defer wfExecutor.FinalizeOutput(ctx) //Ensures the LabelKeyReportOutputsCompleted is set to true.
shuangkun marked this conversation as resolved.
Show resolved Hide resolved
err := wfExecutor.StageFiles()
if err != nil {
wfExecutor.AddError(err)
return err
}

isDelete := action == "delete"
if isDelete && (wfExecutor.Template.Resource.SuccessCondition != "" || wfExecutor.Template.Resource.FailureCondition != "" || len(wfExecutor.Template.Outputs.Parameters) > 0) {
err = fmt.Errorf("successCondition, failureCondition and outputs are not supported for delete action")
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,9 @@ func (s *FunctionalSuite) TestDataTransformation() {
}
assert.NotNil(t, status.Nodes.FindByDisplayName("process-artifact(0:foo/script.py)"))
assert.NotNil(t, status.Nodes.FindByDisplayName("process-artifact(1:script.py)"))
for _, value := range status.TaskResultsCompletionStatus {
assert.True(t, value)
}
})
}

Expand Down
3 changes: 3 additions & 0 deletions test/e2e/resource_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ func (s *ResourceTemplateSuite) TestResourceTemplateWithOutputs() {
assert.Equal(t, "my-pod", parameters[1].Value.String(), "metadata.name is capture for jq")
}
}
for _, value := range status.TaskResultsCompletionStatus {
assert.True(t, value)
}
})
}

Expand Down