Jenkins configuration tips

From DarkWiki
Jump to: navigation, search

Cobetura

In the Build section, you need to add the following goals and options:

clean install cobertura:cobertura -Dcobertura.report.format=xml

At the bottom, in the Publish Cobetura Coverage Report section, you need to have the following pattern configured:

**/target/site/cobertura/coverage.xml

Excluding classes from Cobetura reports

There are occasions when you want to exclude specific classes from Cobetura reports. This can be achieved by adding the following to your pom.xml file:

	<build>
		<plugins>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>cobertura-maven-plugin</artifactId>
				<version>${version.cobertura}</version>
				<configuration>
					<formats>
						<format>xml</format>
					</formats>
					<instrumentation>
						<excludes>
							<exclude>com/proconvey/common/hibernate/MoneyUserType.class</exclude>
						</excludes>
					</instrumentation>
				</configuration>
			</plugin>

		</plugins>

	</build>

	<reporting>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>cobertura-maven-plugin</artifactId>
				<version>${version.cobertura}</version>
				<configuration>
					<formats>
						<format>xml</format>
					</formats>
				</configuration>
			</plugin>
		</plugins>
	</reporting>

Docker upgrades

Jenkins LTS runs inside a docker container, built from the infrastructure repository. Frequent releases of Jenkins are necessary as it's a buggy pile of shite.

Create an updated local image

sudo docker pull jenkins/jenkins:lts
cd /home/apowney/dev/infrastructure/new/jenkins
sudo docker-compose build

Recreate the container in Portainer