@@ -80,13 +80,13 @@ Task("DownloadGitHubReleaseArtifacts")
80
80
// Have had missing artifacts before, lets fail early in that scenario
81
81
if ( ! artifactLookup . ContainsKey ( "NuGetRefBuild" ) ) { throw new Exception ( "NuGetRefBuild artifact missing" ) ; }
82
82
if ( ! artifactLookup . ContainsKey ( "NuGetCommandLineBuild" ) ) { throw new Exception ( "NuGetCommandLineBuild artifact missing" ) ; }
83
- if ( ! artifactLookup . ContainsKey ( "NuGetExeDotNetCoreBuild" ) ) { throw new Exception ( "NuGetExeDotNetCoreBuild artifact missing" ) ; }
83
+ if ( ! artifactLookup . ContainsKey ( "NuGetExeDotNetCoreBuild" ) ) { throw new Exception ( "NuGetExeDotNetCoreBuild artifact missing" ) ; }
84
84
if ( ! artifactLookup . ContainsKey ( "NuGetTaskBuild" ) ) { throw new Exception ( "NuGetTaskBuild artifact missing" ) ; }
85
85
if ( ! artifactLookup . ContainsKey ( "NuGetExeBuild" ) ) { throw new Exception ( "NuGetExeBuild artifact missing" ) ; }
86
86
if ( ! artifactLookup . ContainsKey ( "GemBuild" ) ) { throw new Exception ( "GemBuild artifact missing" ) ; }
87
87
if ( ! artifactLookup . ContainsKey ( "GitVersionTfsTaskBuild" ) ) { throw new Exception ( "GitVersionTfsTaskBuild artifact missing" ) ; }
88
88
if ( ! artifactLookup . ContainsKey ( "zip" ) ) { throw new Exception ( "zip artifact missing" ) ; }
89
- if ( ! artifactLookup . ContainsKey ( "zip-dotnetcore" ) ) { throw new Exception ( "zip-dotnetcore artifact missing" ) ; }
89
+ if ( ! artifactLookup . ContainsKey ( "zip-dotnetcore" ) ) { throw new Exception ( "zip-dotnetcore artifact missing" ) ; }
90
90
} ) ;
91
91
92
92
Task ( "Publish-NuGetPackage" )
@@ -206,42 +206,42 @@ Task("Publish-VstsTask")
206
206
}
207
207
} ) ;
208
208
209
- // PublishDocker("gittools/gitversion", tag, "content.zip", "/some/path/DockerFile");
209
+ // PublishDocker("gittools/gitversion", tag, "content.zip", "/some/path/DockerFile");
210
210
bool PublishDocker ( string name , tagName , contentZip , dockerFilePath , containerVolume )
211
211
{
212
212
Information ( "Starting Docker Build for Image: " + name ) ;
213
213
214
214
var username = EnvironmentVariable ( "DOCKER_USERNAME" ) ;
215
215
var password = EnvironmentVariable ( "DOCKER_PASSWORD" ) ;
216
216
217
- if ( string . IsNullOrEmpty ( username ) || string . IsNullOrEmpty ( password ) )
217
+ if ( string . IsNullOrEmpty ( username ) || string . IsNullOrEmpty ( password ) )
218
218
{
219
219
Warning ( "Skipping docker publish due to missing credentials" ) ;
220
220
return false ;
221
221
}
222
222
223
- // copy the docker file to a build directory, along with the contents of the specified content.zip.
224
- // This directory should then contain all we need for the docker build.
225
- var dockerBuildFolder = "./build/Docker/" ;
226
- CreateDirectory ( dockerBuildFolder ) ;
223
+ // copy the docker file to a build directory, along with the contents of the specified content.zip.
224
+ // This directory should then contain all we need for the docker build.
225
+ var dockerBuildFolder = "./build/Docker/" ;
226
+ CreateDirectory ( dockerBuildFolder ) ;
227
227
228
- //var folderName = name.Replace("/", "-");
229
- var dockerFileBuildFolder = dockerBuildFolder + name ;
230
- CreateDirectory ( dockerFileBuildFolder ) ;
231
-
232
- Information ( "Copying docker file to " + dockerFileBuildFolder ) ;
233
- CopyFiles ( dockerFilePath , dockerFileBuildFolder ) ;
228
+ //var folderName = name.Replace("/", "-");
229
+ var dockerFileBuildFolder = dockerBuildFolder + name ;
230
+ CreateDirectory ( dockerFileBuildFolder ) ;
234
231
235
- var contentPath = "/content" ;
236
- var contentFolder = dockerFileBuildFolder + contentPath ;
232
+ Information ( "Copying docker file to " + dockerFileBuildFolder ) ;
233
+ CopyFiles ( dockerFilePath , dockerFileBuildFolder ) ;
237
234
238
- Information ( "Extracting docker image content to " + contentFolder ) ;
239
- Unzip ( contentZip , contentFolder ) ;
235
+ var contentPath = "/content" ;
236
+ var contentFolder = dockerFileBuildFolder + contentPath ;
240
237
241
- var dockerFilePathForBuild = dockerFileBuildFolder + "/DockerFile" ;
242
- Information ( "Beginning Docker Build command for " + dockerFilePathForBuild ) ;
238
+ Information ( "Extracting docker image content to " + contentFolder ) ;
239
+ Unzip ( contentZip , contentFolder ) ;
243
240
244
- var returnCode = StartProcess ( "docker" , new ProcessSettings
241
+ var dockerFilePathForBuild = dockerFileBuildFolder + "/DockerFile" ;
242
+ Information ( "Beginning Docker Build command for " + dockerFilePathForBuild ) ;
243
+
244
+ var returnCode = StartProcess ( "docker" , new ProcessSettings
245
245
{
246
246
Arguments = "build -f " + dockerFilePathForBuild + " " + dockerFileBuildFolder + " --build-arg contentFolder=" + contentPath + " --tag " + name + ":" + tagName
247
247
} ) ;
@@ -292,7 +292,7 @@ bool PublishDocker(string name, tagName, contentZip, dockerFilePath, containerVo
292
292
} ) ;
293
293
if ( returnCode != 0 ) {
294
294
Information ( "Publish-DockerImage Task failed latest tag, but continuing with next Task..." ) ;
295
- publishingError = true ;
295
+ publishingError = true ;
296
296
}
297
297
298
298
returnCode = StartProcess ( "docker" , new ProcessSettings
@@ -302,17 +302,17 @@ bool PublishDocker(string name, tagName, contentZip, dockerFilePath, containerVo
302
302
if ( returnCode != 0 ) {
303
303
Information ( "Publish-DockerImage Task failed latest tag, but continuing with next Task..." ) ;
304
304
publishingError = true ;
305
- return false ;
305
+ return false ;
306
306
}
307
307
308
308
}
309
309
310
310
Task ( "Publish-DockerImage" )
311
311
. IsDependentOn ( "DownloadGitHubReleaseArtifacts" )
312
312
. Does ( ( ) =>
313
- {
314
- PublishDocker ( "gittools/gitversion" , tag , artifactLookup [ "zip" ] , "src/Docker/Mono/DockerFile" , "/repo" ) ;
315
- PublishDocker ( "gittools/gitversion-dotnetcore" , tag , artifactLookup [ "zip-dotnetcore" ] , "src/Docker/DotNetCore/DockerFile" , "c:/repo" ) ;
313
+ {
314
+ PublishDocker ( "gittools/gitversion" , tag , artifactLookup [ "zip" ] , "src/Docker/Mono/DockerFile" , "/repo" ) ;
315
+ PublishDocker ( "gittools/gitversion-dotnetcore" , tag , artifactLookup [ "zip-dotnetcore" ] , "src/Docker/DotNetCore/DockerFile" , "c:/repo" ) ;
316
316
} ) ;
317
317
318
318
@@ -332,4 +332,4 @@ Task("Deploy")
332
332
}
333
333
} ) ;
334
334
335
- RunTarget ( target ) ;
335
+ RunTarget ( target ) ;
0 commit comments