-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdocker-variables.cake
58 lines (46 loc) · 1.75 KB
/
docker-variables.cake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#l "buildserver.cake"
//-------------------------------------------------------------
public class DockerImagesContext : BuildContextWithItemsBase
{
public DockerImagesContext(IBuildContext parentBuildContext)
: base(parentBuildContext)
{
}
public string DockerEngineUrl { get; set; }
public string DockerRegistryUrl { get; set; }
public string DockerRegistryUserName { get; set; }
public string DockerRegistryPassword { get; set; }
protected override void ValidateContext()
{
}
protected override void LogStateInfoForContext()
{
CakeContext.Information($"Found '{Items.Count}' docker image projects");
}
}
//-------------------------------------------------------------
private DockerImagesContext InitializeDockerImagesContext(BuildContext buildContext, IBuildContext parentBuildContext)
{
var data = new DockerImagesContext(parentBuildContext)
{
Items = DockerImages ?? new List<string>(),
DockerEngineUrl = buildContext.BuildServer.GetVariable("DockerEngineUrl", showValue: true),
DockerRegistryUrl = buildContext.BuildServer.GetVariable("DockerRegistryUrl", showValue: true),
DockerRegistryUserName = buildContext.BuildServer.GetVariable("DockerRegistryUserName", showValue: false),
DockerRegistryPassword = buildContext.BuildServer.GetVariable("DockerRegistryPassword", showValue: false)
};
return data;
}
//-------------------------------------------------------------
List<string> _dockerImages;
public List<string> DockerImages
{
get
{
if (_dockerImages is null)
{
_dockerImages = new List<string>();
}
return _dockerImages;
}
}