Composite action (#608)
* Refactor maybeCopyToActionDir * Use maybeCopyToActionDir for model.ActionRunsUsingComposite
This commit is contained in:
parent
cec63488f3
commit
020d6a6083
2 changed files with 19 additions and 11 deletions
3
pkg/runner/runner_test.go
Executable file → Normal file
3
pkg/runner/runner_test.go
Executable file → Normal file
|
@ -96,13 +96,12 @@ func TestRunEvent(t *testing.T) {
|
|||
{"testdata", "workdir", "push", "", platforms, ""},
|
||||
{"testdata", "defaults-run", "push", "", platforms, ""},
|
||||
{"testdata", "uses-composite", "push", "", platforms, ""},
|
||||
{"testdata", "issue-597", "push", "", platforms, ""},
|
||||
{"testdata", "issue-597", "push", "", platforms, ""},
|
||||
// {"testdata", "powershell", "push", "", platforms, ""}, // Powershell is not available on default act test runner (yet) but preserving here for posterity
|
||||
// {"testdata", "issue-228", "push", "", platforms, ""}, // TODO [igni]: Remove this once everything passes
|
||||
|
||||
// single test for different architecture: linux/arm64
|
||||
{"testdata", "basic", "push", "", platforms, "linux/arm64"},
|
||||
|
||||
}
|
||||
log.SetLevel(log.DebugLevel)
|
||||
|
||||
|
|
|
@ -408,17 +408,22 @@ func (sc *StepContext) runAction(actionDir string, actionPath string) common.Exe
|
|||
|
||||
log.Debugf("type=%v actionDir=%s actionPath=%s Workdir=%s ActionCacheDir=%s actionName=%s containerActionDir=%s", step.Type(), actionDir, actionPath, rc.Config.Workdir, rc.ActionCacheDir(), actionName, containerActionDir)
|
||||
|
||||
maybeCopyToActionDir := func() error {
|
||||
if step.Type() != model.StepTypeUsesActionRemote {
|
||||
return nil
|
||||
}
|
||||
err := removeGitIgnore(actionDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return rc.JobContainer.CopyDir(containerActionDir+"/", actionDir, rc.Config.UseGitIgnore)(ctx)
|
||||
}
|
||||
|
||||
switch action.Runs.Using {
|
||||
case model.ActionRunsUsingNode12:
|
||||
if step.Type() == model.StepTypeUsesActionRemote {
|
||||
err := removeGitIgnore(actionDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = rc.JobContainer.CopyDir(containerActionDir+"/", actionDir, rc.Config.UseGitIgnore)(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err := maybeCopyToActionDir()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
containerArgs := []string{"node", path.Join(containerActionDir, actionName, actionPath, action.Runs.Main)}
|
||||
log.Debugf("executing remote job container: %s", containerArgs)
|
||||
|
@ -488,6 +493,10 @@ func (sc *StepContext) runAction(actionDir string, actionPath string) common.Exe
|
|||
stepContainer.Remove().IfBool(!rc.Config.ReuseContainers),
|
||||
)(ctx)
|
||||
case model.ActionRunsUsingComposite:
|
||||
err := maybeCopyToActionDir()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for outputName, output := range action.Outputs {
|
||||
re := regexp.MustCompile(`\${{ steps\.([a-zA-Z_][a-zA-Z0-9_-]+)\.outputs\.([a-zA-Z_][a-zA-Z0-9_-]+) }}`)
|
||||
matches := re.FindStringSubmatch(output.Value)
|
||||
|
|
Loading…
Reference in a new issue