mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-15 18:57:01 +00:00
Merge tag 'nektos/v0.2.46'
This commit is contained in:
commit
b6b329d4b5
9 changed files with 166 additions and 52 deletions
|
@ -549,8 +549,9 @@ func (rc *RunContext) startContainer() common.Executor {
|
|||
}
|
||||
|
||||
func (rc *RunContext) IsHostEnv(ctx context.Context) bool {
|
||||
image := rc.platformImage(ctx)
|
||||
return strings.EqualFold(image, "-self-hosted")
|
||||
platform := rc.runsOnImage(ctx)
|
||||
image := rc.containerImage(ctx)
|
||||
return image == "" && strings.EqualFold(platform, "-self-hosted")
|
||||
}
|
||||
|
||||
func (rc *RunContext) stopContainer() common.Executor {
|
||||
|
@ -603,7 +604,7 @@ func (rc *RunContext) Executor() common.Executor {
|
|||
}
|
||||
}
|
||||
|
||||
func (rc *RunContext) platformImage(ctx context.Context) string {
|
||||
func (rc *RunContext) containerImage(ctx context.Context) string {
|
||||
job := rc.Run.Job()
|
||||
|
||||
c := job.Container()
|
||||
|
@ -611,6 +612,12 @@ func (rc *RunContext) platformImage(ctx context.Context) string {
|
|||
return rc.ExprEval.Interpolate(ctx, c.Image)
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func (rc *RunContext) runsOnImage(ctx context.Context) string {
|
||||
job := rc.Run.Job()
|
||||
|
||||
if job.RunsOn() == nil {
|
||||
common.Logger(ctx).Errorf("'runs-on' key not defined in %s", rc.String())
|
||||
}
|
||||
|
@ -636,6 +643,14 @@ func (rc *RunContext) platformImage(ctx context.Context) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (rc *RunContext) platformImage(ctx context.Context) string {
|
||||
if containerImage := rc.containerImage(ctx); containerImage != "" {
|
||||
return containerImage
|
||||
}
|
||||
|
||||
return rc.runsOnImage(ctx)
|
||||
}
|
||||
|
||||
func (rc *RunContext) options(ctx context.Context) string {
|
||||
job := rc.Run.Job()
|
||||
c := job.Container()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue