in schema/v1/reference.go [84:144]
func (r *Reference) compileOCI(stepName string, inputs map[string]*structpb.Value, env map[string]string) (*proto.Step_Reference, error) {
tag := r.OCI.Tag
if tag == "" {
tag = "latest"
}
dir := ""
if r.OCI.Dir != nil {
dir = *r.OCI.Dir
}
filename := "step.yml"
if r.OCI.File != nil {
filename = *r.OCI.File
}
fetchStepName := "fetch_step_" + stepName
stepRef := &proto.Step_Reference{
Protocol: proto.StepReferenceProtocol_spec_def,
SpecDef: &proto.SpecDefinition{
Spec: &proto.Spec{
Spec: &proto.Spec_Content{
OutputMethod: proto.OutputMethod_delegate,
}},
Definition: &proto.Definition{
Type: proto.DefinitionType_steps,
Steps: []*proto.Step{
{
Name: fetchStepName,
Step: &proto.Step_Reference{
Protocol: proto.StepReferenceProtocol_dist,
Path: []string{"oci", "fetch"},
Filename: "step.yml",
},
Inputs: map[string]*structpb.Value{ // inline the inputs
"registry": structpb.NewStringValue(r.OCI.Registry),
"repository": structpb.NewStringValue(r.OCI.Repository),
"tag": structpb.NewStringValue(tag),
"step_path": structpb.NewStringValue(dir),
},
Env: env,
},
{
Name: stepName,
Step: &proto.Step_Reference{
Protocol: proto.StepReferenceProtocol_local,
StepPath: &proto.Step_Reference_PathExp{PathExp: fmt.Sprintf("${{steps.%s.outputs.fetched_step_path}}", fetchStepName)},
Filename: filename,
},
Inputs: inputs,
Env: env,
},
},
Delegate: stepName,
},
},
}
return stepRef, nil
}