@@ -200,8 +200,9 @@ func (o *OctopusContainerTest) setupOctopus(ctx context.Context, connString stri
200
200
Image : o .getOctopusImageUrl () + ":" + o .getOctopusVersion (),
201
201
ExposedPorts : []string {"8080/tcp" },
202
202
Env : map [string ]string {
203
- "ACCEPT_EULA" : "Y" ,
204
- "DB_CONNECTION_STRING" : connString ,
203
+ "ACCEPT_EULA" : "Y" ,
204
+ "DB_CONNECTION_STRING" : connString ,
205
+ // CONNSTRING, LICENSE_BASE64, and CREATE_DB are used by the octopusdeploy/linux image
205
206
"CONNSTRING" : connString ,
206
207
"CREATE_DB" : "Y" ,
207
208
"ADMIN_API_KEY" : getApiKey (),
@@ -211,25 +212,12 @@ func (o *OctopusContainerTest) setupOctopus(ctx context.Context, connString stri
211
212
"OCTOPUS_SERVER_BASE64_LICENSE" : os .Getenv ("LICENSE" ),
212
213
"LICENSE_BASE64" : os .Getenv ("LICENSE" ),
213
214
"ENABLE_USAGE" : "N" ,
214
- "PATH" : "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ,
215
215
},
216
216
Privileged : disableDind != "Y" ,
217
217
WaitingFor : wait .ForLog ("Listening for HTTP requests on" ).WithStartupTimeout (30 * time .Minute ),
218
218
Networks : []string {
219
219
network ,
220
220
},
221
- // Instead of using Cmd for installation, use an EntryPoint script
222
- Entrypoint : []string {
223
- "/bin/bash" ,
224
- "-c" ,
225
- "apt-get update && apt-get install -y curl gnupg lsb-release && " +
226
- "curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg && " +
227
- "echo \" deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main\" | tee /etc/apt/sources.list.d/hashicorp.list > /dev/null && " +
228
- "apt-get update && apt-get install -y terraform && " +
229
- "which terraform && " + // Verify where terraform is installed
230
- "terraform --version && " + // Verify terraform is working
231
- "./install.sh" ,
232
- },
233
221
}
234
222
235
223
req .Env = o .AddCustomEnvironment (req .Env )
@@ -244,6 +232,20 @@ func (o *OctopusContainerTest) setupOctopus(ctx context.Context, connString stri
244
232
return nil , err
245
233
}
246
234
log .Println ("Finished creating Octopus container" )
235
+ installCmd := []string {
236
+ "/bin/bash" ,
237
+ "-c" ,
238
+ "apt-get update && apt-get install -y curl gnupg lsb-release && " +
239
+ "curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg && " +
240
+ "echo \" deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main\" | tee /etc/apt/sources.list.d/hashicorp.list > /dev/null && " +
241
+ "apt-get update && apt-get install -y terraform && " +
242
+ "which terraform && terraform --version" ,
243
+ }
244
+ exitCode , output , err := container .Exec (ctx , installCmd )
245
+ if err != nil || exitCode != 0 {
246
+ log .Printf ("%s" , output )
247
+ return nil , err
248
+ }
247
249
248
250
// Display the container logs
249
251
if os .Getenv ("OCTODISABLEOCTOCONTAINERLOGGING" ) != "true" {
0 commit comments