Skip to content

Commit

Permalink
Fix uses: docker://image:tag steps when container hook is used (act…
Browse files Browse the repository at this point in the history
…ions#2626)

* Fix `uses: docker://image:tag` steps when container hook is used

* Update src/Runner.Worker/ActionManager.cs

---------

Co-authored-by: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com>
  • Loading branch information
nikola-jokic and fhammerl authored Jun 2, 2023
1 parent 50b3edf commit 3a1376f
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/Runner.Worker/ActionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,28 @@ public Definition LoadAction(IExecutionContext executionContext, Pipelines.Actio

if (action.Reference.Type == Pipelines.ActionSourceType.ContainerRegistry)
{
Trace.Info("Load action that reference container from registry.");
CachedActionContainers.TryGetValue(action.Id, out var container);
ArgUtil.NotNull(container, nameof(container));
definition.Data.Execution = new ContainerActionExecutionData()
if (FeatureManager.IsContainerHooksEnabled(executionContext.Global.Variables))
{
Image = container.ContainerImage
};
Trace.Info("Load action that will run container through container hooks.");
var containerAction = action.Reference as Pipelines.ContainerRegistryReference;
definition.Data.Execution = new ContainerActionExecutionData()
{
Image = containerAction.Image,
};
Trace.Info($"Using action container image: {containerAction.Image}.");
}
else
{
Trace.Info("Load action that reference container from registry.");
CachedActionContainers.TryGetValue(action.Id, out var container);
ArgUtil.NotNull(container, nameof(container));
definition.Data.Execution = new ContainerActionExecutionData()
{
Image = container.ContainerImage
};

Trace.Info($"Using action container image: {container.ContainerImage}.");
Trace.Info($"Using action container image: {container.ContainerImage}.");
}
}
else if (action.Reference.Type == Pipelines.ActionSourceType.Repository)
{
Expand Down

0 comments on commit 3a1376f

Please sign in to comment.