Skip to content

Commit

Permalink
Merge pull request #231 from ckm007/MOSIP-34233-develop
Browse files Browse the repository at this point in the history
[MOSIP-34233]
  • Loading branch information
ckm007 authored Jul 18, 2024
2 parents e23ea4c + a27bcfa commit 666091a
Show file tree
Hide file tree
Showing 22 changed files with 1,209 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/chart-lint-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Validate / Publish helm charts

on:
release:
types: [published]
pull_request:
types: [opened, reopened, synchronize]
paths:
- 'helm/**'
workflow_dispatch:
inputs:
IGNORE_CHARTS:
description: 'Provide list of charts to be ignored separated by pipe(|)'
required: false
default: '""'
type: string
CHART_PUBLISH:
description: 'Chart publishing to gh-pages branch'
required: false
default: 'NO'
type: string
options:
- YES
- NO
INCLUDE_ALL_CHARTS:
description: 'Include all charts for Linting/Publishing (YES/NO)'
required: false
default: 'NO'
type: string
options:
- YES
- NO
push:
branches:
- '!release-branch'
- '!master'
- 1.*
- 0.*
- develop
- release*
paths:
- 'helm/**'

jobs:
chart-lint-publish:
uses: mosip/kattu/.github/workflows/chart-lint-publish.yml@master
with:
CHARTS_DIR: ./helm
CHARTS_URL: https://mosip.github.io/mosip-helm
REPOSITORY: mosip-helm
BRANCH: gh-pages
INCLUDE_ALL_CHARTS: "${{ inputs.INCLUDE_ALL_CHARTS || 'NO' }}"
IGNORE_CHARTS: "${{ inputs.IGNORE_CHARTS || '\"\"' }}"
CHART_PUBLISH: "${{ inputs.CHART_PUBLISH || 'YES' }}"
LINTING_CHART_SCHEMA_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/chart-schema.yaml"
LINTING_LINTCONF_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/lintconf.yaml"
LINTING_CHART_TESTING_CONFIG_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/chart-testing-config.yaml"
LINTING_HEALTH_CHECK_SCHEMA_YAML_URL: "https://raw.githubusercontent.com/mosip/kattu/master/.github/helm-lint-configs/health-check-schema.yaml"
DEPENDENCIES: "mosip,https://mosip.github.io/mosip-helm;"
secrets:
TOKEN: ${{ secrets.ACTION_PAT }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
9 changes: 9 additions & 0 deletions deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# MOSIP Print Service

## Introduction
This is reference (sample) print service that will need to be customized for a specific installation.

## Install
```sh
./install.sh
```
39 changes: 39 additions & 0 deletions deploy/certs_upload/postman/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Print partner Cert Upload (_Work-in-progress_)

The folder here contains Postman Collection to upload Print partner certs.

## Prerequisites
Install Postman (browser or command line). The command line version is called `newman`.

## Run
* Inspect `env.json` for any changes in default params.
* Run on command line
```sh
newman run collection.json -e env.json --env-var 'url=https://xxx.yyy.zzz' --env-var 'admin-client-secret=xxxxxxxxxxxx'
```

output:

```
┌─────────────────────────┬─────────────────────┬─────────────────────┐
│ │ executed │ failed │
├─────────────────────────┼─────────────────────┼─────────────────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼─────────────────────┼─────────────────────┤
│ requests │ 3 │ 0 │
├─────────────────────────┼─────────────────────┼─────────────────────┤
│ test-scripts │ 3 │ 0 │
├─────────────────────────┼─────────────────────┼─────────────────────┤
│ prerequest-scripts │ 3 │ 0 │
├─────────────────────────┼─────────────────────┼─────────────────────┤
│ assertions │ 3 │ 0 │
├─────────────────────────┴─────────────────────┴─────────────────────┤
│ total run duration: 2s │
├─────────────────────────────────────────────────────────────────────┤
│ total data received: 1.88KB (approx) │
├─────────────────────────────────────────────────────────────────────┤
│ average response time: 640ms [min: 245ms, max: 1058ms, s.d.: 332ms] │
└─────────────────────────────────────────────────────────────────────┘
```
188 changes: 188 additions & 0 deletions deploy/certs_upload/postman/collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
{
"info": {
"_postman_id": "23349659-902f-40e5-abcf-031b95a1860a",
"name": "Automated Cert Upload for Print",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Authentication",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"postman.setGlobalVariable('requesttime', (new Date()).toISOString());"
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Clientid and Token combination has been validated successfully\", function () {\r",
" pm.expect(pm.response.text()).to.include(\"Clientid and Token combination had been validated successfully\");\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": \"string\",\r\n \"metadata\": {},\r\n \"request\": {\r\n \"appId\": \"ida\",\r\n \"clientId\": \"mosip-admin-client\",\r\n \"secretKey\": \"{{admin-client-secret}}\"\r\n },\r\n \"requesttime\": \"{{requesttime}}\",\r\n \"version\": \"string\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}/v1/authmanager/authenticate/clientidsecretkey",
"host": [
"{{url}}"
],
"path": [
"v1",
"authmanager",
"authenticate",
"clientidsecretkey"
]
}
},
"response": []
},
{
"name": "POST print CA certificate",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"postman.setGlobalVariable('requesttime', (new Date()).toISOString());"
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"\r",
"var jsonData = JSON.parse(responseBody);\r",
"var jsonData = JSON.stringify(jsonData.errors);\r",
"if (jsonData==\"[]\"){\r",
" pm.test(\"Posted Print-Rootcert\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.errors).to.eql([]);\r",
" });\r",
"}\r",
"else{\r",
" pm.test(\"Certificate already exists in DB\", function () {\r",
" pm.expect(pm.response.text()).to.include(\"Certificate already exists \");\r",
" });\r",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": \"string\",\r\n \"metadata\": {},\r\n \"request\": {\r\n \"certificateData\": \"-----BEGIN CERTIFICATE-----\\nMIIDFTCCAf2gAwIBAgIEG6DiGjANBgkqhkiG9w0BAQsFADA7MQswCQYDVQQGEwJJ\\nTjELMAkGA1UECBMCS0ExDTALBgNVBAoTBElJVEIxEDAOBgNVBAMTB1JPT1QtQ0Ew\\nHhcNMjEwMzE2MTIyNTIxWhcNMjQwMzE1MTIyNTIxWjA7MQswCQYDVQQGEwJJTjEL\\nMAkGA1UECBMCS0ExDTALBgNVBAoTBElJVEIxEDAOBgNVBAMTB1JPT1QtQ0EwggEi\\nMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC5CXtlh1auztC/rDJDzNojowau\\ny+etRWmlAFtnXllV287MWdYIg4hGOaPA3QAqcwxj1JdV7OX57SkWse33uWiCfkoi\\n9HmOpXrJTsMxrGWUnW1Fs+ZhNLrQbtX8K4kODtrDeqov8ylOxVixeSVDwMXho/+D\\nvH7UjYH4o3ch4LkObXC/4sogeHsYTTK+UDpwPmBsYFAu3b+dzTPP+LEmXcb0Gd3Q\\nCEdOUdebJchrk4ap+1BJWAVGN0yFedJmj/Rtv3PNhecc37oKn9iN+zjPhetLKKnq\\n2CKaim4NKH3YiNhE+QgRyBhW9tmw9l38YNQDxMo74DShr1gb8PXv/MffToJzAgMB\\nAAGjITAfMB0GA1UdDgQWBBT/ESM8XxLIsUs1bHaPj3tjMo3rzzANBgkqhkiG9w0B\\nAQsFAAOCAQEAUutt5AL/I0UpG0FfVF9dsZAMlRYRqWxCYlhOPKrInfEZAGQUez85\\nHHOlD0saYpypvIx9h8zH4ndotnalloGs1/rKuze/MiPdIRKu7ltcNe+OwQNd5dqB\\nhfzC5RLJnpShcmjq7w6eq3RfQMiDgMenLqlY1a+1mVMWB00ha/EcqbwizkuSr/AM\\nbB/GlOTmWQFyUEGHN536ALnX7zs+56kVm3BUzK+qcSfCD20v815HXEl8DoRgxoPD\\nwxJviKzXwb19qabhMGOGD3lqr2pByxqnJF/fgyoeH8GqoH3pLEmwlrMVc8yYP0Rc\\nZYSu5nQaIN2ZCvEDpdD3ieUpE653CfRFPQ==\\n-----END CERTIFICATE-----\",\r\n \"partnerDomain\": \"Auth\"\r\n },\r\n \"requesttime\": \"{{requesttime}}\",\r\n \"version\": \"string\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}/v1/partnermanager/partners/certificate/ca/upload",
"host": [
"{{url}}"
],
"path": [
"v1",
"partnermanager",
"partners",
"certificate",
"ca",
"upload"
]
}
},
"response": []
},
{
"name": "POST print partner certificate",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"postman.setGlobalVariable('requesttime', (new Date()).toISOString());"
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);\r",
"var jsonData = JSON.stringify(jsonData.errors);\r",
"console.log(jsonData);\r",
"if (jsonData==\"[]\")\r",
"{\r",
" pm.test(\"Posted Print-partner-cert\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.errors).to.eql([]);\r",
"});}\r",
"else\r",
"{\r",
"pm.test(\"Certificate already exists in DB\", function () {\r",
" pm.expect(pm.response.text()).to.include(\"Certificate already exists \");\r",
"});\r",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"id\": \"string\",\r\n \"metadata\": {},\r\n \"request\": {\r\n \"certificateData\": \"-----BEGIN CERTIFICATE-----\\nMIIDPTCCAiWgAwIBAgIEWUs5tjANBgkqhkiG9w0BAQsFADA7MQswCQYDVQQGEwJJ\\nTjELMAkGA1UECBMCS0ExDTALBgNVBAoTBElJVEIxEDAOBgNVBAMTB1JPT1QtQ0Ew\\nHhcNMjEwMzE2MTIyNzM4WhcNMjIwMzE2MTIyNzM4WjBCMQswCQYDVQQGEwJJTjEL\\nMAkGA1UECBMCS0ExDTALBgNVBAoTBElJVEIxFzAVBgNVBAMTDlNpZ25lZC1QYXJ0\\nbmVyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6LVFKcOPnadipOOZ\\nVgA8nhaJos8CUGTqwjk4AF6gK3SY5f6W+wcuQR2SM8Q4K0MC1P5HLjdvXgYyoUAW\\nfAid98P15AdqihP9cM1ZhB+zGqyZc3nmfjJ4sstRRgbhEfgLI41uYEPaO6GXnZkN\\ndhSf5343VoNwQTTI1gpoc8XqT7w4naqaA4H+KR31a6lhnpUCoUHtfZxH+5cRXSv8\\n7Ul/qTCO9HG1zM3PIrVnod8e610AbPKJXf9RAMeZsnbXWm5EIilzwUJaleP6Bsbx\\np+9aTgImi4LA484eaS4AS9FExil/zWQrXr0Prox8u/Eenjt65Rt0iXwq0V0dJu6I\\nHNLRhQIDAQABo0IwQDAdBgNVHQ4EFgQUvv1XjfOlkamCtykSyo7uowL4OeswHwYD\\nVR0jBBgwFoAU/xEjPF8SyLFLNWx2j497YzKN688wDQYJKoZIhvcNAQELBQADggEB\\nAEl6BGIP2agU3fGBVGP+Hp1ANROa9A3tBCTo3Uggw+YoVqwuod852Da6K531owQh\\nyHWKt8VTVOVl/la/YyKDasgyuJ4pvSruN8YMgJBVPu7iIpBpfVrG7pE9//bzER+X\\nqB1StxLa0f05ZFFU5iWOixG14a/YYsqhauOtTtzwuMXHYyrtdCFx8VZRjqM40myw\\nhq7EvBxv/pbnaLKs8YUipSV1HNyvb8xej/Gx0abGMQHB3hJ/kNVilKx7ntkx33cJ\\nEHSlF+YbhEmc1mNG6D5Pr/l1YVOxOAH4Fa/fMDtGtTOuIKEDHwOJIvFNId4SPdJE\\nq26q8M+7WyNPU1l77eDPVzc=\\n-----END CERTIFICATE-----\",\r\n \"partnerDomain\": \"Auth\",\r\n \"partnerId\": \"mpartner-default-print\"\r\n \r\n },\r\n \"requesttime\": \"{{requesttime}}\",\r\n \"version\": \"string\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}/v1/partnermanager/partners/certificate/upload",
"host": [
"{{url}}"
],
"path": [
"v1",
"partnermanager",
"partners",
"certificate",
"upload"
]
}
},
"response": []
}
]
}
8 changes: 8 additions & 0 deletions deploy/certs_upload/postman/env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "ac9da169-14fc-4bb0-b347-eb29fb13f354",
"name": "Automated Cert Upload for Print",
"values": [],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2021-11-10T14:03:14.673Z",
"_postman_exported_using": "Postman/8.12.5"
}
27 changes: 27 additions & 0 deletions deploy/copy_cm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
# Copy configmaps from other namespaces
# DST_NS: Destination (current) namespace

