Skip to content

Commit

Permalink
Merge pull request #60 from ossimlabs/dev
Browse files Browse the repository at this point in the history
Release, merge dev into master
  • Loading branch information
benbuzzelli authored Nov 10, 2020
2 parents 2871c3d + 543a734 commit f73f87f
Show file tree
Hide file tree
Showing 24 changed files with 332 additions and 426 deletions.
124 changes: 86 additions & 38 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ podTemplate(
command: 'cat',
ttyEnabled: true
),
containerTemplate(
image: "${DOCKER_REGISTRY_DOWNLOAD_URL}/kubectl-aws-helm:latest",
name: 'kubectl-aws-helm',
command: 'cat',
ttyEnabled: true,
alwaysPullImage: true
),
containerTemplate(
name: 'cypress',
image: "${DOCKER_REGISTRY_DOWNLOAD_URL}/cypress/included:4.9.0",
Expand Down Expand Up @@ -116,35 +123,33 @@ podTemplate(
}
}
}

stage ("Generate Swagger Spec") {
container('builder') {
sh """
./gradlew :omar-oms-plugin:generateSwaggerDocs \
-PossimMavenProxy=${MAVEN_DOWNLOAD_URL}
"""
archiveArtifacts "plugins/*/build/swaggerSpec.json"
}
}

stage ("Run Cypress Test") {
container('cypress') {
try {
sh """
cypress run --headless
"""
} catch (err) {
sh """
npm i -g xunit-viewer
xunit-viewer -r results -o results/omar-oms-test-results.html
"""
junit 'results/*.xml'
archiveArtifacts "results/*.xml"
archiveArtifacts "results/*.html"
s3Upload(file:'results/omar-oms-test-results.html', bucket:'ossimlabs', path:'cypressTests/')
}
}
}
// stage ("Generate Swagger Spec") {
// container('builder') {
// sh """
// ./gradlew :omar-oms-plugin:generateSwaggerDocs \
// -PossimMavenProxy=${MAVEN_DOWNLOAD_URL}
// """
// archiveArtifacts "plugins/*/build/swaggerSpec.json"
// }
// }
// stage ("Run Cypress Test") {
// container('cypress') {
// try {
// sh """
// cypress run --headless
// """
// } catch (err) {
// sh """
// npm i -g xunit-viewer
// xunit-viewer -r results -o results/omar-oms-test-results.html
// """
// junit 'results/*.xml'
// archiveArtifacts "results/*.xml"
// archiveArtifacts "results/*.html"
// s3Upload(file:'results/omar-oms-test-results.html', bucket:'ossimlabs', path:'cypressTests/')
// }
// }
// }

