Bamboo Specs using java inheritance
Asked by Carsten Hilber:

Hi,

we try to achieve to have a simple, preconfigured plan that we can extend when creating new plans in a project. So we have a single repository which only contains the build plans that we want to confugure.

At the moment, the build-specs directory contains 4 plans. These extend different preconfigured classes which hold the plan configuration. Executing the plans locally works fine. But if we create the Linked Repository in Bamboo then the build of our Plans fails with a file not found exception.

The actual code of the repositories that will be checked out are in different repositories which are referenced by the code. Is it necessary that the project code is in the same repository as the bamboo specs? Or is it not possible to inherit bamboo specs? And why is that exception coming from the spotify docker implementation?

```
com.spotify.docker.client.exceptions.DockerException
```

Thanks

Carsten

```
Content of pom.xml used:<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">    <!--Edit template at BAMBOO_INSTALL/atlassian-bamboo/WEB-INF/classes/bamboo-specs-pom.xml-->    <modelVersion>4.0.0</modelVersion>    <parent>        <groupId>com.atlassian.bamboo</groupId>        <artifactId>bamboo-specs-parent</artifactId>        <version>6.6.3</version>        <relativePath/>    </parent>    <artifactId>bamboo-specs-generator</artifactId>    <version>1.0.0</version>    <packaging>jar</packaging>    <dependencies>		<dependency>			<groupId>com.atlassian.bamboo</groupId>			<artifactId>bamboo-specs-api</artifactId>		</dependency>		<dependency>			<groupId>com.atlassian.bamboo</groupId>			<artifactId>bamboo-specs</artifactId>		</dependency>		<!-- Test dependencies -->		<dependency>			<groupId>junit</groupId>			<artifactId>junit</artifactId>			<scope>test</scope>		</dependency>	</dependencies>    <build>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-compiler-plugin</artifactId>                <configuration>                    <compilerArgs>                        <compilerArg>-proc:none</compilerArg>                    </compilerArgs>                </configuration>            </plugin>        </plugins>    </build></project>Processing Specs within Docker containerUnable to scan repository Plug-In Build Pipeline (41123877) for Bamboo Specscom.atlassian.bamboo.repository.RepositoryException: Unable to scan repository Plug-In Build Pipeline (41123877) for Bamboo Specs	at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.lambda$runSpecsWithDocker$8(RepositoryStoredSpecsServiceImpl.java:739)	at java.util.concurrent.FutureTask.run(FutureTask.java:266)	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)	at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)	at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)	at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)	at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)	at java.lang.Thread.run(Thread.java:748)Caused by: com.spotify.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: No such file or directory	at com.spotify.docker.client.DefaultDockerClient.propagate(DefaultDockerClient.java:2702)	at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:2633)	at com.spotify.docker.client.DefaultDockerClient.pull(DefaultDockerClient.java:1250)	at com.spotify.docker.client.DefaultDockerClient.pull(DefaultDockerClient.java:1227)	at com.spotify.docker.client.DefaultDockerClient.pull(DefaultDockerClient.java:1221)	at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.lambda$runSpecsWithDocker$8(RepositoryStoredSpecsServiceImpl.java:688)	... 8 moreCaused by: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: No such file or directory	at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299)	at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286)	at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)	at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:2631)	... 12 moreCaused by: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: java.io.IOException: No such file or directory	at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:481)	at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector$1.run(ApacheConnector.java:491)	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)	at java.util.concurrent.FutureTask.run(FutureTask.java:266)	at jersey.repackaged.com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)	at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:50)	at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:37)	at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:487)	at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:178)	at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)	at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)	at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process(Errors.java:315)	at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process(Errors.java:297)	at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process(Errors.java:267)	at com.spotify.docker.client.shaded.org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:340)	at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$3.run(ClientRuntime.java:210)	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)	at java.util.concurrent.FutureTask.run(FutureTask.java:266)	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)	... 1 moreCaused by: java.io.IOException: No such file or directory	at jnr.unixsocket.UnixSocketChannel.doConnect(UnixSocketChannel.java:127)	at jnr.unixsocket.UnixSocketChannel.connect(UnixSocketChannel.java:136)	at jnr.unixsocket.UnixSocketChannel.connect(UnixSocketChannel.java:223)	at com.spotify.docker.client.UnixConnectionSocketFactory.connectSocket(UnixConnectionSocketFactory.java:85)	at com.spotify.docker.client.shaded.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)	at com.spotify.docker.client.shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)	at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)	at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)	at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)	at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)	at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)	at com.spotify.docker.client.shaded.org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)	at com.spotify.docker.client.shaded.org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)	at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:435)	... 21 more
```


Answers:
author: Marcin Gardias
body: Not sure what you mean. Of course you can use Java inheritance in Bamboo Specs, but the base classes must be available when you run the specs.

\>So we have a single repository which only contains the build plans that we want to configure.

Does it mean that base classes are not in the same repository as the actual plans? Then you need to create a Maven artifact and reference that in your pom.xml

\>Is it necessary that the project code is in the same repository as the bamboo specs?

No.

\>And why is that exception coming from the spotify docker implementation?

Because specs are built and executed inside a docker container. You can switch that off and make them execute directly on Bamboo server in Administration -\> Security settings

comments: author: Carsten Hilber
body: Turning of the docker container use worked. Everything else works fine.


Tags: spec