Skip to content
Snippets Groups Projects
Commit 47850eae authored by Oleksandr Kosse (EPAM)'s avatar Oleksandr Kosse (EPAM)
Browse files

Merge branch 'GONRG-9779-Fix-Core-Bootstrap' into 'master'

[GONRG-9779] Add pypi dependencies to core-plus bootstrap

See merge request !677
parents 8cbf7fd7 33dbc763
No related branches found
No related tags found
1 merge request!677[GONRG-9779] Add pypi dependencies to core-plus bootstrap
Pipeline #271166 failed
FROM google/cloud-sdk:alpine
FROM python:3.10.14-alpine3.20
WORKDIR /opt
ENV PIP_BREAK_SYSTEM_PACKAGES 1
......@@ -6,11 +6,9 @@ ENV PIP_BREAK_SYSTEM_PACKAGES 1
COPY ./devops/core-plus/bootstrap-osdu-module/*.sh ./
COPY ./deployments ./
RUN apk update && apk add jq bash py3-pip
RUN pip3 install --upgrade pip && \
pip3 install -r ./scripts/requirements.txt && \
pip3 install -r ./scripts/gc-deployment-requirements.txt && \
pip3 install -r ./scripts/schema-cleaner/requirements.txt
RUN apk update && apk add jq bash py3-pip curl
RUN pip3 install --upgrade pip && \
pip3 install -r ./scripts/requirements.txt
RUN chmod +x /opt/bootstrap_schema.sh
RUN addgroup -g 10001 -S nonroot \
&& adduser -h /opt -G nonroot -S -u 10001 nonroot
......
......@@ -2,10 +2,6 @@
Schema service bootstrap is based on python bootstrap scripts at Schema service repository -> `https://community.opengroup.org/osdu/platform/system/schema-service/-/tree/master/deployments/scripts`.
Boostrap scripts contain python script which executes clean-up in Datastore to prevent incorrect bootstrap for Schema service.
After bootstrap script execution, you can go to **Google Cloud console** and look at logs under `Kubernetes Engine -> Workloads -> schema-bootstrap deployment`.
Successful execution will lead to similar output:
> Note: output might be different due to changes in python3 bootstrap scripts.
......@@ -23,6 +19,3 @@ The kind osdu:wks:work-product--WorkProduct:1.0.0 was registered successfully.
This update took 156.52 seconds.
All 216 schemas registered, updated or left unchanged because of status PUBLISHED.
```
Additionally new **Datastore Entities** should be created:
Go to `Datastore -> Entitites -> Namespace (dataecosystem) -> Kind (schema)`, this kind should be populated with schema records.
#!/usr/bin/env bash
#
# Script that bootstraps schema service using Python scripts, that make requests to schema service
# Contains logic for both Reference and Google Cloud version
#
# Expected environment variables:
# (both environments):
# - DATA_PARTITION
# - SCHEMA_URL
# - ENTITLEMENTS_HOST
# (for Google Cloud):
# - AUDIENCES
# (for Reference):
# - OPENID_PROVIDER_URL
# - OPENID_PROVIDER_CLIENT_ID
# - OPENID_PROVIDER_CLIENT_SECRET
# (with datastore cleanup)
# - SCHEMA_BUCKET
# - DATASTORE_NAMESPACE
# - DATASTORE_KIND
# - ENABLE_CLEANUP
#
set -e
source ./validate-env.sh "DATA_PARTITION"
source ./validate-env.sh "SCHEMA_URL"
source ./validate-env.sh "ENTITLEMENTS_HOST"
source ./validate-env.sh "ENABLE_CLEANUP"
bootstrap_schema_gettoken_onprem() {
......@@ -40,13 +28,6 @@ bootstrap_schema_gettoken_onprem() {
export BEARER_TOKEN="Bearer ${ID_TOKEN}"
}
bootstrap_schema_gettoken_gc() {
BEARER_TOKEN=$(gcloud auth print-identity-token)
export BEARER_TOKEN
}
bootstrap_schema_prechek_env() {
status_code=$(curl --retry 1 --location -globoff --request GET "${ENTITLEMENTS_HOST}/api/entitlements/v2/groups" \
......@@ -68,30 +49,12 @@ bootstrap_schema_deploy_shared_schemas() {
python3 ./scripts/DeploySharedSchemas.py -e -u "${SCHEMA_URL}"/api/schema-service/v1/schemas/system
}
if [ "${ONPREM_ENABLED}" == "true" ]
then
source ./validate-env.sh "OPENID_PROVIDER_URL"
source ./validate-env.sh "OPENID_PROVIDER_CLIENT_ID"
source ./validate-env.sh "OPENID_PROVIDER_CLIENT_SECRET"
# Get credentials for onprem
bootstrap_schema_gettoken_onprem
else
if [ "${ENABLE_CLEANUP}" == "true" ]
then
source ./validate-env.sh "SCHEMA_BUCKET"
source ./validate-env.sh "DATASTORE_NAMESPACE"
source ./validate-env.sh "DATASTORE_KIND"
echo "Started schema cleanup"
python3 ./scripts/schema-cleaner/main.py -u "${SCHEMA_URL}"/api/schema-service/v1/schemas/system
echo "Finished schema cleanup"
fi
# Get credentials for Google Cloud
bootstrap_schema_gettoken_gc
source ./validate-env.sh "OPENID_PROVIDER_URL"
source ./validate-env.sh "OPENID_PROVIDER_CLIENT_ID"
source ./validate-env.sh "OPENID_PROVIDER_CLIENT_SECRET"
fi
# Get credentials for onprem
bootstrap_schema_gettoken_onprem
# Precheck entitlements
bootstrap_schema_prechek_env
......
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