Commit a4179787 authored by Luc Yriarte's avatar Luc Yriarte
Browse files

Merge branch 'GONRG-2066_release_wellbore_pipe_k8s' into 'master'

Resolve: Gonrg 2066 release wellbore pipe k8s

See merge request !61
parents 0ab17f23 6570bed1
Pipeline #35727 failed
......@@ -15,15 +15,6 @@
variables:
PIP_REQUIREMENTS: "requirements.txt requirements_dev.txt"
OSDU_GCP_APPLICATION_NAME: wellbore-ddms
OSDU_GCP_VENDOR: gcp
OSDU_GCP_HELM_DEPLOYMENT_DIR: devops/gcp
OSDU_GCP_APPLICATION_HEALTH_URL: https://wddms.osdu-gcp.go3-nrg.projects.epam.com/api/os-wellbore-ddms/healthz
OSDU_GCP_HELM_CHART: wellbore
OSDU_GCP_APPLICATION_NAMESPACE: wellbore
OSDU_GCP_APPLICATION_IMAGE_REPOSITORY: $CI_REGISTRY_IMAGE/gcp-$CI_COMMIT_REF_SLUG
OSDU_GCP_APPLICATION_IMAGE_TAG: $CI_COMMIT_SHA
AZURE_SERVICE: wellbore-ddms
AZURE_DOCKER_SUBDIR: build/Dockerfile
AZURE_TEST_SUBDIR: tests/integration
......@@ -35,6 +26,12 @@ variables:
AWS_TEST_SUBDIR: tests/aws-test/build-aws
AWS_INT_TEST_TYPE: python
OSDU_GCP_PROJECT_NAME: nice-etching-277309
OSDU_GCP_CLUSTER: wb
OSDU_GCP_ZONE: us-central1-c
SERVICE_NAME: wellbore #Must be same as in configmap.yaml (namespace = name)
include:
- project: "osdu/platform/ci-cd-pipelines"
file: "standard-setup.yml"
......@@ -49,22 +46,19 @@ include:
file: "scanners/gitlab-ultimate.yml"
- project: 'osdu/platform/ci-cd-pipelines'
ref: "GONRG-2066_release_common_pipe_k8s"
file: 'cloud-providers/osdu-gcp-stateful-k8s.yml'
- project: 'osdu/platform/ci-cd-pipelines'
file: 'cloud-providers/ibm-wellbore.yml'
- local: "/devops/azure/azure-wellbore.yml"
- project: 'osdu/platform/ci-cd-pipelines'
file: 'cloud-providers/aws.yml'
# --------------------------------------------------------------------------------
containerize:
extends:
- .skipForTriggeringMergeRequests
extends: .skipForTriggeringMergeRequests
stage: containerize
image: docker:19.03
tags: ['osdu-medium']
......@@ -95,13 +89,14 @@ containerize:
osdu-gcp-containerize:
stage: containerize
image: docker:19.03
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE/gcp-$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
cache: {}
tags: [ 'osdu-medium' ]
only:
variables:
- $OSDU_GCP == 'true'
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE/gcp-$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
IMAGE_TAG_COMMUNITY: $CI_REGISTRY_IMAGE/gcp-$CI_COMMIT_REF_SLUG:gcp-community
script:
- echo ---- ---- ---- SYSTEM DEPENDENCIES ---- ---- ----
- apk update
......@@ -118,23 +113,23 @@ osdu-gcp-containerize:
- commit_branch=$commit_id
- echo $commit_branch
- echo ---- ---- BUILD IMAGE
- docker build -t $IMAGE_TAG -t=$CI_REGISTRY_IMAGE:latest --rm . -f ./build/Dockerfile --build-arg PIP_WHEEL_DIR=python-packages --build-arg build_date="$current_utc_date" --build-arg build_number=$commit_id --build-arg commit_id=$commit_id --build-arg build_origin="Gitlab" --build-arg commit_branch=$commit_branch
- docker build -t $IMAGE_TAG -t $IMAGE_TAG_COMMUNITY -t=$CI_REGISTRY_IMAGE:latest --rm . -f ./build/Dockerfile --build-arg PIP_WHEEL_DIR=python-packages --build-arg build_date="$current_utc_date" --build-arg build_number=$commit_id --build-arg commit_id=$commit_id --build-arg build_origin="Gitlab" --build-arg commit_branch=$commit_branch
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- echo ---- ---- PUSH IMAGE
- docker push $IMAGE_TAG
- docker tag $IMAGE_TAG $CI_REGISTRY_IMAGE:gcp-latest
- docker push $CI_REGISTRY_IMAGE:gcp-latest
- docker push $IMAGE_TAG_COMMUNITY
osdu-gcp-containerize-for-release:
stage: containerize
image: docker:19.03
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE/gcp-$CI_COMMIT_REF_SLUG:gcp-$RELEASE
cache: {}
tags: [ 'osdu-medium' ]
only:
variables:
- $OSDU_GCP == 'true' && $RELEASE =~ /(v)(\d+\.)(\d+\.)\w+/i
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE/gcp-$CI_COMMIT_REF_SLUG:gcp-$RELEASE
IMAGE_TAG_RELEASE: $CI_REGISTRY_IMAGE/gcp-$CI_COMMIT_REF_SLUG:gcp-release
script:
- echo ---- ---- ---- SYSTEM DEPENDENCIES ---- ---- ----
- apk update
......@@ -151,15 +146,16 @@ osdu-gcp-containerize-for-release:
- commit_branch=$commit_id
- echo $commit_branch
- echo ---- ---- BUILD IMAGE
- docker build -t $IMAGE_TAG -t=$CI_REGISTRY_IMAGE:latest --rm . -f ./build/Dockerfile --build-arg PIP_WHEEL_DIR=python-packages --build-arg build_date="$current_utc_date" --build-arg build_number=$commit_id --build-arg commit_id=$commit_id --build-arg build_origin="Gitlab" --build-arg commit_branch=$commit_branch
- docker build -t $IMAGE_TAG -t $IMAGE_TAG_RELEASE -t=$CI_REGISTRY_IMAGE:latest --rm . -f ./build/Dockerfile --build-arg PIP_WHEEL_DIR=python-packages --build-arg build_date="$current_utc_date" --build-arg build_number=$commit_id --build-arg commit_id=$commit_id --build-arg build_origin="Gitlab" --build-arg commit_branch=$commit_branch
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- echo ---- ---- PUSH IMAGE
- docker push $IMAGE_TAG
- docker push $IMAGE_TAG_RELEASE
osdu-gcp-test-python:
stage: integration
image: gcr.io/google.com/cloudsdktool/cloud-sdk
allow_failure: false
allow_failure: true
only:
variables:
- $OSDU_GCP == 'true' && $OSDU_GCP_INT_TEST_TYPE == 'python'
......@@ -172,10 +168,16 @@ osdu-gcp-test-python:
- pip install -r requirements.txt
- pip install -r requirements_dev.txt
- cd tests/integration
- gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
- gcloud config set project $OSDU_GCP_PROJECT_NAME
- gcloud container clusters get-credentials $OSDU_GCP_CLUSTER --zone $OSDU_GCP_ZONE --project $OSDU_GCP_PROJECT_NAME
- OSDU_GCP_WELLBORE_DDMS_URL=http://`kubectl get ingress -n $SERVICE_NAME -o jsonpath='{..ingress[*].'ip'}'``kubectl get configmap $SERVICE_NAME -n $SERVICE_NAME -o jsonpath='{.data.'API_URL'}'`
- OSDU_GCP_TENANT=`kubectl get configmap $SERVICE_NAME -n $SERVICE_NAME -o jsonpath='{.data.'TENANT'}'`
- OSDU_GCP_LEGAL_TAG=`kubectl get configmap $SERVICE_NAME -n $SERVICE_NAME -o jsonpath='{.data.'LEGAL_TAG'}'`
- echo $OSDU_GCP_INTEGRATION_TESTER | base64 -d > file.json
- gcloud auth activate-service-account --key-file file.json
- gcloud config set project $OSDU_GCP_PROJECT
- python gen_postman_env.py --token $(gcloud auth print-identity-token) --base_url $OSDU_GCP_WELLBORE_DDMS_URL --cloud_provider $OSDU_GCP_VENDOR --data_partition $OSDU_TENANT --acl_domain $DOMAIN --legal_tag $LEGAL_TAG
- gcloud config set project $OSDU_GCP_PROJECT_NAME
- python gen_postman_env.py --token $(gcloud auth print-identity-token) --base_url $OSDU_GCP_WELLBORE_DDMS_URL --cloud_provider $OSDU_GCP_VENDOR --data_partition $OSDU_GCP_TENANT --acl_domain $DOMAIN --legal_tag $OSDU_GCP_LEGAL_TAG
- pytest ./functional --environment="./generated/postman_environment.json" --filter-tag=basic
osdu-gcp-test:
......
kind: ConfigMap
apiVersion: v1
data:
# System sevice variables
CLOUD_PROVIDER: gcp
OS_WELLBORE_DDMS_DATA_PROJECT_ID: nice-etching-277309
SERVICE_HOST_SEARCH: https://os-search-attcrcktoa-uc.a.run.app/api/search
SERVICE_HOST_STORAGE: https://os-storage-attcrcktoa-uc.a.run.app/api/storage
# Custom variables
IMAGE_NAME: community.opengroup.org:5555/osdu/platform/domain-data-mgmt-services/wellbore/wellbore-domain-services/gcp-trusted-gonrg-2066-release-wellbore-pipe-k8s
IMAGE_TAG: gcp-community
HEALTH_URL: /api/os-wellbore-ddms/healthz
API_URL: /api/os-wellbore-ddms
SERVICE_NAME: wellbore
TENANT: osdu
LEGAL_TAG: osdu-demo-legaltag
DEPLOYMENT_DIR: devops/gcp/osdu-helm
metadata:
name: wellbore
namespace: wellbore
---
kind: Secret
apiVersion: v1
metadata:
name: wellbore
namespace: wellbore
type: Opaque
data:
"key.json": ""
\ No newline at end of file
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
apiVersion: v2
name: gcp
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
{{/*
Expand the name of the chart.
*/}}
{{- define "gcp.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "gcp.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "gcp.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "gcp.labels" -}}
helm.sh/chart: {{ include "gcp.chart" . }}
{{ include "gcp.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "gcp.selectorLabels" -}}
app.kubernetes.io/name: {{ include "gcp.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "gcp.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "gcp.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
#kind: ConfigMap
#apiVersion: v1
#data:
# CLOUD_PROVIDER: gcp
# OS_WELLBORE_DDMS_DATA_PROJECT_ID: {{ .Values.configMap.data.projectId }}
# SERVICE_HOST_STORAGE: {{ .Values.configMap.data.storageEndpoint }}
# SERVICE_HOST_SEARCH: {{ .Values.configMap.data.searchEndpoint }}
#metadata:
# name: {{ .Values.configMap.name }}
# namespace: {{ .Values.namespace }}
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: {{ .Values.namespace }}
name: {{ include "gcp.fullname" . }}
labels:
{{- include "gcp.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "gcp.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "gcp.selectorLabels" . | nindent 8 }}
spec:
volumes:
- name: service-account-key
secret:
secretName: {{ .Values.secret.name }}
containers:
- name: {{ .Chart.Name }}
volumeMounts:
- mountPath: /tmp/key
name: service-account-key
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ .Values.configMap.name }}
env:
- name: OS_WELLBORE_DDMS_DATA_PROJECT_CREDENTIALS
value: /tmp/key/{{ .Values.secret.key }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /api/os-wellbore-ddms/healthz
port: http
readinessProbe:
httpGet:
path: /api/os-wellbore-ddms/healthz
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: {{ include "gcp.fullname" . }}
namespace: {{ .Values.namespace }}
annotations:
kubernetes.io/ingress.class: "gce"
spec:
rules:
- http:
paths:
- path: /*
backend:
serviceName: {{ include "gcp.fullname" . }}
servicePort: 8080
#kind: Secret
#apiVersion: v1
#metadata:
# name: {{ .Values.secret.name }}
# namespace: {{ .Values.namespace }}
#type: Opaque
#data:
# {{ .Values.secret.key | quote }}: {{ .Values.secret.gcpSA | quote }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "gcp.fullname" . }}
namespace: {{ .Values.namespace }}
labels:
{{- include "gcp.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "gcp.selectorLabels" . | nindent 4 }}
# Default values for gcp.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
namespace: wellbore
configMap:
data:
cloudProvider: gcp
projectId: nice-etching-277309
searchEndpoint: https://os-search-attcrcktoa-uc.a.run.app/api/search
storageEndpoint: https://os-storage-attcrcktoa-uc.a.run.app/api/storage
name: wellbore
secret:
name: wellbore
key: "key.json"
gcpSA: "" #ENTER in base64 service-account value
replicaCount: 1
image:
repository: "gcr.io/nice-etching-277309/wellbore-ddms/wellbore-ddms-gcp"
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: "7e6b01b5"
service:
#type: ClusterIP
type: NodePort
port: 8080
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: gcp
# kubernetes.io/tls-acme: "true"
# hosts:
# - host: chart-example.local
# paths: []
# tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 800m
# memory: 512Mi
# requests:
# cpu: 700m
# memory: 512Mi
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