@@ -200,8 +200,9 @@ func (o *OctopusContainerTest) setupOctopus(ctx context.Context, connString stri
200200 Image : o .getOctopusImageUrl () + ":" + o .getOctopusVersion (),
201201 ExposedPorts : []string {"8080/tcp" },
202202 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
205206 "CONNSTRING" : connString ,
206207 "CREATE_DB" : "Y" ,
207208 "ADMIN_API_KEY" : getApiKey (),
@@ -211,25 +212,12 @@ func (o *OctopusContainerTest) setupOctopus(ctx context.Context, connString stri
211212 "OCTOPUS_SERVER_BASE64_LICENSE" : os .Getenv ("LICENSE" ),
212213 "LICENSE_BASE64" : os .Getenv ("LICENSE" ),
213214 "ENABLE_USAGE" : "N" ,
214- "PATH" : "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ,
215215 },
216216 Privileged : disableDind != "Y" ,
217217 WaitingFor : wait .ForLog ("Listening for HTTP requests on" ).WithStartupTimeout (30 * time .Minute ),
218218 Networks : []string {
219219 network ,
220220 },
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- },
233221 }
234222
235223 req .Env = o .AddCustomEnvironment (req .Env )
@@ -244,6 +232,20 @@ func (o *OctopusContainerTest) setupOctopus(ctx context.Context, connString stri
244232 return nil , err
245233 }
246234 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+ }
247249
248250 // Display the container logs
249251 if os .Getenv ("OCTODISABLEOCTOCONTAINERLOGGING" ) != "true" {
0 commit comments