diff --git a/README.md b/README.md index 95cbf9f..aab93fd 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Now, it's time to create devonfw templates to use this s2i and add it to the bro #### Build All -Use script `build.sh` to automatically install and build all image streams. The script also creates devonfw-angular and devonfw-java inside the project 'openshift'. +Use script `build.sh` to automatically install and build all image streams. The script also creates templates devonfw-angular and devonfw-java inside the project 'openshift' to be used by everyone. 1. Open a bash shell as Administrator 2. Execute shell file: diff --git a/build.sh b/build.sh index e9718bd..656920b 100644 --- a/build.sh +++ b/build.sh @@ -26,7 +26,7 @@ echo -e "${BLUE} _ _ _ ${NC}" -echo "Login as admin" +echo "You must login as admin, wait a moment..." oc login oc adm policy add-cluster-role-to-user cluster-admin system @@ -38,7 +38,7 @@ oc new-project devonfw --display-name='DevonFW' --description='DevonFW' ## Create base-images and add them to DevonFW project ### this files are private, to share it, you must enter in Git with a valid user, open the file and press RAW Button to generate a valid token -oc create -f https://raw.githubusercontent.com/oasp/s2i/master/s2i/angular/s2i-devonfw-java-imagestream.json --namespace=devonfw +oc create -f https://raw.githubusercontent.com/oasp/s2i/master/s2i/java/s2i-devonfw-java-imagestream.json --namespace=devonfw oc create -f https://raw.githubusercontent.com/oasp/s2i/master/s2i/angular/s2i-devonfw-angular-imagestream.json --namespace=devonfw ## Build base-images in DevonFW project diff --git a/s2i/angular/s2i-devonfw-angular-imagestream.yaml b/s2i/angular/s2i-devonfw-angular-imagestream.yaml new file mode 100644 index 0000000..904d4a7 --- /dev/null +++ b/s2i/angular/s2i-devonfw-angular-imagestream.yaml @@ -0,0 +1,47 @@ +kind: List +apiVersion: v1 +metadata: + name: s2i-devonfw-angular +items: +- kind: BuildConfig + apiVersion: v1 + metadata: + name: s2i-devonfw-angular + spec: + triggers: + - type: GitHub + github: + secret: secret + - type: Generic + generic: + secret: secret + - type: ImageChange + imageChange: {} + source: + type: Git + git: + uri: https://github.com/oasp/s2i.git + ref: master + strategy: + type: Docker + dockerStrategy: + dockerfilePath: s2i/angular/Dockerfile + output: + to: + kind: ImageStreamTag + name: s2i-devonfw-angular:latest + resources: {} +- kind: ImageStream + apiVersion: v1 + metadata: + name: s2i-devonfw-angular + spec: + tags: + - name: latest + annotations: + description: The Open Application Standard Platform S2I image + iconClass: icon-nodejs + tags: builder,oasp,microservices,javascript,angular + supports: oasp:2.4 + sampleRepo: https://github.com/oasp/s2i.git + version: '1.0' diff --git a/s2i/java/s2i-devonfw-java-imagestream.yaml b/s2i/java/s2i-devonfw-java-imagestream.yaml new file mode 100644 index 0000000..e8c661d --- /dev/null +++ b/s2i/java/s2i-devonfw-java-imagestream.yaml @@ -0,0 +1,46 @@ +kind: List +apiVersion: v1 +metadata: + name: s2i-devonfw-java +items: +- kind: BuildConfig + apiVersion: v1 + metadata: + name: s2i-devonfw-java + spec: + triggers: + - type: GitHub + github: + secret: secret + - type: Generic + generic: + secret: secret + - type: ImageChange + imageChange: {} + source: + type: Git + git: + uri: https://github.com/oasp/s2i.git + ref: master + strategy: + type: Docker + dockerStrategy: + dockerfilePath: s2i/java/Dockerfile + output: + to: + kind: ImageStreamTag + name: s2i-devonfw-java:latest + resources: {} +- kind: ImageStream + apiVersion: v1 + metadata: + name: s2i-devonfw-java + spec: + tags: + - name: latest + annotations: + description: The Open Application Standard Platform for Java S2I image + iconClass: icon-java + tags: builder,java,maven,springboot,oasp,microservices,fatjar + supports: java:8,maven:3,oasp:2.4 + version: '1.0' diff --git a/templates/devonfw/devonfw-angular-template.json b/templates/devonfw/devonfw-angular-template.json index 373dcb0..dec4bd1 100644 --- a/templates/devonfw/devonfw-angular-template.json +++ b/templates/devonfw/devonfw-angular-template.json @@ -64,7 +64,7 @@ { "description": "Git directory context, example: /angular", "name": "CONTEXT_DIR", - "displayName": "Git repository CONTEXT", + "displayName": "Git repository CONTEXT" }, { "description": "Github trigger secret", diff --git a/templates/devonfw/devonfw-angular-template.yaml b/templates/devonfw/devonfw-angular-template.yaml new file mode 100644 index 0000000..34e307e --- /dev/null +++ b/templates/devonfw/devonfw-angular-template.yaml @@ -0,0 +1,189 @@ +kind: List +apiVersion: v1 +metadata: + name: s2i-devonfw +items: +- kind: Template + apiVersion: v1 + metadata: + name: devonfw-angular + annotations: + description: DevonFW application (angular/front-end) + openshift.io/display-name: DevonFW Angular + iconClass: devonfw-angular-logo + tags: instant-app,devonfw,javascript,angular + labels: + createdBy: devonfw-angular + parameters: + - description: 'The name for the application. It can''t contain whitespaces. It + should be the app name including technology, example: mythaistar-angular' + name: APPLICATION_NAME + displayName: Application name + required: true + - description: 'The name for the group list of applications. It can''t contain whitespaces. + It should be the app name excluding technology, example: My-Thai-Star' + name: APPLICATION_GROUP_NAME + displayName: Application group name + required: true + - description: 'Custom hostname for service routes. Leave blank for default hostname, + e.g.: ..' + name: APPLICATION_HOSTNAME + displayName: Application hostname + - description: The pattern URL of the backend's REST API endpoint inside the source + code that is supposed to be modified by the REST Endpoint URL field. + name: REST_ENDPOINT_PATTERN + displayName: REST Endpoint PATTERN URL + value: http://localhost:8081 + - description: The URL of the backend's REST API endpoint + name: REST_ENDPOINT_URL + displayName: REST Endpoint URL + - description: 'Git source URI for application, example: https://github.com/oasp/my-thai-star.git' + name: GIT_URI + displayName: Git repository URI + required: true + - description: 'Git branch/tag reference, example: develop' + name: GIT_REF + displayName: Git repository BRANCH + required: true + - description: 'Git directory context, example: /angular' + name: CONTEXT_DIR + displayName: Git repository CONTEXT + - description: Github trigger secret + name: GITHUB_TRIGGER_SECRET + from: "[a-zA-Z0-9]{8}" + generate: expression + - description: Generic build trigger secret + name: GENERIC_TRIGGER_SECRET + from: "[a-zA-Z0-9]{8}" + generate: expression + objects: + - kind: BuildConfig + apiVersion: v1 + metadata: + name: "${APPLICATION_NAME}" + labels: + app: "${APPLICATION_GROUP_NAME}" + application: "${APPLICATION_NAME}" + spec: + triggers: + - type: GitHub + github: + secret: "${GITHUB_TRIGGER_SECRET}" + - type: Generic + generic: + secret: "${GENERIC_TRIGGER_SECRET}" + - type: ImageChange + imageChange: {} + source: + type: Git + git: + uri: "${GIT_URI}" + ref: "${GIT_REF}" + contextDir: "${CONTEXT_DIR}" + strategy: + type: Source + sourceStrategy: + from: + kind: ImageStreamTag + namespace: devonfw + name: s2i-devonfw-angular:latest + env: + - name: REST_ENDPOINT_URL + value: "${REST_ENDPOINT_URL}" + - name: REST_ENDPOINT_PATTERN + value: "${REST_ENDPOINT_PATTERN}" + - name: BUILD_TARGET + value: prod + - name: ARTIFACT_DIR + value: dist + output: + to: + kind: ImageStreamTag + name: "${APPLICATION_NAME}:latest" + resources: {} + - kind: ImageStream + apiVersion: v1 + metadata: + name: "${APPLICATION_NAME}" + labels: + app: "${APPLICATION_GROUP_NAME}" + application: "${APPLICATION_NAME}" + spec: + dockerImageRepository: '' + tags: + - name: latest + - kind: DeploymentConfig + apiVersion: v1 + metadata: + name: "${APPLICATION_NAME}" + labels: + app: "${APPLICATION_GROUP_NAME}" + application: "${APPLICATION_NAME}" + spec: + strategy: + type: Rolling + rollingParams: + updatePeriodSeconds: 1 + intervalSeconds: 1 + timeoutSeconds: 600 + resources: {} + triggers: + - type: ConfigChange + - type: ImageChange + imageChangeParams: + automatic: true + containerNames: + - "${APPLICATION_NAME}" + from: + kind: ImageStreamTag + name: "${APPLICATION_NAME}:latest" + replicas: 1 + selector: + deploymentconfig: "${APPLICATION_NAME}" + template: + metadata: + labels: + deploymentconfig: "${APPLICATION_NAME}" + spec: + containers: + - name: "${APPLICATION_NAME}" + image: "${APPLICATION_NAME}" + ports: + - containerPort: 8080 + protocol: TCP + resources: {} + terminationMessagePath: "/dev/termination-log" + imagePullPolicy: IfNotPresent + securityContext: + capabilities: {} + privileged: false + restartPolicy: Always + dnsPolicy: ClusterFirst + - kind: Route + apiVersion: v1 + metadata: + name: "${APPLICATION_NAME}" + labels: + app: "${APPLICATION_GROUP_NAME}" + application: "${APPLICATION_NAME}" + spec: + host: "${APPLICATION_HOSTNAME}" + to: + kind: Service + name: "${APPLICATION_NAME}" + - kind: Service + apiVersion: v1 + metadata: + name: "${APPLICATION_NAME}" + labels: + app: "${APPLICATION_GROUP_NAME}" + application: "${APPLICATION_NAME}" + spec: + ports: + - name: "${APPLICATION_NAME}-http" + port: 8091 + targetPort: 8080 + selector: + deploymentconfig: "${APPLICATION_NAME}" + type: ClusterIP + sessionAffinity: None \ No newline at end of file diff --git a/templates/devonfw/devonfw-java-template.json b/templates/devonfw/devonfw-java-template.json index cb54eb4..4df63b2 100644 --- a/templates/devonfw/devonfw-java-template.json +++ b/templates/devonfw/devonfw-java-template.json @@ -53,7 +53,7 @@ { "description": "Git directory context, example: /java/mtsj", "name": "CONTEXT_DIR", - "displayName": "Git repository CONTEXT", + "displayName": "Git repository CONTEXT" }, { "description": "Application options. These options will be passed to the Spring Boot command line", diff --git a/templates/devonfw/devonfw-java-template.yaml b/templates/devonfw/devonfw-java-template.yaml new file mode 100644 index 0000000..ea65585 --- /dev/null +++ b/templates/devonfw/devonfw-java-template.yaml @@ -0,0 +1,190 @@ +kind: List +apiVersion: v1 +metadata: + name: s2i-devonfw +items: +- kind: Template + apiVersion: v1 + metadata: + name: devonfw-java + annotations: + description: DevonFW application (java/backend) + openshift.io/display-name: DevonFW Java + iconClass: devonfw-java-logo + tags: instant-app,devonfw,springboot,maven,java + labels: + createdBy: devonfw-java-server-template + parameters: + - description: 'The name for the application. It can''t contain whitespaces. It + should be the app name including technology, example: mythaistar-java' + name: APPLICATION_NAME + displayName: Application name + required: true + - description: 'The name for the group list of applications. It can''t contain whitespaces. + It should be the app name excluding technology, example: My-Thai-Star' + name: APPLICATION_GROUP_NAME + displayName: Application group name + required: true + - description: 'Custom hostname for service routes. Leave blank for default hostname, + e.g.: ..' + name: APPLICATION_HOSTNAME + displayName: Application hostname + - description: 'Git source URI for application, example: https://github.com/oasp/my-thai-star.git' + name: GIT_URI + displayName: Git repository URI + required: true + - description: 'Git branch/tag reference, example: develop' + name: GIT_REF + displayName: Git repository BRANCH + required: true + - description: 'Git directory context, example: /java/mtsj' + name: CONTEXT_DIR + displayName: Git repository CONTEXT + - description: Application options. These options will be passed to the Spring Boot + command line + name: APP_OPTIONS + - description: Github trigger secret + name: GITHUB_TRIGGER_SECRET + from: "[a-zA-Z0-9]{8}" + generate: expression + - description: Generic build trigger secret + name: GENERIC_TRIGGER_SECRET + from: "[a-zA-Z0-9]{8}" + generate: expression + objects: + - kind: BuildConfig + apiVersion: v1 + metadata: + name: "${APPLICATION_NAME}" + labels: + app: "${APPLICATION_GROUP_NAME}" + application: "${APPLICATION_NAME}" + spec: + triggers: + - type: GitHub + github: + secret: "${GITHUB_TRIGGER_SECRET}" + - type: Generic + generic: + secret: "${GENERIC_TRIGGER_SECRET}" + - type: ImageChange + imageChange: {} + source: + type: Git + git: + uri: "${GIT_URI}" + ref: "${GIT_REF}" + contextDir: "${CONTEXT_DIR}" + strategy: + type: Source + sourceStrategy: + from: + kind: ImageStreamTag + namespace: devonfw + name: s2i-devonfw-java:latest + env: + - name: MAVEN_GOALS + value: clean install package + - name: MAVEN_ARGS + value: "-DskipTests -B" + - name: MAVEN_OPTS + value: "-Xmx1024m -Xms1024m" + - name: MAVEN_PROFILE + value: '' + - name: MAVEN_MIRROR_URL + value: '' + - name: APP_SUFFIX + value: bootified + - name: ARTIFACT_DIR + value: server/target + output: + to: + kind: ImageStreamTag + name: "${APPLICATION_NAME}:latest" + resources: {} + - kind: ImageStream + apiVersion: v1 + metadata: + name: "${APPLICATION_NAME}" + labels: + app: "${APPLICATION_GROUP_NAME}" + application: "${APPLICATION_NAME}" + spec: + dockerImageRepository: '' + tags: + - name: latest + - kind: DeploymentConfig + apiVersion: v1 + metadata: + name: "${APPLICATION_NAME}" + labels: + app: "${APPLICATION_GROUP_NAME}" + application: "${APPLICATION_NAME}" + spec: + strategy: + type: Rolling + rollingParams: + updatePeriodSeconds: 1 + intervalSeconds: 1 + timeoutSeconds: 600 + resources: {} + triggers: + - type: ConfigChange + - type: ImageChange + imageChangeParams: + automatic: true + containerNames: + - "${APPLICATION_NAME}" + from: + kind: ImageStreamTag + name: "${APPLICATION_NAME}:latest" + replicas: 1 + selector: + deploymentconfig: "${APPLICATION_NAME}" + template: + metadata: + labels: + deploymentconfig: "${APPLICATION_NAME}" + spec: + containers: + - name: "${APPLICATION_NAME}" + image: "${APPLICATION_NAME}" + ports: + - containerPort: 8081 + protocol: TCP + resources: {} + terminationMessagePath: "/dev/termination-log" + imagePullPolicy: IfNotPresent + securityContext: + capabilities: {} + privileged: false + restartPolicy: Always + dnsPolicy: ClusterFirst + - kind: Route + apiVersion: v1 + metadata: + name: "${APPLICATION_NAME}" + labels: + app: "${APPLICATION_GROUP_NAME}" + application: "${APPLICATION_NAME}" + spec: + host: "${APPLICATION_HOSTNAME}" + to: + kind: Service + name: "${APPLICATION_NAME}" + - kind: Service + apiVersion: v1 + metadata: + name: "${APPLICATION_NAME}" + labels: + app: "${APPLICATION_GROUP_NAME}" + application: "${APPLICATION_NAME}" + spec: + ports: + - name: "${APPLICATION_NAME}-http" + port: 8081 + targetPort: 8081 + selector: + deploymentconfig: "${APPLICATION_NAME}" + type: ClusterIP + sessionAffinity: None diff --git a/templates/devonfw/icons/devonfw-languagesIcon.png b/templates/devonfw/icons/devonfw-languagesIcon.png new file mode 100644 index 0000000..13f7045 Binary files /dev/null and b/templates/devonfw/icons/devonfw-languagesIcon.png differ diff --git a/testCLA b/testCLA new file mode 100644 index 0000000..4aba98a --- /dev/null +++ b/testCLA @@ -0,0 +1 @@ +file for test CLA