first commit
This commit is contained in:
commit
e3b8996d07
7 changed files with 279 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
target/
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
35
deployment/Jenkinsfile
vendored
Normal file
35
deployment/Jenkinsfile
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
pipeline{
|
||||||
|
agent none
|
||||||
|
options {
|
||||||
|
skipDefaultCheckout()
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
stages{
|
||||||
|
stage('Check out') {
|
||||||
|
steps {
|
||||||
|
checkout scm
|
||||||
|
stash(name: 'hello_world', includes: '**', excludes: '**/.git/**')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Maven build') {
|
||||||
|
steps {
|
||||||
|
unstash 'hello_world'
|
||||||
|
sh(script: 'mvn -B -f pom.xml clean package -Pdeploy -pl :hello-world -am')
|
||||||
|
stash(name: 'war', includes: '**')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Create Build Config'){
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
openshift.withCluster(){
|
||||||
|
return !openshift.selector("bc", "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
44
deployment/buildconfig.yaml
Normal file
44
deployment/buildconfig.yaml
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: List
|
||||||
|
metadata:
|
||||||
|
name: hello-world
|
||||||
|
items:
|
||||||
|
- kind: BuildConfig
|
||||||
|
apiVersion: build.openshift.io/v1
|
||||||
|
metadata:
|
||||||
|
name: hello-world
|
||||||
|
labels:
|
||||||
|
build: hello-world
|
||||||
|
spec:
|
||||||
|
output:
|
||||||
|
to:
|
||||||
|
kind: ImageStreamTag
|
||||||
|
name: 'hello-world:latest'
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 700m
|
||||||
|
memory: 800Mi
|
||||||
|
succesfulBuildsHistoryLimit: 5
|
||||||
|
failedBuildsHistoryLimit: 5
|
||||||
|
strategy:
|
||||||
|
type: Source
|
||||||
|
sourceStrategy:
|
||||||
|
from:
|
||||||
|
kind: DockerImage
|
||||||
|
name: 'open-liberty:19.0.0.9-kernel-java11'
|
||||||
|
postCommit: {}
|
||||||
|
source:
|
||||||
|
type: Binary
|
||||||
|
binary: {}
|
||||||
|
triggers:
|
||||||
|
- type: GitHub
|
||||||
|
github:
|
||||||
|
secret: 6FCAFBB9756846ED
|
||||||
|
runPolicy: Serial
|
||||||
|
- kind: ImageStream
|
||||||
|
apiVersion: image.openshift.io/v1
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
build: hello-world
|
||||||
|
name: hello-world
|
||||||
|
spec: {}
|
||||||
110
deployment/hello-world-template.yaml
Normal file
110
deployment/hello-world-template.yaml
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
kind: Template
|
||||||
|
metadata:
|
||||||
|
name: hello-world
|
||||||
|
annotations:
|
||||||
|
description: "Deployment Config for Hello World application"
|
||||||
|
apiVersion: v1
|
||||||
|
objects:
|
||||||
|
- apiVersion: apps.openshift.io/v1
|
||||||
|
kind: DeploymentConfig
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
openshift.io/generated-by: OpenShiftNewApp
|
||||||
|
labels:
|
||||||
|
app: hello-world
|
||||||
|
component: hello-world
|
||||||
|
name: hello-world
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
revisionHistoryLimit: 10
|
||||||
|
selector:
|
||||||
|
app: hello-world
|
||||||
|
deploymentconfig: hello-world
|
||||||
|
strategy:
|
||||||
|
activeDeadlineSeconds: 21600
|
||||||
|
resources: {}
|
||||||
|
rollingParams:
|
||||||
|
intervalSeconds: 1
|
||||||
|
maxSurge: 25%
|
||||||
|
maxUnavailable: 25%
|
||||||
|
timeoutSeconds: 600
|
||||||
|
updatePeriodSeconds: 1
|
||||||
|
type: Rolling
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
openshift.io/generated-by: OpenShiftNewApp
|
||||||
|
labels:
|
||||||
|
app: hello-world
|
||||||
|
component: hello-world
|
||||||
|
deploymentconfig: hello-world
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- envFrom:
|
||||||
|
image: ' '
|
||||||
|
imagePullPolicy: Always
|
||||||
|
name: hello-world
|
||||||
|
ports:
|
||||||
|
- containerPort: 9080
|
||||||
|
protocol: TCP
|
||||||
|
- containerPort: 9443
|
||||||
|
protocol: TCP
|
||||||
|
resources: {}
|
||||||
|
terminationMessagePath: /dev/termination-log
|
||||||
|
terminationMessagePolicy: File
|
||||||
|
dnsPolicy: ClusterFirst
|
||||||
|
restartPolicy: Always
|
||||||
|
scheduler-name: default-scheduler
|
||||||
|
securityContext: {}
|
||||||
|
terminationGracePeriodSeconds: 30
|
||||||
|
test: false
|
||||||
|
triggers:
|
||||||
|
- imageChangeParams:
|
||||||
|
containerNames:
|
||||||
|
- hello-world
|
||||||
|
from:
|
||||||
|
kind: ImageStreamTag
|
||||||
|
name: hello-world:latest
|
||||||
|
type: ImageChange
|
||||||
|
- type: ConfigChange
|
||||||
|
- apiVersion: route.openshift.io/v1
|
||||||
|
kind: Route
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
openshift.io/host.generated: "true"
|
||||||
|
labels:
|
||||||
|
app: hello-world
|
||||||
|
component: hello-world
|
||||||
|
name: hello-world
|
||||||
|
spec:
|
||||||
|
port:
|
||||||
|
targetPort: 9080-tcp
|
||||||
|
to:
|
||||||
|
kind: Service
|
||||||
|
name: hello-world
|
||||||
|
weight: 100
|
||||||
|
wildcardPolicy: None
|
||||||
|
- apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
openshift.io/generated-by: OpenShiftNewApp
|
||||||
|
labels:
|
||||||
|
app: hello-world
|
||||||
|
component: hello-world
|
||||||
|
name: hello-world
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: 9080-tcp
|
||||||
|
port: 9080
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 9080
|
||||||
|
- name: 9443-tcp
|
||||||
|
port: 9443
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 9080
|
||||||
|
selector:
|
||||||
|
app: hello-world
|
||||||
|
deploymentconfig: hello-world
|
||||||
|
sessionAffinity: None
|
||||||
|
type: ClusterIP
|
||||||
45
deployment/pom.xml
Normal file
45
deployment/pom.xml
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?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/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.sander</groupId>
|
||||||
|
<artifactId>hello-world-deployment</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.sander</groupId>
|
||||||
|
<artifactId>hello-world</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<type>war</type>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${basedir}/target</outputDirectory>
|
||||||
|
<stripVersion>true</stripVersion>
|
||||||
|
<overWriteReleases>true</overWriteReleases>
|
||||||
|
<overWriteSnapshots>true</overWriteSnapshots>
|
||||||
|
<overWriteIfNewer>true</overWriteIfNewer>
|
||||||
|
<includeTypes>war</includeTypes>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
26
pom.xml
Normal file
26
pom.xml
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?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/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.sander</groupId>
|
||||||
|
<artifactId>hello-world</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>Simple application to demonstrate deployment on openshift</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax</groupId>
|
||||||
|
<artifactId>javaee-api</artifactId>
|
||||||
|
<version>7.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
16
src/main/java/org/sander/hello/HelloWorldController.java
Normal file
16
src/main/java/org/sander/hello/HelloWorldController.java
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
package org.sander.hello;
|
||||||
|
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
@Path("/hello")
|
||||||
|
public class HelloWorldController {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.TEXT_PLAIN)
|
||||||
|
public String getHello(){
|
||||||
|
return "Hello World";
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue