@@ -47,7 +47,6 @@ internal data class Version(
47
47
@Json(name = " version" ) val version : String ,
48
48
)
49
49
50
- private const val DOWNLOADING_CODER_CLI = " Downloading Coder CLI..."
51
50
52
51
/* *
53
52
* Do as much as possible to get a valid, up-to-date CLI.
@@ -67,6 +66,11 @@ suspend fun ensureCLI(
67
66
buildVersion : String ,
68
67
showTextProgress : (String ) -> Unit
69
68
): CoderCLIManager {
69
+ fun reportProgress (msg : String ) {
70
+ showTextProgress(msg)
71
+ context.logger.info(msg)
72
+ }
73
+
70
74
val settings = context.settingsStore.readOnly()
71
75
val cli = CoderCLIManager (context, deploymentURL)
72
76
@@ -77,14 +81,13 @@ suspend fun ensureCLI(
77
81
// the 304 method.
78
82
val cliMatches = cli.matchesVersion(buildVersion)
79
83
if (cliMatches == true ) {
80
- context.logger.info (" Local CLI version matches server version: $buildVersion " )
84
+ reportProgress (" Local CLI version matches server version: $buildVersion " )
81
85
return cli
82
86
}
83
87
84
88
// If downloads are enabled download the new version.
85
89
if (settings.enableDownloads) {
86
- context.logger.info(DOWNLOADING_CODER_CLI )
87
- showTextProgress(DOWNLOADING_CODER_CLI )
90
+ reportProgress(" Downloading Coder CLI..." )
88
91
try {
89
92
cli.download(buildVersion, showTextProgress)
90
93
return cli
@@ -102,12 +105,12 @@ suspend fun ensureCLI(
102
105
val dataCLI = CoderCLIManager (context, deploymentURL, true )
103
106
val dataCLIMatches = dataCLI.matchesVersion(buildVersion)
104
107
if (dataCLIMatches == true ) {
108
+ reportProgress(" Local CLI version from data directory matches server version: $buildVersion " )
105
109
return dataCLI
106
110
}
107
111
108
112
if (settings.enableDownloads) {
109
- context.logger.info(DOWNLOADING_CODER_CLI )
110
- showTextProgress(DOWNLOADING_CODER_CLI )
113
+ reportProgress(" Downloading Coder CLI to the data directory..." )
111
114
dataCLI.download(buildVersion, showTextProgress)
112
115
return dataCLI
113
116
}
0 commit comments