Commit 2b28ab05 authored by Sheng Wang's avatar Sheng Wang
Browse files

Merge branch 'trusted-ado-code-push' into 'master'

Trusted ado code push

See merge request osdu/platform/domain-data-mgmt-services/well-delivery/well-planning!9
parents 68741b68 ad3096aa
Pipeline #48687 failed with stages
in 12 minutes and 33 seconds
......@@ -5,24 +5,24 @@ variables:
include:
- project: "osdu/platform/ci-cd-pipelines"
ref: "Azure-slb"
ref: "master"
file: "standard-setup.yml"
- project: "osdu/platform/ci-cd-pipelines"
ref: "Azure-slb"
ref: "master"
file: "build/maven.yml"
- project: "osdu/platform/ci-cd-pipelines"
ref: "Azure-slb"
file: "scanners/fossa.yml"
ref: "master"
file: "scanners/fossa-maven.yml"
- project: "osdu/platform/ci-cd-pipelines"
ref: "Azure-slb"
ref: "master"
file: "scanners/gitlab-ultimate.yml"
- project: "osdu/platform/ci-cd-pipelines"
ref: "Azure-slb"
file: "cloud-providers/azure-slb.yml"
ref: "master"
file: "cloud-providers/azure.yml"
......
......@@ -12,7 +12,9 @@ The following software have components provided under the terms of this license:
- Apache Commons Codec (from http://commons.apache.org/proper/commons-codec/)
- Apache Commons Lang (from http://commons.apache.org/proper/commons-lang/)
- Apache Commons Lang (from http://commons.apache.org/proper/commons-lang/)
- Apache Commons Logging (from http://commons.apache.org/proper/commons-logging/)
- Apache HttpClient (from http://hc.apache.org/httpcomponents-client)
- Apache HttpClient Cache (from http://hc.apache.org/httpcomponents-client)
- Apache HttpCore (from http://hc.apache.org/httpcomponents-core-ga)
- Apache Log4j API (from )
- Apache Log4j to SLF4J Adapter (from )
......@@ -160,13 +162,19 @@ The following software have components provided under the terms of this license:
- Java(TM) API for WebSocket (from )
========================================================================
EPL-1.0
CPL-1.0
========================================================================
The following software have components provided under the terms of this license:
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- JUnit (from http://junit.org)
- JUnit (from http://junit.org)
========================================================================
EPL-1.0
========================================================================
The following software have components provided under the terms of this license:
- Expression Language 3.0 (from https://projects.eclipse.org/projects/ee4j.el)
- JUnit Jupiter (Aggregator) (from https://junit.org/junit5/)
- Java Servlet API (from https://projects.eclipse.org/projects/ee4j.servlet)
- Logback Classic Module (from )
......@@ -267,6 +275,7 @@ The following software have components provided under the terms of this license:
- Checker Qual (from https://checkerframework.org)
- JCodings (from )
- JUL to SLF4J bridge (from http://www.slf4j.org)
- Java JWT (from http://www.jwt.io)
- Joni (from )
- Microsoft Azure SDK for SQL API of Azure Cosmos DB Service (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure client library for Identity (from https://github.com/Azure/azure-sdk-for-java)
......@@ -340,6 +349,8 @@ The following software have components provided under the terms of this license:
- Byte Buddy (without dependencies) (from )
- Common Annotations 1.2 API (from )
- JUnit (from http://junit.org)
- JUnit (from http://junit.org)
- JUnit Jupiter (Aggregator) (from https://junit.org/junit5/)
- JavaBeans Activation Framework API jar (from )
- jakarta.xml.bind-api (from )
......
......@@ -15,6 +15,6 @@
apiVersion: v2
name: well-planning
appVersion: "latest"
description: Helm Chart for installing storage service.
description: Helm Chart for installing well delivery service.
version: 0.1.0
type: application
......@@ -15,7 +15,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: well-planning-deployment
name: {{ .Release.Name }}
namespace: osdu
spec:
replicas: {{ .Values.global.replicaCount }}
......@@ -26,40 +26,55 @@ spec:
metadata:
labels:
app: {{ .Chart.Name }}
aadpodidbinding: osdu-identity
spec:
volumes:
- name: azure-keyvault
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: azure-keyvault
containers:
- name: {{ .Chart.Name }}
image: {{ .Values.image.repository }}/{{ .Chart.Name }}-{{ .Values.image.branch }}:{{ .Values.image.tag | default .Chart.AppVersion }}
imagePullPolicy: Always
ports:
- containerPort: 8080
- containerPort: 80
readinessProbe:
httpGet:
path: /api/well-planning/_ah/warmup
port: 80
env:
- name: server.servlet.contextPath
value: /api/well-planning/
- name: server_port
value: "80"
- name: entitlements_service_endpoint
value: http://entitlements-azure/entitlements/v1
- name: entitlements_service_api_key
valueFrom:
secretKeyRef:
name: api-osdu-secret
key: entitlements_service_api_key
value: "OBSOLETE"
- name: legal_service_endpoint
valueFrom:
secretKeyRef:
name: api-osdu-secret
key: legal_service_endpoint
- name: entitlements_service_endpoint
valueFrom:
secretKeyRef:
name: api-osdu-secret
key: entitlements_service_endpoint
value: http://legal/api/legal/v1
- name: storage_service_endpoint
valueFrom:
secretKeyRef:
name: api-osdu-secret
key: storage_service_endpoint
value: http://storage/api/storage/v2
- name: schema_service_endpoint
value: http://schema-service/api/schema-service/v1
- name: partition_service_endpoint
value: http://partition/api/partition/v1
- name: KEYVAULT_URI
valueFrom:
secretKeyRef:
name: api-osdu-secret
key: schema_service_endpoint
- name: mongodb_connection_string
configMapKeyRef:
name: osdu-svc-properties
key: ENV_KEYVAULT
- name: aad_client_id
valueFrom:
secretKeyRef:
name: api-osdu-secret
key: mongodb_connection_string
\ No newline at end of file
name: active-directory
key: application-appid
- name: azure_activedirectory_session_stateless
value: "true"
- name: azure_activedirectory_AppIdUri
value: "api://$(aad_client_id)"
- name: azure_istioauth_enabled
value: "true"
......@@ -16,7 +16,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}
namespace: ingress-nginx
namespace: osdu
spec:
type: ClusterIP
ports:
......
# Copyright © Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
trigger:
batch: true
branches:
include:
- master
paths:
exclude:
- /**/*.md
- .gitignore
- /docs
- /examples
resources:
repositories:
- repository: FluxRepo
type: git
name: k8-gitops-manifests
- repository: TemplateRepo
type: git
name: infra-azure-provisioning
variables:
- group: 'Azure - OSDU'
- group: 'Azure - OSDU Secrets'
- name: serviceName
value: "well-planning"
- name: chartPath
value: "devops/azure/chart"
- name: valuesFile
value: "devops/azure/chart/helm-config.yaml"
- name: 'MANIFEST_REPO'
value: $[ resources.repositories['FluxRepo'].name ]
- name: 'MAVEN_CACHE_FOLDER'
value: $(Pipeline.Workspace)/.m2/repository
- name: SKIP_TESTS
value: 'false'
stages:
- template: /devops/build-stage.yml@TemplateRepo
parameters:
mavenGoal: 'package'
mavenPublishJUnitResults: true
serviceCoreMavenOptions: '-P wd-core --settings .mvn/community-maven.settings.xml -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
mavenOptions: '-P wd-azure --settings .mvn/community-maven.settings.xml -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
copyFileContents: |
pom.xml
provider/wd-azure/maven/settings.xml
provider/wd-azure/pom.xml
provider/wd-azure/target/*-spring-boot.jar
copyFileContentsToFlatten: ''
mavenSettingsFile: './maven/settings.xml'
serviceBase: ${{ variables.serviceName }}
testingRootFolder: 'testing'
chartPath: ${{ variables.chartPath }}
- template: /devops/deploy-stages.yml@TemplateRepo
parameters:
serviceName: ${{ variables.serviceName }}
chartPath: ${{ variables.chartPath }}
valuesFile: ${{ variables.valuesFile }}
testCoreMavenPomFile: 'testing/wd-test-core/pom.xml'
testCoreMavenOptions: '--settings $(System.DefaultWorkingDirectory)/drop/deploy/testing/maven/settings.xml'
skipDeploy: ${{ variables.SKIP_DEPLOY }}
skipTest: ${{ variables.SKIP_TESTS }}
providers:
- name: Azure
environments: ['dev']
# Copyright © Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
trigger:
batch: true
branches:
include:
- master
paths:
exclude:
- /**/*.md
- .gitignore
- /docs
- /examples
resources:
repositories:
- repository: FluxRepo
type: git
name: k8-gitops-manifests
- repository: TemplateRepo
type: git
name: infra-azure-provisioning
- repository: security-templates
type: git
name: security-infrastructure
variables:
- group: 'Azure - OSDU'
- group: 'Azure - OSDU Secrets'
- name: serviceName
value: "well-planning"
- name: chartPath
value: "devops/azure/chart"
- name: valuesFile
value: "devops/azure/chart/helm-config.yaml"
- name: 'MANIFEST_REPO'
value: $[ resources.repositories['FluxRepo'].name ]
- name: 'MAVEN_CACHE_FOLDER'
value: $(Pipeline.Workspace)/.m2/repository
- name: SKIP_TESTS
value: 'false'
stages:
- template: /devops/build-stage.yml@TemplateRepo
parameters:
mavenGoal: 'package'
mavenPublishJUnitResults: true
serviceCoreMavenOptions: '-P wd-core --settings .mvn/community-maven.settings.xml -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
mavenOptions: '-P wd-azure --settings .mvn/community-maven.settings.xml -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
copyFileContents: |
pom.xml
provider/wd-azure/maven/settings.xml
provider/wd-azure/pom.xml
provider/wd-azure/target/*-spring-boot.jar
copyFileContentsToFlatten: ''
mavenSettingsFile: './maven/settings.xml'
serviceBase: ${{ variables.serviceName }}
testingRootFolder: 'testing'
chartPath: ${{ variables.chartPath }}
- template: /devops/deploy-stages.yml@TemplateRepo
parameters:
serviceName: ${{ variables.serviceName }}
chartPath: ${{ variables.chartPath }}
valuesFile: ${{ variables.valuesFile }}
testCoreMavenPomFile: 'testing/wd-test-core/pom.xml'
testCoreMavenOptions: '--settings $(System.DefaultWorkingDirectory)/drop/deploy/testing/maven/settings.xml'
skipDeploy: ${{ variables.SKIP_DEPLOY }}
skipTest: ${{ variables.SKIP_TESTS }}
providers:
- name: Azure
environments: ['dev', 'qa', 'prd', 'weu', 'cvx']
......@@ -110,4 +110,11 @@
</plugins>
</build>
<repositories>
<repository>
<id>gitlab-maven</id>
<url>https://community.opengroup.org/api/v4/projects/67/packages/maven</url>
</repository>
</repositories>
</project>
......@@ -41,6 +41,13 @@
</properties>
<dependencies>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-service-client</artifactId>
<version>0.0.13</version>
</dependency>
<dependency>
<groupId>org.opengroup.osdu.wd</groupId>
<artifactId>well-delivery-core</artifactId>
......@@ -54,6 +61,12 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.12.0</version>
</dependency>
<!-- Azure dependencies -->
<dependency>
<groupId>com.microsoft.azure</groupId>
......
......@@ -14,14 +14,10 @@
package org.opengroup.osdu.wd.azure.cosmosdb;
import com.google.gson.Gson;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.bson.Document;
import org.bson.json.JsonMode;
import org.bson.json.JsonWriterSettings;
import org.opengroup.osdu.wd.core.models.*;
import org.opengroup.osdu.wd.core.util.Common;
......@@ -34,53 +30,33 @@ public class CosmosEntity {
@NonNull
private String id;
@NonNull
private String origId;
@NonNull
private String entityId;
@NonNull
private String entityType;
@NonNull
private String kind;
@NonNull
private String schemaId;
private long version;
@NonNull
private String groupType;
private boolean deleted;
@NonNull
private ACL acl;
private Legal legal;
private String existenceKind;
private List<Relationship> relationships;
private boolean valid;
@NonNull
private Object data;
private Object meta;
public CosmosEntity(EntityDto dto, List<Relationship> relationships) {
this.id = Common.buildId(dto.getEntityId(), dto.getVersion());
this.origId = dto.getId();
this.entityId = dto.getEntityId();
this.kind = dto.getKind();
this.entityType = dto.getEntityType();
this.kind = dto.getKind();
this.version = dto.getVersion();
this.schemaId = dto.getSchemaId();
this.groupType = dto.getGroupType();
this.deleted = false;
this.acl = new ACL();
this.acl.setOwners(dto.getAcl().getOwners());
......@@ -88,10 +64,11 @@ public class CosmosEntity {
this.legal = new Legal();
this.legal.setLegaltags(dto.getLegal().getLegaltags());
this.legal.setOtherRelevantDataCountries(dto.getLegal().getOtherRelevantDataCountries());
this.existenceKind = dto.getExistenceKind();
this.relationships = relationships;
this.valid = dto.isValid();
this.data = dto.getData();
this.meta = dto.getMeta();
this.valid = dto.isValid();
}
public EntityDtoReturn ToEntityDtoReturn() {
......@@ -115,19 +92,4 @@ public class CosmosEntity {
dto.getLegal().setOtherRelevantDataCountries(this.legal.getOtherRelevantDataCountries());
return dto;
}
public Document ToDocument() {
Gson gson = new Gson();
String json = gson.toJson(this);
Document doc = Document.parse(json);
return doc;
}
public static CosmosEntity ToCosmosEntity(Document doc) {
Gson gson = new Gson();
JsonWriterSettings relaxed = JsonWriterSettings.builder().outputMode(JsonMode.RELAXED).build();
String json = doc.toJson(relaxed);
CosmosEntity entity = gson.fromJson(json, CosmosEntity.class);
return entity;
}
}
......@@ -19,12 +19,12 @@ import org.opengroup.osdu.wd.core.dataaccess.interfaces.IEntityDBClient;
import org.opengroup.osdu.wd.core.models.EntityDtoReturn;
import org.opengroup.osdu.wd.core.models.EntityDto;
import org.opengroup.osdu.wd.core.models.Relationship;
import org.opengroup.osdu.wd.core.util.Common;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.locks.ReentrantLock;
@Service
......@@ -32,7 +32,7 @@ import java.util.concurrent.locks.ReentrantLock;
public class CosmosEntityClient implements IEntityDBClient {
@Autowired
private CosmosInit cosmosInit;
private CosmosdbInit cosmosInit;
private ReentrantLock mutex = new ReentrantLock();
......@@ -43,8 +43,7 @@ public class CosmosEntityClient implements IEntityDBClient {
CosmosEntity entity = new CosmosEntity(dto, relationships);
try {
mutex.lock();
//Optional<Entity> existingEntity = CosmosFacade.findItem(container, id, entityId, Entity.class);
CosmosFacade.upsertItem(container, entity);
CosmosdbFacade.upsertItem(container, entity);
} finally {
mutex.unlock();
}
......@@ -55,28 +54,28 @@ public class CosmosEntityClient implements IEntityDBClient {
public EntityDtoReturn getLatestEntityVersion(String entityType, String entityId) {
CosmosContainer container = cosmosInit.getEntityContainer(entityType);
Optional<CosmosEntity> res = CosmosFacade.findLatestItem(container, entityId, CosmosEntity.class);
if (res == null || !res.isPresent())
CosmosEntity res = CosmosdbFacade.findLatestItem(container, entityId);
if (res == null)
return null;
return res.get().ToEntityDtoReturn();
return res.ToEntityDtoReturn();
}
@Override
public EntityDtoReturn getSpecificEntityVersion(String entityType, String entityId, long version) {
CosmosContainer container = cosmosInit.getEntityContainer(entityType);
String id = String.format("%s_%s", entityId, version);
Optional<CosmosEntity> res = CosmosFacade.findItem(container, id, entityId, CosmosEntity.class);
if (res == null || !res.isPresent())
String id = Common.buildId(entityId, version);
CosmosEntity res = CosmosdbFacade.findSpecificItem(container, id, entityId);
if (res == null)
return null;
return res.get().ToEntityDtoReturn();
return res.ToEntityDtoReturn();
}
@Override
public List<Long> getEntityVersionNumbers(String entityType, String entityId) {
CosmosContainer container = cosmosInit.getEntityContainer(entityType);
List<Long> res = CosmosFacade.findVersions(container, entityId);
List<Long> res = CosmosdbFacade.findVersions(container, entityId);
return res;
}
......@@ -84,7 +83,7 @@ public class CosmosEntityClient implements IEntityDBClient {
public long deleteEntity(String entityType, String entityId) {
CosmosContainer container = cosmosInit.getEntityContainer(entityType);
int cnt = CosmosFacade.deleteEntity(container, entityId);
int cnt = CosmosdbFacade.deleteEntity(container, entityId);
return cnt;
}
......@@ -92,7 +91,7 @@ public class CosmosEntityClient implements IEntityDBClient {
public long purgeEntity(String entityType, String entityId) {
CosmosContainer container = cosmosInit.getEntityContainer(entityType);
int cnt = CosmosFacade.purgeEntity(container, entityId, entityId);
int cnt = CosmosdbFacade.purgeEntity(container, entityId, entityId);
return cnt;
}
......@@ -100,8 +99,8 @@ public class CosmosEntityClient implements IEntityDBClient {
public long deleteEntityVersion(String entityType, String entityId, long version) {