Commit 516a152d authored by Aliaksandr Lubouski (EPAM)'s avatar Aliaksandr Lubouski (EPAM) 🥑
Browse files

GONRG-3216-bootstrap: schema service bootstrap job added

parent 17738732
Pipeline #63955 failed with stages
in 107 minutes and 36 seconds
FROM google/cloud-sdk:slim
COPY ./devops/gcp/bootstrap-osdu-module/bootstrap_schema.sh /opt
COPY ./deployments /opt/
RUN chmod 775 /opt/bootstrap_schema.sh
RUN pip3 install -r /opt/scripts/requirements.txt && pip3 install -r /opt/scripts/gcp-deployment-requirements.txt
CMD ["/bin/bash", "-c", "source /opt/bootstrap_schema.sh"]
## Prerequisites
* create workload identity gke service account (it is mandatory that bootstrap script will be running from SA)
* kubernetes job should be create in namespace that is free from istio-injection (job will be in RUNNING state indefenetly with side-car container)
* set all required ENV variables, they are listed in job.yml under env directive
## Verify
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 contains python script which executes clean-up on Datastore to prevent incorect bootstrap for schema service.
After execution of bootstrap-script, you could go to **GCP console** and look for logs under `Kubernetes Engine -> Workloads -> bootstrap-schema pod`
Successful execution will lead to similar output (disclaimer: output could be different due to changes at python3 bootstrap scripts)
```
The kind osdu:wks:work-product-component--WellboreTrajectory:1.0.0 was registered successfully.
Try POST for id: osdu:wks:work-product-component--WellboreTrajectory:1.1.0
The kind osdu:wks:work-product-component--WellboreTrajectory:1.1.0 was registered successfully.
Try POST for id: osdu:wks:reference-data--WellboreTrajectoryType:1.0.0
The kind osdu:wks:reference-data--WellboreTrajectoryType:1.0.0 was registered successfully.
Try POST for id: osdu:wks:reference-data--WordFormatType:1.0.0
The kind osdu:wks:reference-data--WordFormatType:1.0.0 was registered successfully.
Try POST for id: osdu:wks:work-product--WorkProduct:1.0.0
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
set -ex
export BEARER_TOKEN=`gcloud auth print-identity-token --audiences=${AUDIENCES}`
echo "Clean-up for Datastore schemas"
python3 /opt/scripts/GcpDatastoreCleanUp.py
sleep 5
echo "Bootstrap Schema Service"
python3 /opt/scripts/DeploySharedSchemas.py -u ${SCHEMA_URL}/api/schema-service/v1/schema
......@@ -22,3 +22,24 @@ osdu-gcp-test:
only:
variables:
- $OSDU_GCP == 'true'
containerize_osdu_gcp_schema_bootstrap:
stage: containerize
image: docker:19.03.15
tags: ["osdu-medium"]
services:
- docker:20.10.7-dind
script:
- export EXTRA_DOCKER_TAG=""; if [ "$CI_COMMIT_TAG" != "" ] ; then EXTRA_DOCKER_TAG="-t $CI_REGISTRY_IMAGE/osdu-gcp-bootstrap:$CI_COMMIT_TAG" ; elif [ "$CI_COMMIT_REF_NAME" = "master" ] ; then EXTRA_DOCKER_TAG="-t $CI_REGISTRY_IMAGE/osdu-gcp-bootstrap:latest" ; fi
- docker build -t $CI_REGISTRY_IMAGE/osdu-gcp-bootstrap:$CI_COMMIT_SHORT_SHA $EXTRA_DOCKER_TAG --file devops/$OSDU_GCP_VENDOR/bootstrap-osdu-module/Dockerfile .
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE/osdu-gcp-bootstrap
only:
refs:
- master
- /.*bootstrap.*/
- tags
variables:
- $OSDU_GCP == 'true'
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