Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Propagating environment variables through launchplans #576

Merged
merged 2 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 9 additions & 8 deletions pkg/controller/nodes/subworkflow/launchplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ func (l *launchPlanHandler) StartLaunchPlan(ctx context.Context, nCtx handler.No
}

launchCtx := launchplan.LaunchContext{
ParentNodeExecution: parentNodeExecutionID,
MaxParallelism: nCtx.ExecutionContext().GetExecutionConfig().MaxParallelism,
SecurityContext: nCtx.ExecutionContext().GetSecurityContext(),
RawOutputDataConfig: nCtx.ExecutionContext().GetRawOutputDataConfig().RawOutputDataConfig,
Labels: nCtx.ExecutionContext().GetLabels(),
Annotations: nCtx.ExecutionContext().GetAnnotations(),
Interruptible: nCtx.ExecutionContext().GetExecutionConfig().Interruptible,
OverwriteCache: nCtx.ExecutionContext().GetExecutionConfig().OverwriteCache,
ParentNodeExecution: parentNodeExecutionID,
MaxParallelism: nCtx.ExecutionContext().GetExecutionConfig().MaxParallelism,
SecurityContext: nCtx.ExecutionContext().GetSecurityContext(),
RawOutputDataConfig: nCtx.ExecutionContext().GetRawOutputDataConfig().RawOutputDataConfig,
Labels: nCtx.ExecutionContext().GetLabels(),
Annotations: nCtx.ExecutionContext().GetAnnotations(),
Interruptible: nCtx.ExecutionContext().GetExecutionConfig().Interruptible,
OverwriteCache: nCtx.ExecutionContext().GetExecutionConfig().OverwriteCache,
EnvironmentVariables: nCtx.ExecutionContext().GetExecutionConfig().EnvironmentVariables,
}

if nCtx.ExecutionContext().GetExecutionConfig().RecoveryExecution.WorkflowExecutionIdentifier != nil {
Expand Down
9 changes: 9 additions & 0 deletions pkg/controller/nodes/subworkflow/launchplan/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ func (a *adminLaunchPlanExecutor) Launch(ctx context.Context, launchCtx LaunchCo
}
}

environmentVariables := make([]*core.KeyValuePair, 0, len(launchCtx.EnvironmentVariables))
for k, v := range launchCtx.EnvironmentVariables {
environmentVariables = append(environmentVariables, &core.KeyValuePair{
Key: k,
Value: v,
})
}

req := &admin.ExecutionCreateRequest{
Project: executionID.Project,
Domain: executionID.Domain,
Expand All @@ -122,6 +130,7 @@ func (a *adminLaunchPlanExecutor) Launch(ctx context.Context, launchCtx LaunchCo
RawOutputDataConfig: launchCtx.RawOutputDataConfig,
Interruptible: interruptible,
OverwriteCache: launchCtx.OverwriteCache,
Envs: &admin.Envs{Values: environmentVariables},
},
}

Expand Down
11 changes: 6 additions & 5 deletions pkg/controller/nodes/subworkflow/launchplan/launchplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ type LaunchContext struct {
// MaxParallelism
MaxParallelism uint32
// RawOutputDataConfig
RawOutputDataConfig *admin.RawOutputDataConfig
Annotations map[string]string
Labels map[string]string
Interruptible *bool
OverwriteCache bool
RawOutputDataConfig *admin.RawOutputDataConfig
Annotations map[string]string
Labels map[string]string
Interruptible *bool
OverwriteCache bool
EnvironmentVariables map[string]string
}

// Executor interface to be implemented by the remote system that can allow workflow launching capabilities
Expand Down