File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
Cake.Common/Build/GitLabCI/Data Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ public GitLabCIInfoFixture(bool versionNineOrNewer = false)
60
60
Environment . GetEnvironmentVariable ( "CI_RUNNER_DESCRIPTION" ) . Returns ( "my runner" ) ;
61
61
Environment . GetEnvironmentVariable ( "CI_RUNNER_TAGS" ) . Returns ( "[\" docker\" , \" linux\" ]" ) ;
62
62
Environment . GetEnvironmentVariable ( "CI_SERVER" ) . Returns ( "yes" ) ;
63
+ Environment . GetEnvironmentVariable ( "CI_SERVER_URL" ) . Returns ( "https://gitlab.example.com:8080" ) ;
63
64
Environment . GetEnvironmentVariable ( "CI_SERVER_NAME" ) . Returns ( "GitLab" ) ;
64
65
Environment . GetEnvironmentVariable ( "CI_SERVER_REVISION" ) . Returns ( "70606bf" ) ;
65
66
Environment . GetEnvironmentVariable ( "CI_SERVER_VERSION" ) . Returns ( "8.9.0" ) ;
Original file line number Diff line number Diff line change @@ -58,4 +58,20 @@ public void Should_Return_Correct_Value()
58
58
Assert . Equal ( "8.9.0" , result ) ;
59
59
}
60
60
}
61
- }
61
+
62
+ public sealed class TheUrlProperty
63
+ {
64
+ [ Fact ]
65
+ public void Should_Return_Correct_Value ( )
66
+ {
67
+ // Given
68
+ var info = new GitLabCIInfoFixture ( ) . CreateServerInfo ( ) ;
69
+
70
+ // When
71
+ var result = info . Url ;
72
+
73
+ // Then
74
+ Assert . Equal ( "https://gitlab.example.com:8080" , result ) ;
75
+ }
76
+ }
77
+ }
Original file line number Diff line number Diff line change @@ -43,5 +43,13 @@ public GitLabCIServerInfo(ICakeEnvironment environment)
43
43
/// The GitLab revision that is used to schedule builds.
44
44
/// </value>
45
45
public string Revision => GetEnvironmentString ( "CI_SERVER_REVISION" ) ;
46
+
47
+ /// <summary>
48
+ /// Gets the base URL of the GitLab instance, including protocol and port.
49
+ /// </summary>
50
+ /// <value>
51
+ /// The base URL of the GitLab instance, including protocol and port.
52
+ /// </value>
53
+ public string Url => GetEnvironmentString ( "CI_SERVER_URL" ) ;
46
54
}
47
55
}
You can’t perform that action at this time.
0 commit comments