Commit 2def90b2 authored by Diego Molteni's avatar Diego Molteni
Browse files

Merge branch 'master' into slb/dm3/code-check-typos

parents 2f5dc23b 3acf2ee9
Pipeline #67678 failed with stages
in 11 minutes and 19 seconds
# ============================================================================
# Copyright 2017-2021, Schlumberger
#
# 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.
# ============================================================================
# IDE configurations
.vscode
\ No newline at end of file
variables:
OSDU_GCP_HELM_PACKAGE_CHARTS: "devops/gcp/deploy devops/gcp/configmap"
include:
# pipeline logic
- project: "osdu/platform/ci-cd-pipelines"
file: "standard-setup.yml"
- project: "osdu/platform/ci-cd-pipelines"
file: "cloud-providers/osdu-gcp-global.yml"
# app
# sdms
- local: "app/sdms/.gitlab-ci.yml"
- local: "app/sdms/.gitlab-ci.yml"
\ No newline at end of file
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
echo "2)"
echo "Validating commit message syntax"
cd ./app/sdms && npx --no-install commitlint --edit $1
echo "-------------------------------------------------------"
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx scan-for-secrets src
\ No newline at end of file
echo "-------------------------------------------------------"
echo "1)"
echo "scans for the inclusion of AWS keys"
cd ./app/sdms && npx scan-for-secrets src
echo "-------------------------------------------------------"
......@@ -7,7 +7,7 @@ AFL-3.0
========================================================================
The following software have components provided under the terms of this license:
- json-schema (from http://github.com/kriszyp/json-schema)
- json-schema (from https://www.npmjs.com/package/json-schema)
========================================================================
Apache-2.0
......@@ -175,7 +175,7 @@ The following software have components provided under the terms of this license:
- google-gax (from https://www.npmjs.com/package/google-gax)
- idna (from https://github.com/kjd/idna)
- ieee754 (from https://www.npmjs.com/package/ieee754)
- json-schema (from http://github.com/kriszyp/json-schema)
- json-schema (from https://www.npmjs.com/package/json-schema)
- node-forge (from https://www.npmjs.com/package/node-forge)
- node-forge (from https://www.npmjs.com/package/node-forge)
- node-pre-gyp (from https://www.npmjs.com/package/node-pre-gyp)
......@@ -603,10 +603,10 @@ The following software have components provided under the terms of this license:
- isstream (from https://github.com/rvagg/isstream)
- jmespath (from https://github.com/jmespath/jmespath.py)
- jmespath (from https://www.npmjs.com/package/jmespath)
- jsbn (from https://github.com/andyperlitch/jsbn)
- jsbn (from https://www.npmjs.com/package/jsbn)
- json-bigint (from https://www.npmjs.com/package/json-bigint)
- json-bigint (from https://www.npmjs.com/package/json-bigint)
- json-schema (from http://github.com/kriszyp/json-schema)
- json-schema (from https://www.npmjs.com/package/json-schema)
- json-schema-traverse (from https://www.npmjs.com/package/json-schema-traverse)
- json-stringify-safe (from https://github.com/isaacs/json-stringify-safe)
- jsonfile (from https://www.npmjs.com/package/jsonfile)
......@@ -817,7 +817,7 @@ The following software have components provided under the terms of this license:
- tslib (from https://www.npmjs.com/package/tslib)
- tslib (from https://www.npmjs.com/package/tslib)
- tunnel (from https://www.npmjs.com/package/tunnel)
- tweetnacl (from https://dchest.github.io/tweetnacl-js)
- tweetnacl (from https://www.npmjs.com/package/tweetnacl)
- type-fest (from https://www.npmjs.com/package/type-fest)
- type-is (from https://www.npmjs.com/package/type-is)
- typedarray (from https://github.com/substack/typedarray)
......@@ -904,7 +904,7 @@ Unlicense
========================================================================
The following software have components provided under the terms of this license:
- tweetnacl (from https://dchest.github.io/tweetnacl-js)
- tweetnacl (from https://www.npmjs.com/package/tweetnacl)
========================================================================
W3C
......@@ -928,7 +928,7 @@ The following software have components provided under the terms of this license:
- kuler (from https://www.npmjs.com/package/kuler)
- node-forge (from https://www.npmjs.com/package/node-forge)
- node-forge (from https://www.npmjs.com/package/node-forge)
- tweetnacl (from https://dchest.github.io/tweetnacl-js)
- tweetnacl (from https://www.npmjs.com/package/tweetnacl)
========================================================================
unknown
......@@ -938,7 +938,7 @@ The following software have components provided under the terms of this license:
- deep-extend (from https://www.npmjs.com/package/deep-extend)
- for-each (from https://www.npmjs.com/package/for-each)
- jmespath (from https://www.npmjs.com/package/jmespath)
- json-schema (from http://github.com/kriszyp/json-schema)
- json-schema (from https://www.npmjs.com/package/json-schema)
- querystring (from https://www.npmjs.com/package/querystring)
- sax (from https://www.npmjs.com/package/sax)
......
module.exports = {
extends: ["@commitlint/config-conventional"],
helpUrl: "Commits need to follow coventional commits syntax https://www.conventionalcommits.org/en/v1.0.0/#summary",
};
......@@ -42,6 +42,34 @@ variables:
OSDU_GCP_DES_SERVICE_HOST_COMPLIANCE: https://community.osdu-gcp.go3-nrg.projects.epam.com/api
OSDU_GCP_DES_SERVICE_HOST_STORAGE: https://os-storage-attcrcktoa-uc.a.run.app/api
OSDU_GCP_ENV_VARS: CLOUDPROVIDER=${OSDU_GCP_CLOUD_PROVIDER},DES_SERVICE_HOST_PARTITION=${OSDU_GCP_PARTITION_API},ENTITLEMENT_BASE_URL_PATH=${OSDU_GCP_ENTITLEMENT_BASE_URL_PATH},DATA_PARTITION_REST_HEADER_KEY=${OSDU_GCP_DATA_PARTITION_REST_HEADER_KEY},DES_SERVICE_HOST_STORAGE=${OSDU_GCP_DES_SERVICE_HOST_STORAGE},DES_SERVICE_HOST_COMPLIANCE=${OSDU_GCP_DES_SERVICE_HOST_COMPLIANCE},SEISTORE_DES_TARGET_AUDIENCE=${GOOGLE_AUDIENCE},SERVICE_CLOUD_PROJECT=${OSDU_GCP_PROJECT},APP_ENVIRONMENT_IDENTIFIER=${TENANT},IMP_SERVICE_ACCOUNT_SIGNER=${OSDU_GCP_IMP_SERVICE_ACCOUNT_SIGNER},DES_SERVICE_HOST_ENTITLEMENT=${OSDU_GCP_ENTITLEMENTS_V2_BASE_URL},SEISTORE_DES_APPKEY=${OSDU_GCP_SEISTORE_DES_APPKEY},DES_REDIS_INSTANCE_ADDRESS=${OSDU_GCP_DES_REDIS_INSTANCE_ADDRESS},DES_REDIS_INSTANCE_PORT=${OSDU_GCP_DES_REDIS_INSTANCE_PORT},LOCKSMAP_REDIS_INSTANCE_ADDRESS=${OSDU_GCP_LOCKSMAP_REDIS_INSTANCE_ADDRESS},LOCKSMAP_REDIS_INSTANCE_PORT=${OSDU_GCP_LOCKSMAP_REDIS_INSTANCE_PORT} --vpc-connector=$OSDU_GCP_VPC_CONNECTOR
OSDU_GCP_HELM_PACKAGE_CHARTS: "app/sdms/devops/gcp/deploy app/sdms/devops/gcp/configmap"
sdms_osdu-gcp-helm-charts:
stage: build
tags: ['osdu-small']
image:
name: alpine/helm:3.5.4
entrypoint: [""]
artifacts:
paths:
- helm-charts
script:
- mkdir -p helm-charts
- helm package $OSDU_GCP_HELM_PACKAGE_CHARTS --destination helm-charts
- helm repo index --url "${CI_SERVER_URL}/${CI_PROJECT_PATH}/-/jobs/${CI_JOB_ID}/artifacts/raw" .
- mv index.yaml helm-charts
only:
variables:
- $GCP == 'true'
- $OSDU_GCP == 'true'
- $OSDU_GCP_HELM_PACKAGE_CHARTS
changes:
- devops/**/*
- app/sdms/**/*
refs:
- branches
- main
- merge_requests
sdms_push_runtime_image_gcp:
image: gcr.io/google.com/cloudsdktool/cloud-sdk
......
This diff is collapsed.
......@@ -20,7 +20,8 @@
"test-lcov-coverage": "env UTEST=true nyc mocha -r ts-node/register -r source-map-support/register --recursive -R mocha-bamboo-reporter tests/utest/test.ts",
"test-e2e-parallel": "node ./tests/e2e/parallel/run_e2e_tests_parallel.js",
"copy-static-files": "copyfiles --error --up 1 ./docs/api/openapi.osdu.yaml ./dist/docs",
"postbuild": "npm run copy-static-files"
"postbuild": "npm run copy-static-files",
"prepare": "cd ../.. && husky install ./app/sdms/.husky"
},
"nyc": {
"include": [
......@@ -97,6 +98,8 @@
"yargs-parser": "^18.1.3"
},
"devDependencies": {
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@types/bull": "^3.14.4",
"@types/chai": "4.2.9",
"@types/cors": "^2.8.6",
......@@ -131,8 +134,8 @@
"nyc": "^15.0.0",
"path": "^0.12.7",
"redis-mock": "^0.49.0",
"sinon": "8.1.1",
"scan-for-secrets": "^2.0.3",
"sinon": "8.1.1",
"source-map-support": "^0.5.19",
"ts-node": "^9.1.1",
"tslint": "6.0.0",
......@@ -140,7 +143,7 @@
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
"path": "./app/sdms/node_modules/cz-conventional-changelog"
}
}
}
}
\ No newline at end of file
......@@ -223,11 +223,10 @@ export class SubProjectHandler {
// get the subproject metadata
const subproject = await SubProjectDAO.get(journalClient, tenant.name, req.params.subprojectid);
// Only tenant admins are allowed to delete the subproject
// Only subproject admins are allowed to delete the subproject
if (FeatureFlags.isEnabled(Feature.AUTHORIZATION)) {
await Auth.isUserAuthorized(
req.headers.authorization, [AuthGroups.datalakeUserAdminGroupEmail(tenant.esd)],
tenant.esd, req[Config.DE_FORWARD_APPKEY]);
await Auth.isWriteAuthorized(req.headers.authorization, subproject.acls.admins,
tenant, subproject.name, req[Config.DE_FORWARD_APPKEY], undefined);
}
const storage = StorageFactory.build(Config.CLOUDPROVIDER, tenant);
......
......@@ -16,7 +16,6 @@
import { Datastore } from '@google-cloud/datastore';
import { Request as expRequest, Response as expResponse } from 'express';
import sinon from 'sinon';
import { Auth, AuthGroups } from '../../../src/auth';
import { Config, google, StorageFactory } from '../../../src/cloud';
import { ISeistore, SeistoreFactory } from '../../../src/cloud/seistore';
......@@ -29,6 +28,7 @@ import { TenantDAO, TenantModel } from '../../../src/services/tenant';
import { Response } from '../../../src/shared';
import { Tx } from '../utils';
import sinon from 'sinon';
export class TestSubProjectSVC {
......@@ -253,7 +253,7 @@ export class TestSubProjectSVC {
Config.CLOUDPROVIDER = 'google';
this.sandbox.stub(SubProjectDAO, 'delete').resolves();
this.sandbox.stub(DatasetDAO, 'deleteAll').resolves();
this.sandbox.stub(Auth, 'isUserAuthorized').resolves();
this.sandbox.stub(Auth, 'isWriteAuthorized').resolves();
this.sandbox.stub(Auth, 'isImpersonationToken').returns(false);
const storage: IStorage = {
async deleteFiles() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment