Merge pull request 'Fix panic in extractFromImageEnv
' (#81) from wolfogre/act:bugfix/panic_extractFromImageEnv into main
Reviewed-on: https://gitea.com/gitea/act/pulls/81 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
commit
15045b4fc0
1 changed files with 17 additions and 15 deletions
|
@ -16,29 +16,25 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/Masterminds/semver"
|
||||||
networktypes "github.com/docker/docker/api/types/network"
|
|
||||||
"github.com/gobwas/glob"
|
|
||||||
|
|
||||||
"github.com/go-git/go-billy/v5/helper/polyfill"
|
|
||||||
"github.com/go-git/go-billy/v5/osfs"
|
|
||||||
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
|
|
||||||
"github.com/joho/godotenv"
|
|
||||||
|
|
||||||
"github.com/imdario/mergo"
|
|
||||||
"github.com/kballard/go-shellquote"
|
|
||||||
"github.com/spf13/pflag"
|
|
||||||
|
|
||||||
"github.com/docker/cli/cli/compose/loader"
|
"github.com/docker/cli/cli/compose/loader"
|
||||||
"github.com/docker/cli/cli/connhelper"
|
"github.com/docker/cli/cli/connhelper"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/api/types/mount"
|
"github.com/docker/docker/api/types/mount"
|
||||||
|
"github.com/docker/docker/api/types/network"
|
||||||
|
networktypes "github.com/docker/docker/api/types/network"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
"github.com/docker/docker/pkg/stdcopy"
|
"github.com/docker/docker/pkg/stdcopy"
|
||||||
|
"github.com/go-git/go-billy/v5/helper/polyfill"
|
||||||
|
"github.com/go-git/go-billy/v5/osfs"
|
||||||
|
"github.com/go-git/go-git/v5/plumbing/format/gitignore"
|
||||||
|
"github.com/gobwas/glob"
|
||||||
|
"github.com/imdario/mergo"
|
||||||
|
"github.com/joho/godotenv"
|
||||||
|
"github.com/kballard/go-shellquote"
|
||||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
"github.com/spf13/pflag"
|
||||||
"github.com/Masterminds/semver"
|
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
|
|
||||||
"github.com/nektos/act/pkg/common"
|
"github.com/nektos/act/pkg/common"
|
||||||
|
@ -523,11 +519,17 @@ func (cr *containerReference) extractFromImageEnv(env *map[string]string) common
|
||||||
inspect, _, err := cr.cli.ImageInspectWithRaw(ctx, cr.input.Image)
|
inspect, _, err := cr.cli.ImageInspectWithRaw(ctx, cr.input.Image)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
|
return fmt.Errorf("inspect image: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if inspect.Config == nil {
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
imageEnv, err := godotenv.Unmarshal(strings.Join(inspect.Config.Env, "\n"))
|
imageEnv, err := godotenv.Unmarshal(strings.Join(inspect.Config.Env, "\n"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
|
return fmt.Errorf("unmarshal image env: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range imageEnv {
|
for k, v := range imageEnv {
|
||||||
|
|
Loading…
Reference in a new issue