You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO(PEP003): It would be great when we configure this strategy that we also do host, so that host secret resolution isn't deferred to the plugins
31
34
// i.e. we can configure a secret strategy and still be able to resolve directly in porter any host values.
32
35
ifkeyName!="porter" {
33
-
return"", fmt.Errorf("attempted to resolve secrets of type %s from the porter strategy", keyName)
36
+
return"", span.Errorf("attempted to resolve secrets of type %s from the porter strategy", keyName)
34
37
}
35
38
36
39
wiring, err:=v2.ParseWorkflowWiring(keyValue)
37
40
iferr!=nil {
38
-
return"", fmt.Errorf("invalid workflow wiring was passed to the porter strategy, %s", keyValue)
41
+
return"", span.Errorf("invalid workflow wiring was passed to the porter strategy, %s", keyValue)
39
42
}
40
43
44
+
// We support retrieving certain data from Porter's database:
45
+
// workflow.WORKFLOWID.jobs.JOBKEY.outputs.OUTPUT
46
+
// The WORKFLOWID is set to the current executing workflow by the workflow engine before running the job
47
+
// It is not stored in the database and is always set dynamically when the job is run.
48
+
41
49
// TODO(PEP003): How do we want to re-resolve credentials passed to the root bundle? They aren't recorded so it's not a simple lookup
42
50
ifwiring.Parameter!="" {
43
51
// TODO(PEP003): Resolve a parameter from another job that has not run yet
52
+
// IS THIS ACTUALLY A PROBLEM? We pass creds/params from the root job, which we need to deal with, but otherwise we only pass outputs from non-root jobs
44
53
// 1. Find the workflow definition from the db (need a way to track "current" workflow)
45
54
// 2. Grab the job based on the jobid in the workflow wiring
46
55
// 3. First check the parameters field for the param, resolve just that if available, otherwise resolve parameter sets and get it from there
47
56
// it sure would help if we remembered what params are in each set
57
+
58
+
return"", nil
48
59
} elseifwiring.Output!="" {
49
60
// TODO(PEP003): Resolve the output from an already executed job
61
+
62
+
// Lookup the result and run associated with the job run in that workflow
// TODO(PEP003): Move a lot of these values into the span attributes instead of in the error message
92
+
return"", span.Errorf("error retrieving output %s from result %s for job %s in workflow %s: %w", wiring.Output, j.Status.LastResultID, wiring.JobKey, wiring.WorkflowID)
93
+
}
94
+
95
+
iflen(outputs) ==0 {
96
+
return"", span.Errorf("no output named %s, found for result %s for job %s in workflow %s", wiring.Output, j.Status.LastResultID, wiring.JobKey, wiring.WorkflowID)
return"", span.Errorf("error restoring output named %s, found for result %s for job %s in workflow %s", wiring.Output, j.Status.LastResultID, wiring.JobKey, wiring.WorkflowID)
returnerrors.New("The porter secrets plugin does not support the create function, because it is for internal use within Porter only. Chek your porter configuration file and make sure that you are using a supported secrets plugin and not the porter secrets plugin directly.")
0 commit comments