Commit 3d2811c1fd45b060fce254c1896d3fe208004a10

Authored by George Vlahavas
1 parent 9dd3231129

Remove deployment

This should be ran after KEA is deployed. No need to bring down the
running instance for redeploying this way.

Showing 1 changed file with 4 additions and 78 deletions

keycloak_test.groovy View file @ 3d2811c
... ... @@ -10,87 +10,16 @@
10 10 agent any
11 11  
12 12 environment {
13   - // Keep as is the following two lines
14   - PRIVATE_REGISTRY = "https://registry.curex-project.eu:443/curex-local/"
15   - ARTIFACTORY_URL = "registry.curex-project.eu:443/curex-local/"
16   -
17   - HOST_IP = "116.203.166.220"
18   - DEPLOYMENT_HOST = "${HOST_IP}:2376"
19   - DEPLOYMENT_HOST_CREDENTIALS = "vm2-creds"
20 13  
21   - // KEA specific
22   - APP_NAME = "KEA"
23   - APP_ENV = "production"
24   - APP_DEBUG = "true"
25 14 APP_URL = "https://kea.curex-project.eu"
  15 + KEYCLOAK_URL = "https://keycloak-curex.gnubila.fr/auth/realms/Integration/protocol/openid-connect/token"
  16 + USER = credentials('keycloak-test-user')
  17 + PASSWORD = credentials('keycloak-test-password')
26 18  
27   - KIBANA_PORT = "5601"
28   - GRAFANA_PORT = "3000"
29   -
30   - LOG_CHANNEL = "stack"
31   -
32   - DB_CONNECTION = "pgsql"
33   - DB_HOST = "timescaledb"
34   - DB_PORT = "5432"
35   - DB_DATABASE = "kea"
36   - DB_USERNAME = "postgres"
37   - DB_PASSWORD = "postgres"
38   -
39   - BROADCAST_DRIVER = "log"
40   - CACHE_DRIVER = "file"
41   - QUEUE_CONNECTION = "sync"
42   - SESSION_DRIVER = "file"
43   - SESSION_LIFETIME = "120"
44   -
45   - JWT_TTL = "1440"
46   -
47   - ELASTICSEARCH_HOST = "elasticsearch"
48   - ELASTICSEARCH_PORT = "9200"
49   - ELASTICSEARCH_SCHEME = "http"
50   -
51   - MQTT_HOST = "mosquitto"
52   - MQTT_PORT = "1883"
53   - MQTT_DEBUG = "false"
54   - MQTT_QOS = "0"
55   - MQTT_RETAIN = "0"
56   -
57   - MLTD_HOST = "mltd"
58   - MLTD_PORT = "5000"
59   - OD_HOST = "od"
60   - OD_PORT = "9091"
61   -
62   - KEYCLOAK_REALM_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg9OruW+gRnBcm4S1da+TDj7LdDXTFykExlg2z5Fx/vv4ldJf1/vCAEdSP/HZXRMq5TRefnkzVyv66COmjyPjGNB2P240HOOzBPnU5ibsu7H2betZvR+uj/y9o5T3hUpPy+Gbb02i57xoKyECy+yRtPjmF63R0rFfFBV/LdScWdnltTY7YfmRe6dRcBZG5QZ8bKTWP40QUzwG2PnJpIEi3KdYp4qDx4LvXnSvIC0Z6E59R2oialMKQtPO5Xu9Ea6fYe4guqX9zdpoC+bcvxjJ275zj+RoFVaQHhGBZDPeK4VITmXiUWkBbTGQwEVY8ZY4b62kWFwjOg9yOv47s6N7cQIDAQAB"
63   - KEYCLOAK_LOAD_USER_FROM_DATABASE = "false"
64   - KEYCLOAK_USER_PROVIDER_CREDENTIAL = "name"
65   - KEYCLOAK_TOKEN_PRINCIPAL_ATTRIBUTE = "preferred_username"
66   - KEYCLOAK_APPEND_DECODED_TOKEN = "false"
67   - KEYCLOAK_ALLOWED_RESOURCES = "account"
68   -
69   - AUTH_ENABLED = "true"
70 19 }
71 20  
72 21 stages {
73 22  
74   - stage('Checkout the source code') {
75   - steps {
76   - checkout scm
77   - }
78   - }
79   -
80   -
81   - stage('Deploy Docker containers in DEV server') {
82   - steps {
83   - script {
84   - docker.withServer("$DEPLOYMENT_HOST", "$DEPLOYMENT_HOST_CREDENTIALS") {
85   - docker.withRegistry("$PRIVATE_REGISTRY" , 'artifactory') {
86   - echo 'Deploying the specified Docker containers in DEV server'
87   - sh 'sh deploy_hetzner.sh'
88   - }
89   - }
90   - }
91   - }
92   - }
93   -
94 23 stage('Run tests') {
95 24 steps {
96 25 script {
... ... @@ -108,10 +37,7 @@
108 37 }
109 38  
110 39 testName = "KEA_keycloak_success"
111   - String keycloakURL = "https://keycloak-curex.gnubila.fr/auth/realms/Integration/protocol/openid-connect/token"
112   - String user = credentials('keycloak-test-user')
113   - String password = credentials('keycloak-test-password')
114   - String token = sh(label: "KEA_keycloak_token", script: "curl -s -X POST $keycloakURL -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=$user' -d 'password=$password' -d 'grant_type=password' -d 'client_id=KEA' | sed 's/.*access_token\":\"//g' | sed 's/\".*//g'", returnStdout: true)
  40 + String token = sh(label: "KEA_keycloak_token", script: "curl -s -X POST $KEYCLOAK_URL -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=$USER' -d 'password=$PASSWORD' -d 'grant_type=password' -d 'client_id=KEA' | sed 's/.*access_token\":\"//g' | sed 's/\".*//g'", returnStdout: true)
115 41 responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url -o /dev/null", returnStdout: true)
116 42 if ( responseCode != '401' ) {
117 43 error("$testName: Returned status code = $responseCode when calling $url")