Creating the Build Tile

Jenkinsfile
pom.xml

Jenkinsfile

buildApi()

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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">

  <modelVersion>4.0.0</modelVersion>

  <groupId>io.practiv.stable.anvil</groupId>
  <artifactId>anvil-tile-build</artifactId>
  <version>1.999-SNAPSHOT</version>
  <packaging>tile</packaging>

  <name>${project.artifactId}</name>
  <description>Build configuration tile for Practiv - used both locally and in Jenkins.</description>

  <distributionManagement>
    <repository>
      <id>branchout-maven-upload</id>
      <name>Releases</name>
      <url>${uploadMavenRepository}</url>
    </repository>
  </distributionManagement>

  <scm>
    <connection>${git.url}</connection>
    <developerConnection>${git.url}</developerConnection>
    <tag>HEAD</tag>
  </scm>

  <properties>
    <!-- These are normally provided by this tile, but this is the tile, so to break the chicken and egg cycle, they're directly in this pom. -->
    <downloadDockerRegistry>docker.build.forge.practiv.io</downloadDockerRegistry>
    <downloadMavenRepository>https://maven.build.forge.practiv.io/repository/practiv-maven</downloadMavenRepository>

    <!-- For Nexus, DevOps/SRE engineers will also need to add the below upload properties to their branchout-maven profile for bootstrap or recovery operations: -->
    <uploadDockerRegistry>docker-upload.build.forge.practiv.io</uploadDockerRegistry>
    <uploadMavenRepository>https://maven.build.forge.practiv.io/repository/practiv-maven-upload</uploadMavenRepository>

    <!-- This is used by the tile-tile when validating this tile, we need the correct build tile -->
    <tile-tile.buildTileGav>io.practiv.stable.anvil:anvil-tile-build:[${project.version}]</tile-tile.buildTileGav>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>io.repaint.maven</groupId>
        <artifactId>tiles-maven-plugin</artifactId>
        <version>2.17</version>
        <extensions>true</extensions>
        <configuration>
          <tiles>
            <tile>io.practiv.stable.tile:practiv-tile-distribution:[2,3)</tile>
            <tile>io.practiv.stable.tile:practiv-tile-buildinfo:[2,3)</tile>
            <tile>io.practiv.stable.tile:practiv-tile-tile:[4,5)</tile>
            <tile>io.practiv.stable.tile:practiv-tile-changes:[2,3)</tile>
          </tiles>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
tile.xml

<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">

  <distributionManagement>
    <repository>
      <id>branchout-maven-upload</id>
      <name>Releases</name>
      <url>${uploadMavenRepository}</url>
    </repository>
  </distributionManagement>

  <properties>
    <gitOrganisation>Practiv</gitOrganisation>
    <gitBaseUrl>git@git.practiv.io:</gitBaseUrl>
    <branchoutName>practiv</branchoutName>
    <branchoutBuildName>anvil</branchoutBuildName>
    <tile-deploy.docker.registry>${uploadDockerRegistry}</tile-deploy.docker.registry>
    <downloadDockerRegistry>docker.build.forge.practiv.io</downloadDockerRegistry>
    <downloadMavenRepository>https://maven.build.forge.practiv.io/repository/practiv-maven</downloadMavenRepository>
    <!-- Skaffold requires upload URLs to be the same as download URLs. -->
    <uploadDockerRegistry>${downloadDockerRegistry}</uploadDockerRegistry>
    <uploadMavenRepository>${downloadMavenRepository}</uploadMavenRepository>
    <!-- Nexus DevOps/SRE engineers need to override the above two upload properties in their settings.xml branchout-maven profile for bootstrap or recovery oprations. -->
    <generateBackupPoms>false</generateBackupPoms>
  </properties>

</project>