function copying_cm() {
UTIL_URL=https://github.com/mosip/mosip-infra/blob/master/deployment/v3/utils/copy_cm_func.sh
COPY_UTIL=./copy_cm_func.sh
DST_NS=print

wget -q $UTIL_URL -O copy_cm_func.sh && chmod +x copy_cm_func.sh

$COPY_UTIL configmap global default $DST_NS
$COPY_UTIL configmap artifactory-share artifactory $DST_NS
$COPY_UTIL configmap config-server-share config-server $DST_NS
return 0
}

# set commands for error handling.
set -e
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errtrace # trace ERR through 'time command' and other functions
set -o pipefail # trace ERR through pipes
copying_cm # calling function



30 changes: 30 additions & 0 deletions deploy/delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# Uninstalls print service
## Usage: ./delete.sh [kubeconfig]

if [ $# -ge 1 ] ; then
export KUBECONFIG=$1
fi

function deleting_print() {
NS=print
while true; do
read -p "Are you sure you want to delete print helm chart?(Y/n) " yn
if [ $yn = "Y" ]
then
helm -n $NS delete print-service
break
else
break
fi
done
return 0
}

# set commands for error handling.
set -e
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errtrace # trace ERR through 'time command' and other functions
set -o pipefail # trace ERR through pipes
deleting_print # calling function
Loading

0 comments on commit 666091a

Please sign in to comment.