25
25
using Synapse . Infrastructure . Services ;
26
26
using Synapse . Runtime . Docker ;
27
27
using Synapse . Runtime . Docker . Configuration ;
28
+ using System . Reactive . Linq ;
28
29
29
30
namespace Synapse . Runtime . Services
30
31
{
@@ -145,9 +146,13 @@ public override async Task<IWorkflowProcess> CreateProcessAsync(V1Workflow workf
145
146
/// <returns>A new awaitable <see cref="Task"/></returns>
146
147
protected virtual async Task PullWorkerImageAsync ( CancellationToken cancellationToken )
147
148
{
149
+ var image = this . Options . Runtime . Container . Image ;
150
+ var tagIndex = image . IndexOf ( ':' ) ;
151
+ var tag = "latest" ;
152
+ if ( tagIndex >= 1 ) tag = image . Substring ( tagIndex + 1 ) ;
148
153
if ( this . Options . Runtime . ImagePullPolicy == ImagePullPolicy . Always )
149
154
{
150
- await this . Docker . Images . CreateImageAsync ( new ( ) { FromImage = this . Options . Runtime . Container . Image , Repo = this . Options . Runtime . ImageRepository } , new ( ) , new Progress < JSONMessage > ( ) , cancellationToken ) ;
155
+ await this . Docker . Images . CreateImageAsync ( new ( ) { FromImage = this . Options . Runtime . Container . Image , Tag = tag , Repo = this . Options . Runtime . ImageRepository } , new ( ) , new Progress < JSONMessage > ( ) , cancellationToken ) ;
151
156
}
152
157
else
153
158
{
@@ -157,7 +162,7 @@ protected virtual async Task PullWorkerImageAsync(CancellationToken cancellation
157
162
}
158
163
catch ( DockerImageNotFoundException )
159
164
{
160
- await this . Docker . Images . CreateImageAsync ( new ( ) { FromImage = this . Options . Runtime . Container . Image , Repo = this . Options . Runtime . ImageRepository } , new ( ) , new Progress < JSONMessage > ( ) , cancellationToken ) ;
165
+ await this . Docker . Images . CreateImageAsync ( new ( ) { FromImage = this . Options . Runtime . Container . Image , Tag = tag , Repo = this . Options . Runtime . ImageRepository } , new ( ) , new Progress < JSONMessage > ( ) , cancellationToken ) ;
161
166
}
162
167
}
163
168
}
0 commit comments