stage('Build') {
container('builder') {
Expand Down Expand Up @@ -177,21 +182,43 @@ podTemplate(
stage('Docker build') {
container('docker') {
withDockerRegistry(credentialsId: 'dockerCredentials', url: "https://${DOCKER_REGISTRY_DOWNLOAD_URL}") { //TODO
sh """
docker build --build-arg BASE_IMAGE=${DOCKER_REGISTRY_DOWNLOAD_URL}/ossim-alpine-runtime:dev --network=host -t "${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}"/omar-oms-app:"${VERSION}" ./docker
"""
if (BRANCH_NAME == 'master'){
sh """
docker build --build-arg BASE_IMAGE=${DOCKER_REGISTRY_DOWNLOAD_URL}/ossim-alpine-runtime:dev --network=host -t "${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}"/omar-oms:"${VERSION}" ./docker
"""
}
else {
sh """
docker build --build-arg BASE_IMAGE=${DOCKER_REGISTRY_DOWNLOAD_URL}/ossim-alpine-runtime:1.4 --network=host -t "${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}"/omar-oms:"${VERSION}".a ./docker
"""
}
}
}
}

stage('Docker push'){
container('docker') {
withDockerRegistry(credentialsId: 'dockerCredentials', url: "https://${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}") {
sh """
docker push "${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}"/omar-oms-app:"${VERSION}"
"""
container('docker') {
withDockerRegistry(credentialsId: 'dockerCredentials', url: "https://${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}") {
if (BRANCH_NAME == 'master'){
sh """
docker push "${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}"/omar-oms:"${VERSION}"
"""
}
else if (BRANCH_NAME == 'dev') {
sh """
docker tag "${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}"/omar-oms:"${VERSION}".a "${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}"/omar-oms:dev
docker push "${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}"/omar-oms:"${VERSION}".a
docker push "${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}"/omar-oms:dev
"""
}
else {
sh """
docker push "${DOCKER_REGISTRY_PUBLIC_UPLOAD_URL}"/omar-oms:"${VERSION}".a
"""
}
}
}
}
}
stage('Package chart'){
container('helm') {
sh """
Expand All @@ -207,6 +234,27 @@ podTemplate(
}
}
}

stage('New Deploy'){
container('kubectl-aws-helm') {
withAWS(
credentials: 'Jenkins-AWS-IAM',
region: 'us-east-1'){
if (BRANCH_NAME == 'master'){
//insert future instructions here
}
else if (BRANCH_NAME == 'dev') {
sh "aws eks --region us-east-1 update-kubeconfig --name gsp-dev-v2 --alias dev"
sh "kubectl config set-context dev --namespace=omar-dev"
sh "kubectl rollout restart deployment/omar-oms"
}
else {
sh "echo Not deploying ${BRANCH_NAME} branch"
}
}
}
}

stage("Clean Workspace"){
if ("${CLEAN_WORKSPACE}" == "true")
step([$class: 'WsCleanup'])
Expand Down
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Description

The OMAR OSSIM Mapping Service contains all of OSSIM's functionality, binding it via JNI to be web accessible.
The OMAR OSSIM Mapping Service contains all of OSSIM's functionality, binding it via JNI to be web accessible.

[![Build Status](https://jenkins.ossim.io/buildStatus/icon?job=omar-oms-dev)]()

Expand All @@ -19,30 +19,40 @@ Only required for Jenkins pipelines or if you are running Nexus and/or Openshift

## How to Install omar-oms-plugin locally

0. Ensure joms is installed. See [ossim-oms/README.md](http://github.com/ossimlabs/ossim-oms/blob/master/README.md).

1. Git clone the following repos or git pull the latest versions if you already have them.
```

``` sh
git clone https://github.com/ossimlabs/omar-common.git
git clone https://github.com/ossimlabs/omar-core.git
git clone https://github.com/ossimlabs/omar-openlayers.git
git clone https://github.com/ossimlabs/omar-oms.git
```

2. Set OMAR_COMMON_PROPERTIES environment variable to the omar-common-properties.gradle (it is part of the omar-common repo).
2. Set O2_INLINE_BUILD environment variable to true:

3. Install omar-core-plugin (it is part of the omar-core repo).
``` sh
export O2_INLINE_BUILD=1
```

3. Install omar-core-plugin (it is part of the omar-core repo).

``` sh
cd omar-core/plugins/omar-core-plugin
gradle clean install
```

4. Install omar-openlayers-plugin
```

``` sh
cd omar-openlayers/plugins/omar-openlayers-plugin
gradle clean install
```

5. Install omar-oms-plugin

``` sh
cd omar-oms
./gradlew -p apps/omar-oms-app assemble
```
cd omar-oms/plugin/omar-oms-plugin
gradle clean install
``
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ subprojects { project ->
openshiftProjectName = getConfigurationProperty( 'OPENSHIFT_PROJECT_NAME', 'openshiftProjectName' )
}

/*
io.ossim.gradleDefaults.Openshift.addOpenshiftTasks(
project,
openshiftUrl,
Expand All @@ -81,10 +82,10 @@ subprojects { project ->
dockerImageName,
dockerImageTag
)

*/
docker {
registryCredentials {
url = dockerRegistryUrl
url = getConfigurationProperty( 'DOCKER_REGISTRY_USERNAME', 'dockerRegistryUrl' )
username = getConfigurationProperty( 'DOCKER_REGISTRY_USERNAME', 'dockerRegistryUsername' )
password = getConfigurationProperty( 'DOCKER_REGISTRY_PASSWORD', 'dockerRegistryPassword' )
}
Expand Down
2 changes: 1 addition & 1 deletion chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 2.0.1-1
version: 2.0.1-3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
28 changes: 20 additions & 8 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
{{/* Templates for the volumeMounts section */}}

{{- define "omar-oms.volumeMounts.configmaps" -}}
{{- range $configmap := .Values.configmaps}}
- name: {{ $configmap.internalName | quote }}
mountPath: {{ $configmap.mountPath | quote }}
{{- if $configmap.subPath }}
subPath: {{ $configmap.subPath | quote }}
{{- range $configmapName, $configmapDict := .Values.configmaps}}
- name: {{ $configmapName | quote }}
mountPath: {{ $configmapDict.mountPath | quote }}
{{- if $configmapDict.subPath }}
subPath: {{ $configmapDict.subPath | quote }}
{{- end }}
{{- end -}}
{{- end -}}
Expand All @@ -40,6 +40,12 @@
{{- define "omar-oms.volumeMounts" -}}
{{- include "omar-oms.volumeMounts.configmaps" . -}}
{{- include "omar-oms.volumeMounts.pvcs" . -}}
{{- if .Values.global.extraVolumeMounts }}
{{ toYaml .Values.global.extraVolumeMounts }}
{{- end }}
{{- if .Values.extraVolumeMounts }}
{{ toYaml .Values.extraVolumeMounts }}
{{- end }}
{{- end -}}


Expand All @@ -49,10 +55,10 @@
{{/* Templates for the volumes section */}}

{{- define "omar-oms.volumes.configmaps" -}}
{{- range $configmap := .Values.configmaps}}
- name: {{ $configmap.internalName | quote }}
{{- range $configmapName, $configmapDict := .Values.configmaps}}
- name: {{ $configmapName | quote }}
configMap:
name: {{ $configmap.name | quote }}
name: {{ $configmapName | quote }}
{{- end -}}
{{- end -}}

Expand All @@ -68,4 +74,10 @@
{{- define "omar-oms.volumes" -}}
{{- include "omar-oms.volumes.configmaps" . -}}
{{- include "omar-oms.volumes.pvcs" . -}}
{{- if .Values.global.extraVolumes }}
{{ toYaml .Values.global.extraVolumes }}
{{- end }}
{{- if .Values.extraVolumes }}
{{ toYaml .Values.extraVolumes }}
{{- end }}
{{- end -}}
Loading

0 comments on commit f73f87f

Please sign in to comment.