Skip to content
Snippets Groups Projects
Commit 80150b72 authored by Sviatoslav Nekhaienko's avatar Sviatoslav Nekhaienko Committed by ethiraj krishnamanaidu
Browse files

Merged PR 1119: GKE merge to master

Related work items: #1586
parents 39a5df50 11496943
No related branches found
No related tags found
1 merge request!6Trusted ibm
# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java
trigger:
branches:
include:
- kuber-migration
paths:
exclude:
- README.md
- .gitignore
pool:
name: Hosted Ubuntu 1604
demands: maven
variables:
dockerDir: provider/indexer-gcp/docker
imageName: os-indexer-app
deploymentDir: provider/indexer-gcp/kubernetes/deployments
deploymentFile: deployment-os-indexer-service.yml
mavenSettings: ./indexer-core/maven/settings.xml
coreModule: indexer-core
gcpModule: indexer-gcp
integrationTestCorePom: testing/indexer-test-core/pom.xml
integrationTestGcpPom: testing/indexer-test-gcp/pom.xml
steps:
- task: DownloadSecureFile@1
name: gcrKey
inputs:
secureFile: cicd-push-image-to-cr-keyfile.json
- task: DownloadSecureFile@1
name: kuberConfig
inputs:
secureFile: kubeconfig
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
options: '--settings $(mavenSettings) -DVSTS_FEED_TOKEN=$(VSTS_FEED_TOKEN) -P $(coreModule) install'
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
options: '--settings $(mavenSettings) -DVSTS_FEED_TOKEN=$(VSTS_FEED_TOKEN) -P $(gcpModule) -DskipTests package'
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
- bash: |
#!/bin/bash
set -e
pushd $(dockerDir)
docker-compose build $(imageName)
echo 'Image done.'
cat $(gcrKey.secureFilePath) | docker login -u _json_key --password-stdin https://gcr.io
echo 'Login done.'
docker push gcr.io/opendes/$(imageName)
echo 'Push done.'
popd
pushd $(deploymentDir)
kubectl --kubeconfig $(kuberConfig.secureFilePath) delete -f $(deploymentFile)
kubectl --kubeconfig $(kuberConfig.secureFilePath) apply -f $(deploymentFile)
popd
attempt_counter=0
max_attempts=60
until [[ $(curl --head --write-out %{http_code} $(INDEXER_READINESS_URL) --silent -o /dev/null --fail) -eq 200 ]]; do
if [ ${attempt_counter} -eq ${max_attempts} ];then
echo "Service is not available, integraton tests are skipped"
exit 1
fi
printf '.'
attempt_counter=$(($attempt_counter+1))
sleep 2
done
- task: Maven@3
inputs:
mavenPomFile: '$(integrationTestCorePom)'
options: '--settings $(mavenSettings) -DVSTS_FEED_TOKEN=$(VSTS_FEED_TOKEN) install'
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
- task: Maven@3
inputs:
mavenPomFile: '$(integrationTestGcpPom)'
options: '--settings $(mavenSettings) -Dsurefire.useFile=false -DVSTS_FEED_TOKEN=$(VSTS_FEED_TOKEN) -DDEFAULT_DATA_PARTITION_ID_TENANT1=$(DEFAULT_DATA_PARTITION_ID_TENANT1) -DDEFAULT_DATA_PARTITION_ID_TENANT2=$(DEFAULT_DATA_PARTITION_ID_TENANT2) -DELASTIC_HOST=$(ELASTIC_HOST) -DELASTIC_PASSWORD=$(ELASTIC_PASSWORD) -DELASTIC_USER_NAME=$(ELASTIC_USER_NAME) -DENTITLEMENTS_DOMAIN=$(ENTITLEMENTS_DOMAIN) -DINDEXER_HOST=$(INDEXER_HOST) -DLEGAL_TAG=$(LEGAL_TAG) -DOTHER_RELEVANT_DATA_COUNTRIES=$(OTHER_RELEVANT_DATA_COUNTRIES) -DSEARCH_HOST=$(SEARCH_HOST) -DSEARCH_INTEGRATION_TESTER=$(SEARCH_INTEGRATION_TESTER) -DSTORAGE_HOST=$(STORAGE_HOST) compile'
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
FROM openjdk:8-slim
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","-Dspring.profiles.active=kuber","/app.jar"]
EXPOSE 8080
version: "3"
services:
os-indexer-app:
build:
args:
JAR_FILE: target/indexer-gcp-1.0.4-SNAPSHOT-spring-boot.jar
context: ..
dockerfile: docker/Dockerfile
image: gcr.io/opendes/os-indexer-app
ports:
- "8080:8080"
apiVersion: v1
kind: Service
metadata:
name: os-indexer-service
labels:
app: os-indexer-service
spec:
ports:
- name: http
port: 80
targetPort: 8080
selector:
app: os-indexer-service
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: os-indexer-service
spec:
replicas: 1
template:
metadata:
labels:
app: os-indexer-service
version: v1
spec:
containers:
- name: os-indexer-app
envFrom:
- configMapRef:
name: os-service-config
image: gcr.io/opendes/os-indexer-app
imagePullPolicy: Always
ports:
- containerPort: 8080
......@@ -4,10 +4,12 @@ import org.opengroup.osdu.core.common.logging.ILogger;
import org.opengroup.osdu.core.gcp.logging.logger.AppEngineLoggingProvider;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@ConditionalOnProperty(name="disable.appengine.log.factory", havingValue = "false", matchIfMissing = true )
@Component
@Primary
@Lazy
......
GOOGLE_CLOUD_PROJECT=${GOOGLE_CLOUD_PROJECT}
INDEXER_HOST=os-indexer-service
STORAGE_HOSTNAME=os-storage-service
STORAGE_SCHEMA_HOST=http://os-storage-service/api/storage/v2/schemas
STORAGE_QUERY_RECORD_HOST=http://os-storage-service/api/storage/v2/query/records
STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST=http://os-storage-service/api/storage/v2/query/records:batch
STORAGE_RECORDS_BATCH_SIZE=20
INDEXER_QUEUE_HOST=http://os-storage-service/_dps/task-handlers/enqueue
AUTHORIZE_API=http://os-entitlement-service/entitlements/v1
LEGALTAG_API=http://os-legal-service/api/legal/v1
CRS_API=${CRS_API}
## use below values for gcp: opendes
REDIS_GROUP_HOST=${REDIS_GROUP_HOST}
REDIS_SEARCH_HOST=${REDIS_SEARCH_HOST}
GOOGLE_AUDIENCES=${GOOGLE_AUDIENCES}
DEPLOYMENT_ENVIRONMENT=CLOUD
disable.appengine.log.factory=true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment