This fabric8 maven plugin enricher API allows the fabric8:deploy
goal to create a build config with Jenkins Pipeline
Build Strategy
Warning
|
|
This plugin is not available in maven central, so you have to build and install locally before proceeding further.
Clone the repo https://github.com/kameshsampath/fmp-openshift-bc-jenkins-enricher and run ./mvnw clean install
from $PROJECT_HOME
Create fabric8 maven plugin profile called profiles.yml inside $basedir/src/main/fabric8
.
The following example shows a profile which can be used in conjunction with spring-boot app. Please refer to fabric8 maven plugin profile for more details
- name: jenkins-springboot-app
enricher:
# The order given in "includes" is the order in which enrichers are called
includes:
- fmp-name
- fmp-controller
- fmp-service
- fmp-image
- fmp-portname
- fmp-project
- fmp-pod-annotations
- fmp-debug
- fmp-merge
- fmp-remove-build-annotations
- fmp-volume-permission
- fmp-openshift-bc-jenkins-enricher
- f8-expose
# Health checks
- spring-boot-health-check
- docker-health-check
- fmp-dependency
- f8-watch
generator:
# The order given in "includes" is the order in which generators are called
includes:
- spring-boot
watcher:
includes:
- spring-boot
- docker-image
Add the following fabric8-maven-plugin configuration to the project,
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>3.5.30</version>
<dependencies>
<dependency>
<groupId>org.workspace7.fmp</groupId>
<artifactId>fmp-openshift-bc-jenkins-enricher</artifactId> (1)
<version>0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<configuration>
<profile>jenkins-springboot-app</profile> (2)
<enricher>
<config>
<fmp-openshift-bc-jenkins-enricher>
<genericSecret>abcde</genericSecret> (3)
<githubWebHookSecret>wxyz</githubWebHookSecret> (4)
</fmp-openshift-bc-jenkins-enricher>
</config>
</enricher>
</configuration>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>resource</goal>
</goals>
</execution>
</executions>
</plugin>
-
add the fmp-openshift-bc-jenkins-enricher as dependnecy to the fabric8-maven-plugin
-
should be name that was used in the
profiles.yaml
above -
The Generic secret that will be used to trigger the build
-
The GitHub Webhook Secret that will be used to trigger the build
Add the following jenkins file to the project
node("fmp-maven") {
checkout scm
stage("Test") {
sh "mvn test"
}
stage("Deploy") {
sh "mvn fabric8:deploy -DskipTests"
}
}
Note
|
|