From db5c4a50478a5d6bca8878281209787be8468579 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 3 Sep 2024 13:07:48 +0530 Subject: [PATCH 01/33] MOSIP-35558 Signed-off-by: Jayesh Kharode --- .../io/mosip/testrig/residentui/testcase/ShareMyData.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java index 36c3bd6f..99589140 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java @@ -15,7 +15,7 @@ public void shareMyData() throws Exception { Commons.clickWebelement( driver, By.id("uinservices/sharewithpartner")); - Commons.clickWebelement( driver, By.id("name")); + Commons.clickWebelement( driver, By.id("fullName")); Commons.clickWebelement( driver, By.id("dateOfBirth")); Commons.clickWebelement( driver, By.id("UIN")); Commons.dropdown( driver, By.id("partnerDetails")); @@ -27,13 +27,13 @@ public void shareMyData() throws Exception { Commons.clickWebelement( driver, By.id("dismissBtn")); Commons.clickWebelement( driver, By.id("uinservices/sharewithpartner")); - Commons.clickWebelement( driver, By.id("name")); + Commons.clickWebelement( driver, By.id("fullName")); Commons.clickWebelement( driver, By.id("dateOfBirth")); Commons.clickWebelement( driver, By.id("UIN")); Commons.clickWebelement( driver, By.id("shareBtn")); Commons.clickWebelement( driver, By.id("dismissBtn")); - // without partner name + // without partner fullName Commons.enter( driver, By.id("sharingReasonPlaceholder"), data); Commons.clickWebelement( driver, By.id("shareBtn")); Commons.clickWebelement( driver, By.id("dismissBtn")); @@ -58,7 +58,7 @@ public void shareMyData() throws Exception { Commons.clickWebelement( driver, By.id("dismissBtn")); Commons.clickWebelement( driver, By.id("uinservices/sharewithpartner")); - Commons.clickWebelement( driver, By.id("name")); + Commons.clickWebelement( driver, By.id("fullName")); Commons.clickWebelement( driver, By.id("dateOfBirth")); Commons.clickWebelement( driver, By.id("UIN")); Commons.clickWebelement( driver, By.id("perpetualVID")); From f50241712bf93b8e85f7f3a295a0c29bf177354c Mon Sep 17 00:00:00 2001 From: syed salman <72004356+syedsalman3753@users.noreply.github.com> Date: Tue, 3 Sep 2024 15:59:41 +0530 Subject: [PATCH 02/33] [MOSIP-35558] Updated base image tag Signed-off-by: syed salman <72004356+syedsalman3753@users.noreply.github.com> --- uitest-resident/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uitest-resident/Dockerfile b/uitest-resident/Dockerfile index 458f9801..dd8a738e 100644 --- a/uitest-resident/Dockerfile +++ b/uitest-resident/Dockerfile @@ -1,4 +1,4 @@ -FROM selenium/standalone-chrome:latest +FROM selenium/standalone-chrome:127.0.6533.119 USER root From a2b513c981b957ae6a8fcec2c7818a1a37111bab Mon Sep 17 00:00:00 2001 From: techno-467 Date: Mon, 9 Sep 2024 15:48:39 +0530 Subject: [PATCH 03/33] [MOSIP-35160] Updated URL from https://github.com/mosip/mosip-infra/blob/master/deployment/v3/utils/copy_cm_func.sh to https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh Signed-off-by: techno-467 --- deploy/copy_cm.sh | 2 +- deploy/copy_secrets.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/copy_cm.sh b/deploy/copy_cm.sh index 92a2db2d..fdcb6430 100755 --- a/deploy/copy_cm.sh +++ b/deploy/copy_cm.sh @@ -3,7 +3,7 @@ # DST_NS: Destination namespace function copying_cm() { - UTIL_URL=https://github.com/mosip/mosip-infra/blob/master/deployment/v3/utils/copy_cm_func.sh + UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh COPY_UTIL=./copy_cm_func.sh DST_NS=resident diff --git a/deploy/copy_secrets.sh b/deploy/copy_secrets.sh index 0496d42f..92d4db05 100755 --- a/deploy/copy_secrets.sh +++ b/deploy/copy_secrets.sh @@ -3,7 +3,7 @@ # DST_NS: Destination namespace function copying_secrets() { - UTIL_URL=https://github.com/mosip/mosip-infra/blob/master/deployment/v3/utils/copy_cm_func.sh + UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh COPY_UTIL=./copy_cm_func.sh DST_NS=resident From 97a9bbd4b3252c476a7746fab7f0aaf272dede46 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 10 Sep 2024 14:06:40 +0530 Subject: [PATCH 04/33] MOSIP-35610 Signed-off-by: Jayesh Kharode --- .../residentui/kernel/util/ConfigManager.java | 4 ++++ .../residentui/testcase/LoginTest.java | 2 +- .../residentui/testcase/ShareMyData.java | 20 ++++++++++++++++--- .../testrig/residentui/utility/Commons.java | 15 ++++++++++++-- .../main/resources/config/Kernel.properties | 3 ++- 5 files changed, 37 insertions(+), 7 deletions(-) diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/kernel/util/ConfigManager.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/kernel/util/ConfigManager.java index e24da534..38b9a8d5 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/kernel/util/ConfigManager.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/kernel/util/ConfigManager.java @@ -814,6 +814,10 @@ private static Properties getproperty(String path) { return prop; } + public static String getimagename() { + propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "/config/Kernel.properties"); + return propsKernel.getProperty("image"); + } public static String getAuthDemoServiceUrl() { return ConfigManager.getAuthDemoServiceBaseUrl() + ":" + ConfigManager.getAuthDemoServicePort(); } diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/LoginTest.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/LoginTest.java index 36d5521a..86e06ce1 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/LoginTest.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/LoginTest.java @@ -25,7 +25,7 @@ public static void loginTest() throws Exception { Commons.enter( driver, By.id("Otp_mosip-vid"), TestRunner.perpetualVid); Commons.click( driver, By.id("get_otp")); if(!Commons.isDisplayed(driver, By.id("otp_verify_input"))) { - Commons.wait(60000); + Commons.wait(120000); Commons.click( driver, By.id("get_otp")); } otp = MockSMTPListener.getOtp(externalemail); diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java index 99589140..1bf5a6f3 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/ShareMyData.java @@ -14,8 +14,12 @@ public void shareMyData() throws Exception { LoginTest.loginTest(); Commons.clickWebelement( driver, By.id("uinservices/sharewithpartner")); + try { + Commons.clickWebelement( driver, By.id("fullName")); + }catch(Exception e) { + Commons.clickWebelement( driver, By.id("name")); - Commons.clickWebelement( driver, By.id("fullName")); + } Commons.clickWebelement( driver, By.id("dateOfBirth")); Commons.clickWebelement( driver, By.id("UIN")); Commons.dropdown( driver, By.id("partnerDetails")); @@ -27,7 +31,12 @@ public void shareMyData() throws Exception { Commons.clickWebelement( driver, By.id("dismissBtn")); Commons.clickWebelement( driver, By.id("uinservices/sharewithpartner")); - Commons.clickWebelement( driver, By.id("fullName")); + try { + Commons.clickWebelement( driver, By.id("fullName")); + }catch(Exception e) { + Commons.clickWebelement( driver, By.id("name")); + + } Commons.clickWebelement( driver, By.id("dateOfBirth")); Commons.clickWebelement( driver, By.id("UIN")); Commons.clickWebelement( driver, By.id("shareBtn")); @@ -58,7 +67,12 @@ public void shareMyData() throws Exception { Commons.clickWebelement( driver, By.id("dismissBtn")); Commons.clickWebelement( driver, By.id("uinservices/sharewithpartner")); - Commons.clickWebelement( driver, By.id("fullName")); + try { + Commons.clickWebelement( driver, By.id("fullName")); + }catch(Exception e) { + Commons.clickWebelement( driver, By.id("name")); + + } Commons.clickWebelement( driver, By.id("dateOfBirth")); Commons.clickWebelement( driver, By.id("UIN")); Commons.clickWebelement( driver, By.id("perpetualVID")); diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/Commons.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/Commons.java index 9afee49b..be5ba2f8 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/Commons.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/Commons.java @@ -6,6 +6,7 @@ import java.time.format.DateTimeFormatter; import java.util.NoSuchElementException; import java.util.Random; + import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; @@ -16,6 +17,8 @@ import org.testng.Assert; import org.testng.Reporter; +import io.mosip.testrig.residentui.kernel.util.ConfigManager; + public class Commons extends BaseClass{ private static final Logger logger = Logger.getLogger(Commons.class); @@ -198,22 +201,30 @@ public static void wait(int wait) { public static void assertCheck(By by,String message) throws IOException { try { + if(!ConfigManager.getimagename().equals("0.9.0")) { wait(2000); WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20)); wait.until(ExpectedConditions.presenceOfElementLocated(by)); boolean isDisplayed = Commons.isDisplayed(driver, by); Assert.assertTrue(isDisplayed,message); + } - } catch (AssertionError e) { + }catch (Exception te) { + Reporter.log("

"); + throw te; + + } catch (AssertionError e) { Reporter.log("

"); throw e; } } - + public static void assertCheckString(String text,String message) throws IOException { try { + if(!ConfigManager.getimagename().equals("0.9.0")) { wait(2000); Assert.assertNotNull(text,message); + } } catch (AssertionError e) { Reporter.log("

"); diff --git a/uitest-resident/src/main/resources/config/Kernel.properties b/uitest-resident/src/main/resources/config/Kernel.properties index 722ac332..fec85c14 100644 --- a/uitest-resident/src/main/resources/config/Kernel.properties +++ b/uitest-resident/src/main/resources/config/Kernel.properties @@ -265,4 +265,5 @@ aid=10001100800003920230505043751 postalcode=14080 headless=yes docker=yes -packetUpdateWait=2 \ No newline at end of file +packetUpdateWait=2 +image=develop \ No newline at end of file From e0cd040298dcb4ecd96232c64cbb0bbd56c04d59 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 10 Sep 2024 19:20:50 +0530 Subject: [PATCH 05/33] MOSIP-35610 Signed-off-by: Jayesh Kharode --- .../residentui/kernel/util/ConfigManager.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/kernel/util/ConfigManager.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/kernel/util/ConfigManager.java index 38b9a8d5..356cb1cc 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/kernel/util/ConfigManager.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/kernel/util/ConfigManager.java @@ -123,7 +123,9 @@ public class ConfigManager { private static String PACKET_UTILITY_BASE_URL = "packetUtilityBaseUrl"; private static String Testcases = "residentscenariosToExecute"; + private static String Image = "image"; + private static String image; private static String testcases; private static String pms_client_secret; private static String pms_client_id; @@ -417,6 +419,9 @@ public static void init() { testcases =System.getenv(Testcases) == null ? propsKernel.getProperty(Testcases) : System.getenv(Testcases); propsKernel.setProperty(Testcases, testcases); + + image =System.getenv(Image) == null ? propsKernel.getProperty(Image) : System.getenv(Image); + propsKernel.setProperty(Image, image); } @@ -426,6 +431,10 @@ public static int packetUpdateWait() { return wait; } + public static String getimagename() { + return image; + } + public static String gettestcases() { return testcases; } @@ -814,10 +823,7 @@ private static Properties getproperty(String path) { return prop; } - public static String getimagename() { - propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "/config/Kernel.properties"); - return propsKernel.getProperty("image"); - } + public static String getAuthDemoServiceUrl() { return ConfigManager.getAuthDemoServiceBaseUrl() + ":" + ConfigManager.getAuthDemoServicePort(); } From c14ee775f49150c16d38f48a5e2e9ade07cbc801 Mon Sep 17 00:00:00 2001 From: Mohanraj209 Date: Thu, 19 Sep 2024 13:00:11 +0530 Subject: [PATCH 06/33] [MOSIP-35421] Added values.yaml file for resident uitestrig Signed-off-by: Mohanraj209 --- deploy/resident-uitestrig/README.md | 10 ++++++++++ deploy/resident-uitestrig/values.yaml | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100644 deploy/resident-uitestrig/README.md create mode 100644 deploy/resident-uitestrig/values.yaml diff --git a/deploy/resident-uitestrig/README.md b/deploy/resident-uitestrig/README.md new file mode 100644 index 00000000..71b4e7df --- /dev/null +++ b/deploy/resident-uitestrig/README.md @@ -0,0 +1,10 @@ +# RESIDENT UITESTRIG + +This directory contains `values.yaml` file which contains the latest resident uitestrig release changes with latest released Docker image and tag. + +## TL;DR + +```console +$ helm repo add mosip https://mosip.github.io +$ helm install my-release mosip/uitestrig -f values.yaml +``` diff --git a/deploy/resident-uitestrig/values.yaml b/deploy/resident-uitestrig/values.yaml new file mode 100644 index 00000000..9e02676b --- /dev/null +++ b/deploy/resident-uitestrig/values.yaml @@ -0,0 +1,7 @@ +modules: + - name: residentui + enabled: true + image: + registry: docker.io + repository: mosipqa/residenttest + tag: develop From 98f08cdd382d637bc7e681f32148ea9fef6ccaab Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 19 Sep 2024 17:04:51 +0530 Subject: [PATCH 07/33] MOSIP-35896 Signed-off-by: Jayesh Kharode --- .../residentui/fw/util/AdminTestUtil.java | 40 +++++++++++++++++++ .../residentui/testcase/UpdateMyData.java | 8 +++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java index 95845a16..2c4b5c63 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java @@ -9,6 +9,7 @@ import java.util.Calendar; import java.util.Date; import java.util.HashMap; +import java.util.Map; import java.util.TimeZone; import javax.ws.rs.core.MediaType; @@ -41,6 +42,9 @@ public class AdminTestUtil extends BaseTestCase { public static String propsHealthCheckURL = TestRunner.getResourcePath() + "/" + "config/healthCheckEndpoint.properties"; private static String serverComponentsCommitDetails; + private static final Map actuatorValueCache = new HashMap<>(); + public static JSONArray authActuatorResponseArray = null; + public static String getUnUsedUIN(String role){ return JsonPrecondtion @@ -379,4 +383,40 @@ public static void closeFileReader(FileReader fileReader) { } } } + + public static String getValueFromAuthActuator(String section, String key) { + String url = ApplnURI + propsKernel.getProperty("actuatorIDAEndpoint"); + String actuatorCacheKey = url + section + key; + String value = actuatorValueCache.get(actuatorCacheKey); + if (value != null && !value.isEmpty()) + return value; + try { + if (authActuatorResponseArray == null) { + Response response = null; + JSONObject responseJson = null; + response = RestClient.getRequest(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON); + + responseJson = new JSONObject(response.getBody().asString()); + authActuatorResponseArray = responseJson.getJSONArray("propertySources"); + } + + for (int i = 0, size = authActuatorResponseArray.length(); i < size; i++) { + JSONObject eachJson = authActuatorResponseArray.getJSONObject(i); + if (eachJson.get("name").toString().contains(section)) { + value = eachJson.getJSONObject(GlobalConstants.PROPERTIES).getJSONObject(key) + .get(GlobalConstants.VALUE).toString(); + if (ConfigManager.IsDebugEnabled()) + logger.info("Actuator: " + url + " key: " + key + " value: " + value); + break; + } + } + actuatorValueCache.put(actuatorCacheKey, value); + + return value; + } catch (Exception e) { + logger.error(GlobalConstants.EXCEPTION_STRING_2 + e); + return value; + } + + } } \ No newline at end of file diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/UpdateMyData.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/UpdateMyData.java index b0bd1029..1c990eee 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/UpdateMyData.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/UpdateMyData.java @@ -4,6 +4,7 @@ import org.openqa.selenium.By; import org.testng.annotations.Test; +import io.mosip.testrig.residentui.fw.util.AdminTestUtil; import io.mosip.testrig.residentui.kernel.util.ConfigManager; import io.mosip.testrig.residentui.utility.BaseClass; import io.mosip.testrig.residentui.utility.Commons; @@ -18,7 +19,12 @@ public void updateMyDataName() throws Exception { Commons.wait(ConfigManager.packetUpdateWait()*60000); LoginTest.loginTest(); Commons.clickWebelement( driver, By.id("uinservices/updatedemographic")); - Commons.enter( driver, By.id("fullName"+BaseClass.envsupportlang()), Commons.generateRandomAlphabetString()); + String name = AdminTestUtil.getValueFromAuthActuator("json-property", "name"); + name = name.replace("[", "").replace("]", "").replace("\"", ""); + String[] names=name.split(","); + for(String Name:names) { + Commons.enter( driver, By.id(Name+BaseClass.envsupportlang()), Commons.generateRandomAlphabetString()); + } Commons.dropdown( driver, By.id("gender")); Commons.enter( driver, By.id("proofOfIdentityvalue"), data); Commons.dropdown( driver, By.id("proofOfIdentity")); From 73b73cb101197c33eaa33ad27c35b53f9a9cfc36 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 24 Sep 2024 17:01:53 +0530 Subject: [PATCH 08/33] MOSIP-35988 Signed-off-by: Jayesh Kharode --- .../mosip/testrig/residentui/testcase/LoginTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/LoginTest.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/LoginTest.java index 86e06ce1..54cdcd9c 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/LoginTest.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/testcase/LoginTest.java @@ -13,10 +13,11 @@ @Test(groups = "LG") public class LoginTest extends BaseClass { - + public static int run=0; @Test(priority = 0) public static void loginTest() throws Exception { + String envPath = ConfigManager.getiam_residentportal_path(); String otp = ""; String externalemail = ConfigManager.getexternalemail(); driver.get(envPath); @@ -36,13 +37,14 @@ public static void loginTest() throws Exception { } Commons.click( driver, By.id("verify_otp")); Commons.wait(2000); - if(Commons.isDisplayed(driver, By.id("dismissBtn"))) - Commons.click(driver, By.id("dismissBtn")); - else { + if(run==0) { Commons.click(driver, By.id("authorize_scope")); Commons.click(driver, By.id("voluntary_claims")); Commons.click(driver, By.id("continue")); Commons.click(driver, By.id("dismissBtn")); + run=1; + }else if(run==1) { + Commons.click(driver, By.id("dismissBtn")); } Commons.assertCheck(By.id("uinservices/viewhistory"),"verify if uin services login using perpetual vid"); From 874a1201453ea8ab6aa2b31508644748bcc9ed66 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Wed, 25 Sep 2024 16:19:49 +0530 Subject: [PATCH 09/33] MOSIP-36024 Signed-off-by: Jayesh Kharode --- uitest-resident/pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/uitest-resident/pom.xml b/uitest-resident/pom.xml index 5031d61e..ba6e4b80 100644 --- a/uitest-resident/pom.xml +++ b/uitest-resident/pom.xml @@ -1,10 +1,10 @@ 4.0.0 io.mosip.test - residentui - 1.2.1 - resident-ui-automation - resident-ui-automation + uitest-resident + 1.2.1-SNAPSHOT + uitest-resident + Parent project of uitest-resident https://github.com/mosip/resident-ui From a0fba0bb82c4cc17f7c3444dafac9add96d10df9 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Wed, 25 Sep 2024 18:33:52 +0530 Subject: [PATCH 10/33] MOSIP-33383 Signed-off-by: Jayesh Kharode --- .github/workflows/push-trigger.yml | 16 +- uitest-resident/pom.xml | 558 ++++++------------ .../residentui/utility/EmailableReport.java | 79 ++- .../residentui/utility/TestRunner.java | 2 +- 4 files changed, 254 insertions(+), 401 deletions(-) diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index 8b0001f0..7e585a57 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -67,7 +67,7 @@ jobs: ORG_KEY: ${{ secrets.ORG_KEY }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} build-maven-uitest-resident: - uses: mosip/kattu/.github/workflows/maven-build.yml@master + uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21 with: SERVICE_LOCATION: ./uitest-resident BUILD_ARTIFACT: uitest-resident @@ -87,12 +87,12 @@ jobs: SERVICE_LOCATION: uitest-resident BUILD_ARTIFACT: uitest-resident-local steps: - - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v1 + - uses: actions/checkout@v3 + - name: Set up JDK 21 + uses: actions/setup-java@v3 with: - ref: ${{ github.ref }} - java-version: 11 + distribution: 'temurin' + java-version: 21 server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file @@ -146,7 +146,7 @@ jobs: BUILD_ARTIFACT: 'uitest-resident-local' fail-fast: false name: ${{ matrix.SERVICE_NAME }} - uses: mosip/kattu/.github/workflows/docker-build.yml@master + uses: mosip/kattu/.github/workflows/docker-build.yml@master-java21 with: SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} SERVICE_NAME: ${{ matrix.SERVICE_NAME }} @@ -172,7 +172,7 @@ jobs: sonar_analysis_uitest-resident: needs: build-uitest-resident-local if: "${{ github.event_name != 'pull_request' }}" - uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master + uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21 with: SERVICE_LOCATION: uitest-resident SONAR_URL: 'https://sonarcloud.io' diff --git a/uitest-resident/pom.xml b/uitest-resident/pom.xml index ba6e4b80..2581b360 100644 --- a/uitest-resident/pom.xml +++ b/uitest-resident/pom.xml @@ -29,148 +29,9 @@ - - UTF-8 - - - 11 - 11 - 3.7.0 - 3.0.2 - 3.1.0 - 2.9 - 0.8.1 - 3.2 - 3.0.1 - 2.3 - true - 3.7.0.1746 - - 2.0.2.RELEASE - 2.0.7.RELEASE - 5.0.5.RELEASE - 2.0.0.RELEASE - - 2.0.7 - 1.5.20 - 2.9.2 - - 3.6.2 - 3.7.0 - - - - 1.2 - 3.0.0 - 1.3 - 2.2 - 2.0.1.Final - 2.2.6 - - - 1.4.197 - 5.1.46 - 42.2.2 - 2.5.0 - 6.0.12.Final - - - 1.10.19 - 1.7.4 - 2.0.0-beta.5 - - - 1.2.3 - 1.7.19 - 2.16.0 - 1.7.25 - - - 2.9.5 - 20180130 - 2.2.10 - 20180130 - - - 3.6.1 - 3.7 - 2.6 - 1.11 - 4.3 + 31.1-jre + 7.10.1 1.9.2 - 2.2 - 4.5.6 - 19.0 - 1.18.8 - 0.1.54 - 1.4.0 - 7.1.0 - 2.0.0 - 5.5.13 - 2.3.23 - 1.7 - 2.0 - 1.5.2 - 2.1.1 - 1.60 - 63.1 - 1.0.0 - 3.3.3 - 2.8.1 - 4.1.0-incubating - 1.11.368 - 0.2.4 - 2.3.0 - 3.0.1 - 1.9.12 - 0.6.0 - 2.0.0.AM2 - - - - - - - - 0.8.2 - 2.2 - 3.2 - UTF-8 - 3.7.0 - 3.0.1 - - - 1.1.6 - 1.7.19 - 1.10.19 - - - 1.4.6 - - - 5.0.6.RELEASE - - - 5.4.2.Final - - - 2.1.1 - - - 10.13.1.1 - - - 3.4.0 - - - 1.3.5 - - - 0.3.12 - - - 0.3.0 - 1.1.2-incubating 1.2.0.1-B1 @@ -183,14 +44,189 @@ 6.11 1.13 residentui-1.2.1-SNAPSHOT-jar-with-dependencies - + + + 21 + 21 + 3.8.0 + 3.0.2 + 3.1.0 + 3.7.0.1746 + + + + io.mosip.kernel + kernel-bom + 1.2.1-java21-SNAPSHOT + pom + import + + + + + + + + org.seleniumhq.selenium + selenium-java + + + com.google.guava + guava + + + + + org.json + json + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.amazonaws + aws-java-sdk-s3 + 1.12.470 + + + org.awaitility + awaitility + + + ch.qos.logback + logback-core + + + org.slf4j + slf4j-api + + + ch.qos.logback + logback-classic + + + com.paulhammant + ngwebdriver + 1.1.5 + + + com.aventstack + extentreports + 5.0.9 + + + io.github.bonigarcia + webdrivermanager + 5.1.0 + + + com.google.guava + guava + + + + + commons-io + commons-io + + + org.jboss.resteasy + resteasy-jaxrs + 3.15.0.Final + + + junit + junit + test + + + org.testng + testng + ${testng.version} + + + io.rest-assured + rest-assured + + + org.apache.logging.log4j + log4j-api + + + org.slf4j + slf4j-log4j12 + + + javax.ws.rs + javax.ws.rs-api + 2.1.1 + + + org.keycloak + keycloak-admin-client + 17.0.1 + + + com.google.guava + guava + + + + + commons-beanutils + commons-beanutils + ${commons.beanutils.version} + + + com.googlecode.json-simple + json-simple + + + org.apache.commons + commons-collections4 + + + commons-lang + commons-lang + 2.6 + + + com.google.guava + guava + ${guava.version} + + + org.apache.httpcomponents.client5 + httpclient5 + 5.1.3 + + + org.apache.httpcomponents.core5 + httpcore5 + 5.1.3 + + + com.github.jknack + handlebars + 3.0.0 + + + com.github.mifmif + generex + 1.0.2 + + - - + @@ -219,58 +255,33 @@ 3.0.1 - get-the-git-infos + populate-git-commit-information revision - validate + + true + MM/dd/yyyy HH:mm:ss Z + 8 + true + ${project.build.outputDirectory}/git.properties + - true - ${project.build.outputDirectory}/git.properties - - ^git.build.(time|version)$ - ^git.commit.id.(abbrev|full)$ - - full ${project.basedir}/.git - + org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + ${maven.compiler.version} - 11 - 11 + ${maven.compiler.source} + ${maven.compiler.target} -Dfile.encoding=UTF-8 - org.apache.maven.plugins maven-shade-plugin @@ -283,16 +294,11 @@ ${fileName} - - - - + + io.mosip.testrig.residentui.utility.TestRunner - *:* @@ -320,8 +326,7 @@ - - + @@ -330,7 +335,6 @@ - selenium-tests @@ -400,176 +404,4 @@ - - - - - - - org.seleniumhq.selenium - selenium-java - 4.14.1 - - - - - - org.json - json - 20210307 - - - - - com.fasterxml.jackson.core - jackson-core - 2.12.5 - - - - com.fasterxml.jackson.core - jackson-databind - 2.12.5 - - - com.amazonaws - aws-java-sdk-s3 - 1.12.470 - - - - - org.awaitility - awaitility - 4.0.3 - - - ch.qos.logback - logback-core - 1.2.6 - - - org.slf4j - slf4j-api - 1.7.30 - - - - - ch.qos.logback - logback-classic - 1.2.6 - - - com.paulhammant - ngwebdriver - 1.1.5 - - - - - com.aventstack - extentreports - 5.0.9 - - - - - - io.github.bonigarcia - webdrivermanager - 5.1.0 - - - - org.testng - testng - 7.1.0 - - - - - - commons-io - commons-io - 2.6 - - - - - - org.jboss.resteasy - resteasy-jaxrs - 3.15.0.Final - - - - - - - junit - junit - 3.8.1 - test - - - org.testng - testng - ${testng.version} - - - io.rest-assured - rest-assured - ${rest.assured.version} - - - org.apache.logging.log4j - log4j-api - 2.11.1 - - - org.slf4j - slf4j-log4j12 - 1.6.2 - - - javax.ws.rs - javax.ws.rs-api - 2.1.1 - - - org.json - json - ${json.version} - - - org.keycloak - keycloak-admin-client - 17.0.1 - - - commons-beanutils - commons-beanutils - ${commons.beanutils.version} - - - com.googlecode.json-simple - json-simple - 1.1.1 - - - org.apache.commons - commons-collections4 - ${commons-collections4.version} - - - commons-lang - commons-lang - 2.6 - - - diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java index b09bf9a6..b47a572e 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java @@ -10,6 +10,8 @@ import java.io.PrintWriter; import java.lang.reflect.Field; import java.text.NumberFormat; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; @@ -142,16 +144,12 @@ private String getCommitId() { Properties properties = new Properties(); try (InputStream is = EmailableReport.class.getClassLoader().getResourceAsStream("git.properties")) { properties.load(is); - Process process = Runtime.getRuntime().exec("git rev-parse --abbrev-ref HEAD"); - // Read the output of the command - BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); - String branch = reader.readLine(); return "Commit Id is: " + properties.getProperty("git.commit.id.abbrev") + " & Branch Name is:" - + branch; + + properties.getProperty("git.branch"); - } catch (IOException io) { - logger.error(io.getMessage()); + } catch (IOException e) { + logger.error(e.getMessage()); return ""; } @@ -181,24 +179,31 @@ protected void writeHead() { protected void writeStylesheet() { writer.print(""); + writer.print("table {margin-bottom:10px;border-collapse:collapse;empty-cells:show;width: 100%;}"); + writer.print("th,td {border:1px solid #009;padding:.25em .5em;width: 25%;}"); // Set a fixed width for uniform cell sizes + writer.print("th {vertical-align:bottom}"); + writer.print("td {vertical-align:top}"); + writer.print("table a {font-weight:bold}"); + writer.print(".stripe td {background-color: #E6EBF9}"); + writer.print(".num {text-align:center}"); + writer.print(".orange-bg {background-color: #FFA500}"); + writer.print(".grey-bg {background-color: #808080}"); + writer.print(".thich-orange-bg {background-color: #CC5500}"); + writer.print(".green-bg {background-color: #0A0}"); + writer.print(".attn {background-color: #D00}"); + writer.print(".passedodd td {background-color: #3F3}"); + writer.print(".passedeven td {background-color: #0A0}"); + writer.print(".skippedodd td {background-color: #FFA500}"); + writer.print(".skippedeven td,.stripe {background-color: #FFA500}"); + writer.print(".failedodd td {background-color: #F33}"); + writer.print(".failedeven td,.stripe {background-color: #D00}"); + writer.print(".ignoredodd td {background-color: #808080}"); + writer.print(".ignoredeven td {background-color: #808080}"); + writer.print(".known_issuesodd td {background-color: #CC5500}"); + writer.print(".known_issueseven td {background-color: #CC5500}"); + writer.print(".stacktrace {white-space:pre;font-family:monospace}"); + writer.print(".totop {font-size:85%;text-align:center;border-bottom:2px solid #000}"); + writer.print(""); } protected void writeBody() { @@ -216,7 +221,21 @@ protected void writeDocumentEnd() { protected void writeSuiteSummary() { NumberFormat integerFormat = NumberFormat.getIntegerInstance(); NumberFormat decimalFormat = NumberFormat.getNumberInstance(); - + String formattedDate =null; + LocalDate currentDate = LocalDate.now(); + String branch = null; + + try { + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + formattedDate = currentDate.format(formatter); + Process process = Runtime.getRuntime().exec("git rev-parse --abbrev-ref HEAD"); + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + branch = reader.readLine(); + } + catch (Exception e) { + // TODO: handle exception + } totalPassedTests = 0; totalSkippedTests = 0; totalFailedTests = 0; @@ -226,13 +245,15 @@ protected void writeSuiteSummary() { for (SuiteResult suiteResult : suiteResults) { writer.print(""); - writer.print(Utils.escapeHtml(suiteResult.getSuiteName() + "-" + getCommitId())); - writer.print(""); + writer.print(Utils.escapeHtml(suiteResult.getSuiteName() + " ---- " + "Report Date: " + formattedDate + + " ---- " + "Tested Environment: " + + ConfigManager.getiam_apienvuser().replaceAll(".*?\\.([^\\.]+)\\..*", "$1") + " ---- " + + getCommitId())); writer.print(""); writer.print("
");
 			writer.print(Utils.escapeHtml("Server Component Details " + AdminTestUtil.getServerComponentsDetails()));
 			writer.print("
"); - // writer.print(GlobalConstants.TRTR); + writer.print(""); writer.print(""); // writer.print("Test Suite"); diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/TestRunner.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/TestRunner.java index 925d6da9..3762af14 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/TestRunner.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/TestRunner.java @@ -60,7 +60,7 @@ public static void startTestRunner() throws Exception { TestNG runner = new TestNG(); if(!ConfigManager.gettestcases().equals("")) { XmlSuite suite = new XmlSuite(); - suite.setName("MySuite"); + suite.setName("RESIDENT-UI-AUTOMATION-RUN"); suite.addListener("io.mosip.testrig.residentui.utility.EmailableReport"); XmlClass getInformation = new XmlClass("io.mosip.testrig.residentui.testcase.GetInformation"); From 7c550ac033f152e8564541ffb8e6c826676fc291 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Wed, 25 Sep 2024 22:08:53 +0530 Subject: [PATCH 11/33] MOSIP-36023 Signed-off-by: Jayesh Kharode --- uitest-resident/pom.xml | 2 +- .../residentui/fw/util/AdminTestUtil.java | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/uitest-resident/pom.xml b/uitest-resident/pom.xml index 2581b360..59f4eb10 100644 --- a/uitest-resident/pom.xml +++ b/uitest-resident/pom.xml @@ -60,7 +60,7 @@ io.mosip.kernel kernel-bom - 1.2.1-java21-SNAPSHOT + 1.2.1-SNAPSHOT pom import diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java index 2c4b5c63..8c80b92a 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/fw/util/AdminTestUtil.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.math.BigDecimal; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -121,11 +122,18 @@ public static void genrateCredentialRequest(String rid,String role) { } public static String buildaddIdentityRequestBody(String schemaJson, String uin, String rid) { - org.json.JSONObject schemaresponseJson = new org.json.JSONObject(schemaJson); + JSONObject schemaresponseJson = new JSONObject(schemaJson); - org.json.JSONObject schemaData = (org.json.JSONObject) schemaresponseJson.get("response"); - Double schemaVersion = (Double) schemaData.get("idVersion"); - String schemaJsonData = schemaData.getString("schemaJson"); + JSONObject schemaData = (JSONObject) schemaresponseJson.get("response"); + Double schemaVersion = null; + Object idVersion = schemaData.get("idVersion"); + if (idVersion instanceof BigDecimal) { + schemaVersion = ((BigDecimal) idVersion).doubleValue(); + } else if (idVersion instanceof Double) { + schemaVersion = (Double) idVersion; + } else { + throw new ClassCastException("Unsupported type for idVersion: " + idVersion.getClass().getName()); + } String schemaJsonData = schemaData.getString("schemaJson"); String schemaFile = schemaJsonData.toString(); JSONObject schemaFileJson = new JSONObject(schemaFile); // jObj From ffe08d58523ce060318ffd5481b581256aca7fda Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 26 Sep 2024 11:14:30 +0530 Subject: [PATCH 12/33] MOSIP-36024 Signed-off-by: Jayesh Kharode --- uitest-resident/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uitest-resident/Dockerfile b/uitest-resident/Dockerfile index dd8a738e..458f9801 100644 --- a/uitest-resident/Dockerfile +++ b/uitest-resident/Dockerfile @@ -1,4 +1,4 @@ -FROM selenium/standalone-chrome:127.0.6533.119 +FROM selenium/standalone-chrome:latest USER root From ce80a71efed85d34321f273145e91ac840fac3c2 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Thu, 26 Sep 2024 13:58:15 +0530 Subject: [PATCH 13/33] MOSIP-36024 Signed-off-by: Jayesh Kharode --- uitest-resident/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uitest-resident/pom.xml b/uitest-resident/pom.xml index 59f4eb10..952d6788 100644 --- a/uitest-resident/pom.xml +++ b/uitest-resident/pom.xml @@ -43,7 +43,7 @@ 3.0.7 6.11 1.13 - residentui-1.2.1-SNAPSHOT-jar-with-dependencies + uitest-resident-1.2.1-SNAPSHOT-jar-with-dependencies 21 From a73b05e20ab5b9b77d1161a3415b3c561d35545f Mon Sep 17 00:00:00 2001 From: jayesh12234 <111957576+jayesh12234@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:49:43 +0530 Subject: [PATCH 14/33] Update entrypoint.sh Signed-off-by: jayesh12234 <111957576+jayesh12234@users.noreply.github.com> --- uitest-resident/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uitest-resident/entrypoint.sh b/uitest-resident/entrypoint.sh index 4c67b85d..839850b5 100644 --- a/uitest-resident/entrypoint.sh +++ b/uitest-resident/entrypoint.sh @@ -1,4 +1,4 @@ #!/bin/bash java --version -java -jar residentui-*-jar-with-dependencies.jar +java -jar uitest-resident-*-jar-with-dependencies.jar From 0bca8671e8c294950c64c5815cd8b6f374212ba5 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 27 Sep 2024 13:45:20 +0530 Subject: [PATCH 15/33] MOSIP-33383 Signed-off-by: Jayesh Kharode --- .github/workflows/push-trigger.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index 7e585a57..5a8d3ae6 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -17,14 +17,13 @@ on: - '!release-branch' - release-* - master - - develop - - develop-* + - develop* - 1* - MOSIP* jobs: build-resident-ui: - uses: mosip/kattu/.github/workflows/npm-build.yml@master + uses: mosip/kattu/.github/workflows/npm-build.yml@master-java21 with: SERVICE_LOCATION: ./resident-ui BUILD_ARTIFACT: resident-ui @@ -42,7 +41,7 @@ jobs: BUILD_ARTIFACT: 'resident-ui' fail-fast: false name: ${{ matrix.SERVICE_NAME }} - uses: mosip/kattu/.github/workflows/docker-build.yml@master + uses: mosip/kattu/.github/workflows/docker-build.yml@master-java21 with: SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} SERVICE_NAME: ${{ matrix.SERVICE_NAME }} @@ -57,7 +56,7 @@ jobs: sonar-analysis: needs: build-resident-ui if: "${{ github.event_name != 'pull_request' }}" - uses: mosip/kattu/.github/workflows/npm-sonar-analysis.yml@master + uses: mosip/kattu/.github/workflows/npm-sonar-analysis.yml@master-java21 with: SERVICE_LOCATION: resident-ui SONAR_URL: 'https://sonarcloud.io' @@ -92,7 +91,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: 21 + java-version: '21' server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file From c8ffd7a25bb61726c0ca88dbfeb49e32c0803f33 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 27 Sep 2024 13:52:58 +0530 Subject: [PATCH 16/33] MOSIP-33383 Signed-off-by: Jayesh Kharode --- .github/workflows/push-trigger.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index 5a8d3ae6..fc7eee57 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -23,7 +23,7 @@ on: jobs: build-resident-ui: - uses: mosip/kattu/.github/workflows/npm-build.yml@master-java21 + uses: mosip/kattu/.github/workflows/npm-build.yml@master with: SERVICE_LOCATION: ./resident-ui BUILD_ARTIFACT: resident-ui @@ -41,7 +41,7 @@ jobs: BUILD_ARTIFACT: 'resident-ui' fail-fast: false name: ${{ matrix.SERVICE_NAME }} - uses: mosip/kattu/.github/workflows/docker-build.yml@master-java21 + uses: mosip/kattu/.github/workflows/docker-build.yml@master with: SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} SERVICE_NAME: ${{ matrix.SERVICE_NAME }} @@ -56,7 +56,7 @@ jobs: sonar-analysis: needs: build-resident-ui if: "${{ github.event_name != 'pull_request' }}" - uses: mosip/kattu/.github/workflows/npm-sonar-analysis.yml@master-java21 + uses: mosip/kattu/.github/workflows/npm-sonar-analysis.yml@master with: SERVICE_LOCATION: resident-ui SONAR_URL: 'https://sonarcloud.io' @@ -66,7 +66,7 @@ jobs: ORG_KEY: ${{ secrets.ORG_KEY }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} build-maven-uitest-resident: - uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21 + uses: mosip/kattu/.github/workflows/maven-build.yml@master with: SERVICE_LOCATION: ./uitest-resident BUILD_ARTIFACT: uitest-resident From 56d83ea80561eabcd353b219fd0bf52b4c7bd874 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 27 Sep 2024 13:53:45 +0530 Subject: [PATCH 17/33] MOSIP-33383 Signed-off-by: Jayesh Kharode --- .github/workflows/push-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index fc7eee57..a375b6cb 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -66,7 +66,7 @@ jobs: ORG_KEY: ${{ secrets.ORG_KEY }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} build-maven-uitest-resident: - uses: mosip/kattu/.github/workflows/maven-build.yml@master + uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21 with: SERVICE_LOCATION: ./uitest-resident BUILD_ARTIFACT: uitest-resident From bd9b9375f13eb327a070b64eaaf4228d91e256bd Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Fri, 27 Sep 2024 16:59:29 +0530 Subject: [PATCH 18/33] MOSIP-33383 Signed-off-by: Jayesh Kharode --- uitest-resident/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uitest-resident/Dockerfile b/uitest-resident/Dockerfile index 458f9801..f6fb332d 100644 --- a/uitest-resident/Dockerfile +++ b/uitest-resident/Dockerfile @@ -1,4 +1,4 @@ -FROM selenium/standalone-chrome:latest +FROM syedsalman041997/uitest-resident:selenium-chrome-java17 USER root From 2cacd1e3d2e7dd9981c473ce8355d2ce39a7b986 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Mon, 30 Sep 2024 11:24:28 +0530 Subject: [PATCH 19/33] MOSIP-36166 Signed-off-by: Jayesh Kharode --- uitest-resident/Dockerfile | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/uitest-resident/Dockerfile b/uitest-resident/Dockerfile index f6fb332d..5475b9d4 100644 --- a/uitest-resident/Dockerfile +++ b/uitest-resident/Dockerfile @@ -1,8 +1,18 @@ -FROM syedsalman041997/uitest-resident:selenium-chrome-java17 +# Start with a base image that includes Java 21 +FROM openjdk:21-slim +# Install additional dependencies, such as Selenium, Chrome, and kubectl USER root -# Define build-time arguments +RUN apt-get update && \ + apt-get install -y wget curl unzip xvfb libxi6 libgconf-2-4 chromium chromium-driver + +# Install kubectl +RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \ + chmod +x kubectl && \ + mv kubectl /usr/local/bin/kubectl + +# Define build-time arguments and labels ARG SOURCE ARG COMMIT_HASH ARG COMMIT_ID @@ -23,28 +33,21 @@ ARG container_user_gid=1001 # Set working directory for the user ENV work_dir=/home/${container_user}/ -ARG KUBECTL_VERSION=1.22.9 - -# install packages and create user +# Create a new user with specified permissions RUN groupadd -g ${container_user_gid} ${container_user_group} \ && useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/bash -m ${container_user} -d ${work_dir} \ - && chown -R ${container_user}:${container_user} /home/${container_user}/ \ - && curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \ - && chmod +x kubectl \ - && mv kubectl /usr/local/bin/ + && chown -R ${container_user}:${container_user} /home/${container_user}/ # Switch to the specified user for the subsequent commands USER ${container_user_uid}:${container_user_gid} -# Copy files +# Copy your application files into the container COPY --chown=${container_user_uid}:${container_user} --chmod=771 ./entrypoint.sh ${work_dir}/entrypoint.sh COPY --chown=${container_user}:${container_user} ./src/main/resources/ ${work_dir}/resources/ COPY --chown=${container_user_uid}:${container_user} ./target/*.jar ${work_dir} -# Set working directory +# Set the working directory WORKDIR /home/${container_user}/ - - # Entrypoint for the container ENTRYPOINT ["/bin/bash", "-c", "./entrypoint.sh"] From e8170010486452718d17807e61d6b7d0e623c6e1 Mon Sep 17 00:00:00 2001 From: Rakshithb1 Date: Fri, 18 Oct 2024 12:10:46 +0530 Subject: [PATCH 20/33] [MOSIP-35892] Updated helm charts to add range Signed-off-by: Rakshithb1 --- helm/resident-ui/templates/deployment.yaml | 4 +++- helm/resident-ui/values.yaml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/helm/resident-ui/templates/deployment.yaml b/helm/resident-ui/templates/deployment.yaml index 9855b858..54f0d0d2 100644 --- a/helm/resident-ui/templates/deployment.yaml +++ b/helm/resident-ui/templates/deployment.yaml @@ -105,8 +105,10 @@ spec: {{- end }} {{- end }} {{- if .Values.extraEnvVarsSecret }} + {{- range .Values.extraEnvVarsSecret }} - secretRef: - name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }} + name: {{ . }} + {{- end }} {{- end }} volumeMounts: - name: ui-config diff --git a/helm/resident-ui/values.yaml b/helm/resident-ui/values.yaml index 198bad06..f8e0dc72 100644 --- a/helm/resident-ui/values.yaml +++ b/helm/resident-ui/values.yaml @@ -248,7 +248,7 @@ extraEnvVarsCM: ## Secret with extra environment variables ## -extraEnvVarsSecret: +extraEnvVarsSecret: [] ## Extra volumes to add to the deployment ## From d79f6cb78b7a86ad38d6d1563cd431be36e2ac22 Mon Sep 17 00:00:00 2001 From: Mohan E Date: Wed, 23 Oct 2024 17:48:10 +0530 Subject: [PATCH 21/33] [MOSIP-35421] Moved installtion scripts of resident uitestrig. Signed-off-by: Mohanraj209 --- deploy/copy_cm.sh | 24 ----- deploy/copy_cm_func.sh | 33 +++++++ deploy/copy_secrets.sh | 22 ----- deploy/{ => resident-ui}/README.md | 11 +++ .../certs_upload/postman/README.md | 0 .../certs_upload/postman/collection.json | 0 .../certs_upload/postman/env.json | 0 deploy/{ => resident-ui}/delete.sh | 0 deploy/{ => resident-ui}/install.sh | 10 +- deploy/{ => resident-ui}/restart.sh | 0 deploy/resident-uitestrig/README.md | 34 +++++-- deploy/resident-uitestrig/delete.sh | 30 ++++++ deploy/resident-uitestrig/install.sh | 97 +++++++++++++++++++ 13 files changed, 205 insertions(+), 56 deletions(-) delete mode 100755 deploy/copy_cm.sh create mode 100755 deploy/copy_cm_func.sh delete mode 100755 deploy/copy_secrets.sh rename deploy/{ => resident-ui}/README.md (91%) rename deploy/{ => resident-ui}/certs_upload/postman/README.md (100%) rename deploy/{ => resident-ui}/certs_upload/postman/collection.json (100%) rename deploy/{ => resident-ui}/certs_upload/postman/env.json (100%) rename deploy/{ => resident-ui}/delete.sh (100%) rename deploy/{ => resident-ui}/install.sh (90%) rename deploy/{ => resident-ui}/restart.sh (100%) create mode 100755 deploy/resident-uitestrig/delete.sh create mode 100755 deploy/resident-uitestrig/install.sh diff --git a/deploy/copy_cm.sh b/deploy/copy_cm.sh deleted file mode 100755 index fdcb6430..00000000 --- a/deploy/copy_cm.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copy configmaps from other namespaces -# DST_NS: Destination namespace - -function copying_cm() { - UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh - COPY_UTIL=./copy_cm_func.sh - DST_NS=resident - - 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 diff --git a/deploy/copy_cm_func.sh b/deploy/copy_cm_func.sh new file mode 100755 index 00000000..185ae3e5 --- /dev/null +++ b/deploy/copy_cm_func.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copy configmap and secret from one namespace to another. +# ./copy_cm_func.sh [name] +# Parameters: +# resource: configmap|secret +# name: Optional new name of the configmap or secret in destination namespace. This may be needed if there is +# clash of names + +if [ $1 = "configmap" ] +then + RESOURCE=configmap +elif [ $1 = "secret" ] +then + RESOURCE=secret +else + echo "Incorrect resource $1. Exiting.." + exit 1 +fi + + +if [ $# -ge 5 ] +then + kubectl -n $4 delete --ignore-not-found=true $RESOURCE $5 + kubectl -n $3 get $RESOURCE $2 -o yaml | sed "s/namespace: $3/namespace: $4/g" | sed "s/name: $2/name: $5/g" | kubectl -n $4 create -f - +else + kubectl -n $4 delete --ignore-not-found=true $RESOURCE $2 + kubectl -n $3 get $RESOURCE $2 -o yaml | sed "s/namespace: $3/namespace: $4/g" | kubectl -n $4 create -f - +fi + + + + + diff --git a/deploy/copy_secrets.sh b/deploy/copy_secrets.sh deleted file mode 100755 index 92d4db05..00000000 --- a/deploy/copy_secrets.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Copy secrets from other namespaces -# DST_NS: Destination namespace - -function copying_secrets() { - UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh - COPY_UTIL=./copy_cm_func.sh - DST_NS=resident - - wget -q $UTIL_URL -O copy_cm_func.sh && chmod +x copy_cm_func.sh - - $COPY_UTIL secret keycloak-client-secrets keycloak $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_secrets # calling function diff --git a/deploy/README.md b/deploy/resident-ui/README.md similarity index 91% rename from deploy/README.md rename to deploy/resident-ui/README.md index 2613aa7b..c47e58c4 100644 --- a/deploy/README.md +++ b/deploy/resident-ui/README.md @@ -4,6 +4,17 @@ ```sh ./install.sh ``` + +## Restart +```sh +./restart.sh +``` + +## Delete +```sh +./delete.sh +``` + * During the execution of the `install.sh` script, a prompt appears requesting information regarding the presence of a public domain and a valid SSL certificate on the server. * If the server lacks a public domain and a valid SSL certificate, it is advisable to select the `n` option. Opting it will enable the `init-container` with an `emptyDir` volume and include it in the deployment process. * The init-container will proceed to download the server's self-signed SSL certificate and mount it to the specified location within the container's Java keystore (i.e., `cacerts`) file. diff --git a/deploy/certs_upload/postman/README.md b/deploy/resident-ui/certs_upload/postman/README.md similarity index 100% rename from deploy/certs_upload/postman/README.md rename to deploy/resident-ui/certs_upload/postman/README.md diff --git a/deploy/certs_upload/postman/collection.json b/deploy/resident-ui/certs_upload/postman/collection.json similarity index 100% rename from deploy/certs_upload/postman/collection.json rename to deploy/resident-ui/certs_upload/postman/collection.json diff --git a/deploy/certs_upload/postman/env.json b/deploy/resident-ui/certs_upload/postman/env.json similarity index 100% rename from deploy/certs_upload/postman/env.json rename to deploy/resident-ui/certs_upload/postman/env.json diff --git a/deploy/delete.sh b/deploy/resident-ui/delete.sh similarity index 100% rename from deploy/delete.sh rename to deploy/resident-ui/delete.sh diff --git a/deploy/install.sh b/deploy/resident-ui/install.sh similarity index 90% rename from deploy/install.sh rename to deploy/resident-ui/install.sh index d520f718..5e1a8422 100755 --- a/deploy/install.sh +++ b/deploy/resident-ui/install.sh @@ -8,6 +8,7 @@ fi NS=resident RESIDENT_UI_CHART_VERSION=0.0.1-develop +COPY_UTIL=../copy_cm_func.sh echo Create $NS namespace kubectl create ns $NS @@ -18,12 +19,13 @@ function installing_resident_ui() { helm repo update echo Copy configmaps - sed -i 's/\r$//' copy_cm.sh - ./copy_cm.sh + $COPY_UTIL configmap global default $NS + $COPY_UTIL configmap artifactory-share artifactory $NS + $COPY_UTIL configmap config-server-share config-server $NS echo Copy secrets - sed -i 's/\r$//' copy_secrets.sh - ./copy_secrets.sh + $COPY_UTIL secret keycloak-client-secrets keycloak $NS + echo Setting up dummy values for Resident OIDC Client ID kubectl create secret generic resident-oidc-onboarder-key -n $NS --from-literal=resident-oidc-clientid='' --dry-run=client -o yaml | kubectl apply -f - ./copy_cm_func.sh secret resident-oidc-onboarder-key resident config-server diff --git a/deploy/restart.sh b/deploy/resident-ui/restart.sh similarity index 100% rename from deploy/restart.sh rename to deploy/resident-ui/restart.sh diff --git a/deploy/resident-uitestrig/README.md b/deploy/resident-uitestrig/README.md index 71b4e7df..00b2177f 100644 --- a/deploy/resident-uitestrig/README.md +++ b/deploy/resident-uitestrig/README.md @@ -1,10 +1,32 @@ -# RESIDENT UITESTRIG +# UITESTRIG -This directory contains `values.yaml` file which contains the latest resident uitestrig release changes with latest released Docker image and tag. +## Introduction +UITESTRIG will test end-to-end functional flows involving multiple UI modules. -## TL;DR +## Install +* Install +```sh +./install.sh +``` -```console -$ helm repo add mosip https://mosip.github.io -$ helm install my-release mosip/uitestrig -f values.yaml +## Uninstall +* To uninstall UITESTRIG, run `delete.sh` script. +```sh +./delete.sh ``` + +## Run UITESTRIG manually + +#### CLI +* Download Kubernetes cluster `kubeconfig` file from `rancher dashboard` to your local. +* Install `kubectl` package to your local machine. +* Run UITESTRIG manually via CLI by creating a new job from an existing k8s cronjob. + ``` + kubectl --kubeconfig= -n UITESTRIG create job --from=cronjob/ + ``` + example: + ``` + kubectl --kubeconfig=/home/xxx/Downloads/qa4.config -n UITESTRIG create job --from=cronjob/cronjob-uitestrig cronjob-uitestrig + ``` + + diff --git a/deploy/resident-uitestrig/delete.sh b/deploy/resident-uitestrig/delete.sh new file mode 100755 index 00000000..850ba22b --- /dev/null +++ b/deploy/resident-uitestrig/delete.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Uninstalls uitestrig +## Usage: ./delete.sh [kubeconfig] + +if [ $# -ge 1 ] ; then + export KUBECONFIG=$1 +fi + +function deleting_uitestrig() { + NS=resident + while true; do + read -p "Are you sure you want to delete uitestrig helm charts?(Y/n) " yn + if [ $yn = "Y" ] + then + helm -n $NS delete resident-uitestrig + 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_uitestrig # calling function \ No newline at end of file diff --git a/deploy/resident-uitestrig/install.sh b/deploy/resident-uitestrig/install.sh new file mode 100755 index 00000000..de469b06 --- /dev/null +++ b/deploy/resident-uitestrig/install.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# Installs uitestrig automation +## Usage: ./install.sh [kubeconfig] + +if [ $# -ge 1 ] ; then + export KUBECONFIG=$1 +fi + +NS=resident +CHART_VERSION=0.0.1-develop +COPY_UTIL=../copy_cm_func.sh + +echo Create $NS namespace +kubectl create ns $NS + +function installing_uitestrig() { + ENV_NAME=$( kubectl -n default get cm global -o json |jq -r '.data."installation-domain"') + + read -p "Please enter the time(hr) to run the cronjob every day (time: 0-23) : " time + if [ -z "$time" ]; then + echo "ERROR: Time cannot be empty; EXITING;"; + exit 1; + fi + if ! [ $time -eq $time ] 2>/dev/null; then + echo "ERROR: Time $time is not a number; EXITING;"; + exit 1; + fi + if [ $time -gt 23 ] || [ $time -lt 0 ] ; then + echo "ERROR: Time should be in range ( 0-23 ); EXITING;"; + exit 1; + fi + + echo "Do you have public domain & valid SSL? (Y/n) " + echo "Y: if you have public domain & valid ssl certificate" + echo "n: if you don't have public domain & valid ssl certificate" + read -p "" flag + + if [ -z "$flag" ]; then + echo "'flag' was provided; EXITING;" + exit 1; + fi + ENABLE_INSECURE='' + if [ "$flag" = "n" ]; then + ENABLE_INSECURE='--set uitestrig.configmaps.uitestrig.ENABLE_INSECURE=true'; + fi + + echo Istio label + kubectl label ns $NS istio-injection=disabled --overwrite + helm repo update + + echo Copy configmaps + $COPY_UTIL configmap global default $NS + $COPY_UTIL configmap keycloak-host keycloak $NS + $COPY_UTIL configmap artifactory-share artifactory $NS + $COPY_UTIL configmap config-server-share config-server $NS + + echo Copy secrets + $COPY_UTIL secret keycloak-client-secrets keycloak $NS + $COPY_UTIL secret s3 s3 $NS + $COPY_UTIL secret postgres-postgresql postgres $NS + + DB_HOST=$( kubectl -n default get cm global -o json |jq -r '.data."mosip-api-internal-host"' ) + PMP_HOST=$(kubectl -n default get cm global -o json |jq -r '.data."mosip-pmp-host"') + ADMIN_HOST=$(kubectl -n default get cm global -o json |jq -r '.data."mosip-admin-host"') + RESIDENT_HOST=$(kubectl -n default get cm global -o json |jq -r '.data."mosip-resident-host"') + API_INTERNAL_HOST=$( kubectl -n default get cm global -o json |jq -r '.data."mosip-api-internal-host"' ) + + echo Installing resident uitestrig + helm -n $NS install resident-uitestrig mosip/uitestrig \ + --set crontime="0 $time * * *" \ + -f values.yaml \ + --version $CHART_VERSION \ + --set uitestrig.configmaps.s3.s3-host='http://minio.minio:9000' \ + --set uitestrig.configmaps.s3.s3-user-key='admin' \ + --set uitestrig.configmaps.s3.s3-region='' \ + --set uitestrig.configmaps.db.db-server="$DB_HOST" \ + --set uitestrig.configmaps.db.db-su-user="postgres" \ + --set uitestrig.configmaps.db.db-port="5432" \ + --set uitestrig.configmaps.uitestrig.apiInternalEndPoint="https://$API_INTERNAL_HOST" \ + --set uitestrig.configmaps.uitestrig.apiEnvUser="$API_INTERNAL_HOST" \ + --set uitestrig.configmaps.uitestrig.PmpPortalPath="https://$PMP_HOST" \ + --set uitestrig.configmaps.uitestrig.adminPortalPath="https://$ADMIN_HOST" \ + --set uitestrig.configmaps.uitestrig.residentPortalPath="https://$RESIDENT_HOST" \ + --set uitestrig.configmaps.uitestrig.NS="$NS" \ + $ENABLE_INSECURE + + echo Installed resident uitestrig + 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 +installing_uitestrig # calling function \ No newline at end of file From 6a515b47922382b60c7595347eb759b6439b2a08 Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 29 Oct 2024 13:15:43 +0530 Subject: [PATCH 22/33] MOSIP-36205 Signed-off-by: Jayesh Kharode --- .../io/mosip/testrig/residentui/utility/EmailableReport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java index b47a572e..35234efb 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java @@ -113,7 +113,7 @@ public void generateReport(List xmlSuites, List suites, String boolean isStoreSuccess = false; boolean isStoreSuccess2 = false; try { - isStoreSuccess = s3Adapter.putObject(ConfigManager.getS3Account(), BaseTestCase.testLevel, null, + isStoreSuccess = s3Adapter.putObject(ConfigManager.getS3Account(),System.getProperty("modules"), null, null, newString, newReportFile); logger.info("isStoreSuccess:: " + isStoreSuccess); From f65bc3198a6f7a527c9b5e85a473f9502f5a3f2a Mon Sep 17 00:00:00 2001 From: Jayesh Kharode Date: Tue, 29 Oct 2024 15:40:36 +0530 Subject: [PATCH 23/33] MOSIP-36205 Signed-off-by: Jayesh Kharode --- .../mosip/testrig/residentui/utility/EmailableReport.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java b/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java index 35234efb..1178da8a 100644 --- a/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java +++ b/uitest-resident/src/main/java/io/mosip/testrig/residentui/utility/EmailableReport.java @@ -113,16 +113,10 @@ public void generateReport(List xmlSuites, List suites, String boolean isStoreSuccess = false; boolean isStoreSuccess2 = false; try { - isStoreSuccess = s3Adapter.putObject(ConfigManager.getS3Account(),System.getProperty("modules"), null, + isStoreSuccess = s3Adapter.putObject(ConfigManager.getS3Account(),"Residentui", null, null, newString, newReportFile); logger.info("isStoreSuccess:: " + isStoreSuccess); - /* Need to figure how to handle EXTENT report handling */ - - - - - } catch (Exception e) { logger.error("error occured while pushing the object" + e.getMessage()); } From 37e0c0a1b8c5bd2034f40b7863042c0a8d9c95dc Mon Sep 17 00:00:00 2001 From: MadhuMosip Date: Mon, 4 Nov 2024 15:39:57 +0530 Subject: [PATCH 24/33] MOSIP-34689 added regex validation for email and phone Signed-off-by: MadhuMosip --- .../updatedemographic/updatedemographic.component.html | 8 ++++---- .../updatedemographic/updatedemographic.component.ts | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html index 9046f056..918373c6 100644 --- a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html +++ b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.html @@ -989,9 +989,9 @@

{{'updatedem {{field.labelName[langCode][1]}}
@@ -1000,9 +1000,9 @@

{{'updatedem

diff --git a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts index 4223f97d..b34ea64f 100644 --- a/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts +++ b/resident-ui/src/app/feature/uinservices/updatedemographic/updatedemographic.component.ts @@ -790,14 +790,16 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy { } captureContactValue(event: any, formControlName: any) { - if(event.target.value.length){ + this.userId = event.target.value.trim(); + this.contactTye = formControlName.attributeName; + + if(new RegExp(formControlName.validators[0].validator).test(this.userId)){ this.sendOtpDisable = false; }else{ this.sendOtpDisable = true; } - this.userId = event.target.value.trim(); - this.contactTye = formControlName; - if(formControlName === "email"){ + + if(formControlName.attributeName === "email"){ this.userIdEmail = this.userId }else{ this.userIdPhone = this.userId From 533219372cb4b49af7ec77fd5a9778a4bab2e989 Mon Sep 17 00:00:00 2001 From: MadhuMosip Date: Thu, 7 Nov 2024 14:53:59 +0530 Subject: [PATCH 25/33] MOSIP-37266 Passing lang code in profile API Signed-off-by: MadhuMosip --- resident-ui/src/app/core/services/data-storage.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resident-ui/src/app/core/services/data-storage.service.ts b/resident-ui/src/app/core/services/data-storage.service.ts index 23a3d22d..95d96ea8 100644 --- a/resident-ui/src/app/core/services/data-storage.service.ts +++ b/resident-ui/src/app/core/services/data-storage.service.ts @@ -171,8 +171,8 @@ export class DataStorageService { return this.httpClient.post(this.BASE_URL + '/auth-lock-unlock', request, { observe: 'response'}); } - getProfileInfo(langCode) { - return this.httpClient.get(this.BASE_URL + '/profile'); + getProfileInfo(langCode:any) { + return this.httpClient.get(this.BASE_URL + '/profile' + '?languageCode=' + langCode); } getServiceHistory(request: any, filters: any,pageSize1:any) { From a72af695282473129e149c918ffda01b21799ef5 Mon Sep 17 00:00:00 2001 From: Mahesh-Binayak <76687012+Mahesh-Binayak@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:53:19 +0530 Subject: [PATCH 26/33] Update push-trigger.yml to change kattu version Signed-off-by: Mahesh-Binayak <76687012+Mahesh-Binayak@users.noreply.github.com> --- .github/workflows/push-trigger.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index a375b6cb..098d1b8c 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -56,7 +56,7 @@ jobs: sonar-analysis: needs: build-resident-ui if: "${{ github.event_name != 'pull_request' }}" - uses: mosip/kattu/.github/workflows/npm-sonar-analysis.yml@master + uses: mosip/kattu/.github/workflows/npm-sonar-analysis.yml@develop with: SERVICE_LOCATION: resident-ui SONAR_URL: 'https://sonarcloud.io' @@ -183,4 +183,4 @@ jobs: OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} GPG_SECRET: ${{ secrets.GPG_SECRET }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} From 11639a8cf4f523ede1c27c2c1e623e7079a0a609 Mon Sep 17 00:00:00 2001 From: MadhuMosip Date: Mon, 25 Nov 2024 15:06:42 +0530 Subject: [PATCH 27/33] MOSIP-37782 removed hardcoded language value and displying language dropdown if there is more then one language Signed-off-by: MadhuMosip --- resident-ui/src/app/app-config.service.ts | 140 +++++++++--------- resident-ui/src/app/app.component.ts | 5 +- .../feature/getuin/getuin/getuin.component.ts | 21 +-- .../personalisedcard.component.ts | 2 +- .../feature/verify/verify/verify.component.ts | 2 +- .../app/shared/header/header.component.html | 4 +- .../src/app/shared/header/header.component.ts | 29 ++-- 7 files changed, 91 insertions(+), 112 deletions(-) diff --git a/resident-ui/src/app/app-config.service.ts b/resident-ui/src/app/app-config.service.ts index f99b008f..91538853 100644 --- a/resident-ui/src/app/app-config.service.ts +++ b/resident-ui/src/app/app-config.service.ts @@ -8,76 +8,76 @@ export class AppConfigService { appConfig: any; constructor(public http: HttpClient) { } - async loadAppConfig() { - localStorage.setItem("isDataLoaded", 'false') - this.appConfig = await this.http.get('./assets/config.json').toPromise(); - this.http.get(this.appConfig.baseUrl + '/proxy/config/ui-properties').subscribe( - (response) => { - let responseData = response["response"]; - this.appConfig["supportedLanguages"] = responseData["mosip.mandatory-languages"]+","+responseData["mosip.optional-languages"]; - this.appConfig["mosip.iam.adapter.clientid"] = responseData["mosip.iam.adapter.clientid"]; - this.appConfig["mosip.resident.api.id.otp.request"] = responseData["mosip.resident.api.id.otp.request"]; - this.appConfig["mosip.resident.api.version.otp.request"] = responseData["mosip.resident.api.version.otp.request"]; - this.appConfig["resident.vid.id"] = responseData["resident.vid.id"]; - this.appConfig["resident.vid.version"] = responseData["resident.vid.version"]; - this.appConfig["mosip.resident.request.response.version"] = responseData["mosip.resident.request.response.version"]; - this.appConfig["resident.revokevid.id"] = responseData["resident.revokevid.id"]; - this.appConfig["mosip-prereg-host"] = responseData["mosip-prereg-host"]; - this.appConfig["mosip-prereg-ui-url"] = responseData["mosip-prereg-ui-url"]; - this.appConfig["auth.types.allowed"] = responseData["auth.types.allowed"]; - this.appConfig["resident.view.history.serviceType.filters"] = responseData["resident.view.history.serviceType.filters"]; - this.appConfig["resident.view.history.status.filters"] = responseData["resident.view.history.status.filters"]; - this.appConfig["mosip.resident.grievance.url"] = responseData["mosip.resident.grievance.url"]; - this.appConfig["resident.vid.id.generate"] = responseData["resident.vid.id.generate"]; - this.appConfig["resident.vid.version.new"] = responseData["resident.vid.version.new"]; - this.appConfig["mosip.resident.revokevid.id"] = responseData["mosip.resident.revokevid.id"]; - this.appConfig["resident.revokevid.version.new"] = responseData["resident.revokevid.version.new"]; - this.appConfig["mosip.resident.download.personalized.card.id"] = responseData["mosip.resident.download.personalized.card.id"] - this.appConfig["mosip.resident.download.registration.centre.file.name.convention"] = responseData["mosip.resident.download.registration.centre.file.name.convention"]; - this.appConfig["mosip.resident.download.supporting.document.file.name.convention"] = responseData["mosip.resident.download.supporting.document.file.name.convention"]; - this.appConfig["mosip.resident.download.personalized.card.naming.convention"] = responseData["mosip.resident.download.personalized.card.naming.convention"]; - this.appConfig["mosip.resident.ack.manage_my_vid.name.convention"] = responseData["mosip.resident.ack.manage_my_vid.name.convention"]; - this.appConfig["mosip.resident.ack.secure_my_id.name.convention"] = responseData["mosip.resident.ack.secure_my_id.name.convention"]; - this.appConfig["mosip.resident.ack.personalised_card.name.convention"] = responseData["mosip.resident.ack.personalised_card.name.convention"]; - this.appConfig["mosip.resident.ack.update_my_data.name.convention"] = responseData["mosip.resident.ack.update_my_data.name.convention"]; - this.appConfig["mosip.resident.ack.share_credential.name.convention"] = responseData["mosip.resident.ack.share_credential.name.convention"]; - this.appConfig["mosip.resident.ack.order_physical_card.name.convention"] = responseData["mosip.resident.ack.order_physical_card.name.convention"]; - this.appConfig["mosip.resident.ack.name.convention"] = responseData["mosip.resident.ack.name.convention"]; - this.appConfig["mosip.resident.uin.card.name.convention"] = responseData["mosip.resident.uin.card.name.convention"]; - this.appConfig["mosip.resident.vid.card.name.convention"] = responseData["mosip.resident.vid.card.name.convention"]; - this.appConfig["mosip.resident.download.service.history.file.name.convention"] = responseData["mosip.resident.download.service.history.file.name.convention"]; - this.appConfig["mosip.resident.download.nearest.registration.centre.file.name.convention"] = responseData["mosip.resident.download.nearest.registration.centre.file.name.convention"]; - this.appConfig["resident.nearby.centers.distance.meters"] = responseData["resident.nearby.centers.distance.meters"]; - this.appConfig["mosip.resident.captcha.sitekey"] = responseData["mosip.resident.captcha.sitekey"]; - this.appConfig["mosip.resident.captcha.secretkey"] = responseData["mosip.resident.captcha.secretkey"]; - this.appConfig["mosip.webui.auto.logout.idle"] = responseData["mosip.webui.auto.logout.idle"]; - this.appConfig["mosip.webui.auto.logout.ping"] = responseData["mosip.webui.auto.logout.ping"]; - this.appConfig["mosip.webui.auto.logout.timeout"] = responseData["mosip.webui.auto.logout.timeout"]; - this.appConfig["resident.updateuin.id"] = responseData["resident.updateuin.id"]; - this.appConfig["resident.ui.notification.update.interval.seconds"] = responseData["resident.ui.notification.update.interval.seconds"]; - this.appConfig["mosip.kernel.otp.expiry-time"] = responseData["mosip.kernel.otp.expiry-time"]; - this.appConfig["resident.grievance-redressal.comments.chars.limit"] = responseData["resident.grievance-redressal.comments.chars.limit"]; - this.appConfig["resident.grievance-redressal.alt-email.chars.limit"] = responseData["resident.grievance-redressal.alt-email.chars.limit"]; - this.appConfig["resident.grievance-redressal.alt-phone.chars.limit"] = responseData["resident.grievance-redressal.alt-phone.chars.limit"]; - this.appConfig["resident.validation.event-id.regex"] = responseData["resident.validation.event-id.regex"]; - this.appConfig["resident.purpose.allowed.special.char.regex"] = responseData["resident.purpose.allowed.special.char.regex"]; - this.appConfig["mosip.resident.captcha.enable"] = responseData["mosip.resident.captcha.enable"]; - this.appConfig["mosip.kernel.vid.length"] = responseData["mosip.kernel.vid.length"]; - this.appConfig["mosip.kernel.uin.length"] = responseData["mosip.kernel.uin.length"]; - this.appConfig["mosip.kernel.rid.length"] = responseData["mosip.kernel.rid.length"]; - this.appConfig["mosip.resident.transliteration.transliterate.id"] = responseData["mosip.resident.transliteration.transliterate.id"]; - this.appConfig["resident.contact.details.update.id"] = responseData["resident.contact.details.update.id"]; - this.appConfig["mosip.resident.zoom"] = responseData["mosip.resident.zoom"]; - this.appConfig["mosip.resident.maxZoom"] = responseData["mosip.resident.maxZoom"]; - this.appConfig["mosip.resident.minZoom"] = responseData["mosip.resident.minZoom"]; - this.appConfig["resident.update-uin.machine-zone-code"] = responseData["resident.update-uin.machine-zone-code"]; - this.appConfig["resident-multi-language-enable"] = responseData["resident-multi-language-enable"]; - localStorage.setItem("isDataLoaded", 'true') - }, - (error) => { - console.log(error); - } - ); + async loadAppConfig(): Promise { + try { + // Load local config.json + this.appConfig = await this.http.get('./assets/config.json').toPromise(); + // Load additional config from remote endpoint + const response = await this.http.get(this.appConfig.baseUrl + '/proxy/config/ui-properties').toPromise(); + const responseData = response["response"]; + localStorage.setItem("langCode", responseData["mosip.mandatory-languages"]); + this.appConfig["supportedLanguages"] = responseData["mosip.mandatory-languages"] + ",ara" + ",fra" +","+responseData["mosip.optional-languages"]; + this.appConfig["mosip.iam.adapter.clientid"] = responseData["mosip.iam.adapter.clientid"]; + this.appConfig["mosip.resident.api.id.otp.request"] = responseData["mosip.resident.api.id.otp.request"]; + this.appConfig["mosip.resident.api.version.otp.request"] = responseData["mosip.resident.api.version.otp.request"]; + this.appConfig["resident.vid.id"] = responseData["resident.vid.id"]; + this.appConfig["resident.vid.version"] = responseData["resident.vid.version"]; + this.appConfig["mosip.resident.request.response.version"] = responseData["mosip.resident.request.response.version"]; + this.appConfig["resident.revokevid.id"] = responseData["resident.revokevid.id"]; + this.appConfig["mosip-prereg-host"] = responseData["mosip-prereg-host"]; + this.appConfig["mosip-prereg-ui-url"] = responseData["mosip-prereg-ui-url"]; + this.appConfig["auth.types.allowed"] = responseData["auth.types.allowed"]; + this.appConfig["resident.view.history.serviceType.filters"] = responseData["resident.view.history.serviceType.filters"]; + this.appConfig["resident.view.history.status.filters"] = responseData["resident.view.history.status.filters"]; + this.appConfig["mosip.resident.grievance.url"] = responseData["mosip.resident.grievance.url"]; + this.appConfig["resident.vid.id.generate"] = responseData["resident.vid.id.generate"]; + this.appConfig["resident.vid.version.new"] = responseData["resident.vid.version.new"]; + this.appConfig["mosip.resident.revokevid.id"] = responseData["mosip.resident.revokevid.id"]; + this.appConfig["resident.revokevid.version.new"] = responseData["resident.revokevid.version.new"]; + this.appConfig["mosip.resident.download.personalized.card.id"] = responseData["mosip.resident.download.personalized.card.id"] + this.appConfig["mosip.resident.download.registration.centre.file.name.convention"] = responseData["mosip.resident.download.registration.centre.file.name.convention"]; + this.appConfig["mosip.resident.download.supporting.document.file.name.convention"] = responseData["mosip.resident.download.supporting.document.file.name.convention"]; + this.appConfig["mosip.resident.download.personalized.card.naming.convention"] = responseData["mosip.resident.download.personalized.card.naming.convention"]; + this.appConfig["mosip.resident.ack.manage_my_vid.name.convention"] = responseData["mosip.resident.ack.manage_my_vid.name.convention"]; + this.appConfig["mosip.resident.ack.secure_my_id.name.convention"] = responseData["mosip.resident.ack.secure_my_id.name.convention"]; + this.appConfig["mosip.resident.ack.personalised_card.name.convention"] = responseData["mosip.resident.ack.personalised_card.name.convention"]; + this.appConfig["mosip.resident.ack.update_my_data.name.convention"] = responseData["mosip.resident.ack.update_my_data.name.convention"]; + this.appConfig["mosip.resident.ack.share_credential.name.convention"] = responseData["mosip.resident.ack.share_credential.name.convention"]; + this.appConfig["mosip.resident.ack.order_physical_card.name.convention"] = responseData["mosip.resident.ack.order_physical_card.name.convention"]; + this.appConfig["mosip.resident.ack.name.convention"] = responseData["mosip.resident.ack.name.convention"]; + this.appConfig["mosip.resident.uin.card.name.convention"] = responseData["mosip.resident.uin.card.name.convention"]; + this.appConfig["mosip.resident.vid.card.name.convention"] = responseData["mosip.resident.vid.card.name.convention"]; + this.appConfig["mosip.resident.download.service.history.file.name.convention"] = responseData["mosip.resident.download.service.history.file.name.convention"]; + this.appConfig["mosip.resident.download.nearest.registration.centre.file.name.convention"] = responseData["mosip.resident.download.nearest.registration.centre.file.name.convention"]; + this.appConfig["resident.nearby.centers.distance.meters"] = responseData["resident.nearby.centers.distance.meters"]; + this.appConfig["mosip.resident.captcha.sitekey"] = responseData["mosip.resident.captcha.sitekey"]; + this.appConfig["mosip.resident.captcha.secretkey"] = responseData["mosip.resident.captcha.secretkey"]; + this.appConfig["mosip.webui.auto.logout.idle"] = responseData["mosip.webui.auto.logout.idle"]; + this.appConfig["mosip.webui.auto.logout.ping"] = responseData["mosip.webui.auto.logout.ping"]; + this.appConfig["mosip.webui.auto.logout.timeout"] = responseData["mosip.webui.auto.logout.timeout"]; + this.appConfig["resident.updateuin.id"] = responseData["resident.updateuin.id"]; + this.appConfig["resident.ui.notification.update.interval.seconds"] = responseData["resident.ui.notification.update.interval.seconds"]; + this.appConfig["mosip.kernel.otp.expiry-time"] = responseData["mosip.kernel.otp.expiry-time"]; + this.appConfig["resident.grievance-redressal.comments.chars.limit"] = responseData["resident.grievance-redressal.comments.chars.limit"]; + this.appConfig["resident.grievance-redressal.alt-email.chars.limit"] = responseData["resident.grievance-redressal.alt-email.chars.limit"]; + this.appConfig["resident.grievance-redressal.alt-phone.chars.limit"] = responseData["resident.grievance-redressal.alt-phone.chars.limit"]; + this.appConfig["resident.validation.event-id.regex"] = responseData["resident.validation.event-id.regex"]; + this.appConfig["resident.purpose.allowed.special.char.regex"] = responseData["resident.purpose.allowed.special.char.regex"]; + this.appConfig["mosip.resident.captcha.enable"] = responseData["mosip.resident.captcha.enable"]; + this.appConfig["mosip.kernel.vid.length"] = responseData["mosip.kernel.vid.length"]; + this.appConfig["mosip.kernel.uin.length"] = responseData["mosip.kernel.uin.length"]; + this.appConfig["mosip.kernel.rid.length"] = responseData["mosip.kernel.rid.length"]; + this.appConfig["mosip.resident.transliteration.transliterate.id"] = responseData["mosip.resident.transliteration.transliterate.id"]; + this.appConfig["resident.contact.details.update.id"] = responseData["resident.contact.details.update.id"]; + this.appConfig["mosip.resident.zoom"] = responseData["mosip.resident.zoom"]; + this.appConfig["mosip.resident.maxZoom"] = responseData["mosip.resident.maxZoom"]; + this.appConfig["mosip.resident.minZoom"] = responseData["mosip.resident.minZoom"]; + this.appConfig["resident.update-uin.machine-zone-code"] = responseData["resident.update-uin.machine-zone-code"]; + this.appConfig["mosip.mandatory-languages"] = responseData["mosip.mandatory-languages"]; + } catch (error) { + console.error("Error loading configuration", error); + throw error; + } } getConfig() { diff --git a/resident-ui/src/app/app.component.ts b/resident-ui/src/app/app.component.ts index 40513493..a7b07fab 100644 --- a/resident-ui/src/app/app.component.ts +++ b/resident-ui/src/app/app.component.ts @@ -168,10 +168,7 @@ export class AppComponent { if(window.location.href.includes('error=invalid_transaction')){ this.router.navigate(['error']); } - - if(!localStorage.getItem("langCode")){ - localStorage.setItem("langCode", "eng"); - } + this.subscriptions.push(this.autoLogout.currentMessageAutoLogout.subscribe(() => {})); this.autoLogout.changeMessage({ timerFired: false }); this.routerType(); diff --git a/resident-ui/src/app/feature/getuin/getuin/getuin.component.ts b/resident-ui/src/app/feature/getuin/getuin/getuin.component.ts index bd2e70bb..80450485 100644 --- a/resident-ui/src/app/feature/getuin/getuin/getuin.component.ts +++ b/resident-ui/src/app/feature/getuin/getuin/getuin.component.ts @@ -84,20 +84,13 @@ export class GetuinComponent implements OnInit { } getConfigData(){ - if(localStorage.getItem('isDataLoaded') === 'true'){ - this.siteKey = this.appConfigService.getConfig()["mosip.resident.captcha.sitekey"]; - this.captchaEnable = JSON.parse(this.appConfigService.getConfig()["mosip.resident.captcha.enable"]); - this.vidLength = this.appConfigService.getConfig()["mosip.kernel.vid.length"]; - this.uinLength = this.appConfigService.getConfig()["mosip.kernel.uin.length"]; - this.aidLength = this.appConfigService.getConfig()["mosip.kernel.rid.length"]; - this.getLangData() - this.isLoading = false; - return - }else{ - setTimeout(()=>{ - this.getConfigData() - },500) - } + this.siteKey = this.appConfigService.getConfig()["mosip.resident.captcha.sitekey"]; + this.captchaEnable = JSON.parse(this.appConfigService.getConfig()["mosip.resident.captcha.enable"]); + this.vidLength = this.appConfigService.getConfig()["mosip.kernel.vid.length"]; + this.uinLength = this.appConfigService.getConfig()["mosip.kernel.uin.length"]; + this.aidLength = this.appConfigService.getConfig()["mosip.kernel.rid.length"]; + this.getLangData() + this.isLoading = false; } getLangData(){ diff --git a/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts b/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts index 59a0fefd..d1932151 100644 --- a/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts +++ b/resident-ui/src/app/feature/uinservices/personalisedcard/personalisedcard.component.ts @@ -298,10 +298,10 @@ export class PersonalisedcardComponent implements OnInit, OnDestroy { }) if (type.value === data.attributeName) { - value = this.createDefaultValue(data) data.formatOption[this.langCode].forEach(item => { item.checked = true }) + value = this.createDefaultValue(data); } else { value = this.createCheckedVal(data); this.checkDefaultVal(data, $event); diff --git a/resident-ui/src/app/feature/verify/verify/verify.component.ts b/resident-ui/src/app/feature/verify/verify/verify.component.ts index 0f7909ee..d1ee53d3 100644 --- a/resident-ui/src/app/feature/verify/verify/verify.component.ts +++ b/resident-ui/src/app/feature/verify/verify/verify.component.ts @@ -428,7 +428,7 @@ export class VerifyComponent implements OnInit, OnDestroy { onItemSelected(item: any) { if (item === "home") { this.router.navigate(["dashboard"]); - } else if ("back") { + } else if (item === "back") { this.showOtpPanel = false; this.resetBtnDisable = true; this.submitBtnDisable = true; diff --git a/resident-ui/src/app/shared/header/header.component.html b/resident-ui/src/app/shared/header/header.component.html index 65ee0c92..3a055e04 100644 --- a/resident-ui/src/app/shared/header/header.component.html +++ b/resident-ui/src/app/shared/header/header.component.html @@ -20,13 +20,13 @@ {{item.label}} - + - diff --git a/resident-ui/src/app/shared/header/header.component.ts b/resident-ui/src/app/shared/header/header.component.ts index a2e52b4b..4ad93e34 100644 --- a/resident-ui/src/app/shared/header/header.component.ts +++ b/resident-ui/src/app/shared/header/header.component.ts @@ -78,42 +78,31 @@ export class HeaderComponent implements OnInit, OnDestroy { } getConfigData(){ - if(localStorage.getItem('isDataLoaded') === 'true'){ - let supportedLanguages = this.appConfigService.getConfig()['supportedLanguages'].split(','); - this.showLangDropDown = this.appConfigService.getConfig()['resident-multi-language-enable']; + let allSupportedLanguages = this.appConfigService.getConfig()['supportedLanguages'].split(','); + let uniqueSupportedLanguages = allSupportedLanguages.filter((item, index) => allSupportedLanguages.indexOf(item) === index); + this.showLangDropDown = uniqueSupportedLanguages.length > 1 ? true : false; - if(supportedLanguages.length > 1){ - supportedLanguages.forEach((language) => { + if(uniqueSupportedLanguages.length > 1){ + uniqueSupportedLanguages.forEach((language) => { this.selectLanguagesArr.push({ code: language.trim(), value: defaultJson.languages[language.trim()].nativeName, }); }); } - + this.translateService.use(localStorage.getItem("langCode")); this.textDir = localStorage.getItem("dir"); return - }else{ - setTimeout(()=>{ - this.getConfigData() - },400) - } } - - async ngOnInit() { + async ngOnInit() { + console.log('Header component') this.defaultJsonValue = defaultJson; let self = this; this.getConfigData(); - if(!localStorage.getItem("langCode")){ - localStorage.setItem("langCode", "eng"); - this.selectedLanguage = defaultJson["languages"]['eng'].nativeName; - }else{ - let key = localStorage.getItem("langCode") - this.selectedLanguage = defaultJson["languages"][key].nativeName; - } + this.selectedLanguage = defaultJson["languages"][this.langCode].nativeName; self.getProfileInfo(); await this.translateService From d0261ffce8fc289bf57b5d28eb24565790b44ce7 Mon Sep 17 00:00:00 2001 From: MadhuMosip Date: Mon, 25 Nov 2024 15:20:31 +0530 Subject: [PATCH 28/33] MOSIP-37782 removed log in header component Signed-off-by: MadhuMosip --- resident-ui/src/app/shared/header/header.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/resident-ui/src/app/shared/header/header.component.ts b/resident-ui/src/app/shared/header/header.component.ts index 4ad93e34..d985dfae 100644 --- a/resident-ui/src/app/shared/header/header.component.ts +++ b/resident-ui/src/app/shared/header/header.component.ts @@ -97,7 +97,6 @@ export class HeaderComponent implements OnInit, OnDestroy { } async ngOnInit() { - console.log('Header component') this.defaultJsonValue = defaultJson; let self = this; this.getConfigData(); From ee8dd7b8aff37c57e823e625b0662e5ec57c3c19 Mon Sep 17 00:00:00 2001 From: MadhuMosip Date: Mon, 25 Nov 2024 15:22:18 +0530 Subject: [PATCH 29/33] MOSIP-37782 removed haed coded values Signed-off-by: MadhuMosip --- resident-ui/src/app/app-config.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resident-ui/src/app/app-config.service.ts b/resident-ui/src/app/app-config.service.ts index 91538853..3bad2215 100644 --- a/resident-ui/src/app/app-config.service.ts +++ b/resident-ui/src/app/app-config.service.ts @@ -16,7 +16,7 @@ export class AppConfigService { const response = await this.http.get(this.appConfig.baseUrl + '/proxy/config/ui-properties').toPromise(); const responseData = response["response"]; localStorage.setItem("langCode", responseData["mosip.mandatory-languages"]); - this.appConfig["supportedLanguages"] = responseData["mosip.mandatory-languages"] + ",ara" + ",fra" +","+responseData["mosip.optional-languages"]; + this.appConfig["supportedLanguages"] = responseData["mosip.mandatory-languages"] + ","+ responseData["mosip.optional-languages"]; this.appConfig["mosip.iam.adapter.clientid"] = responseData["mosip.iam.adapter.clientid"]; this.appConfig["mosip.resident.api.id.otp.request"] = responseData["mosip.resident.api.id.otp.request"]; this.appConfig["mosip.resident.api.version.otp.request"] = responseData["mosip.resident.api.version.otp.request"]; From e3b3f32aa6e5722395e2f4ebf9e255ab193a26d1 Mon Sep 17 00:00:00 2001 From: Mohan E Date: Wed, 23 Oct 2024 17:48:10 +0530 Subject: [PATCH 30/33] [MOSIP-35421] Moved installtion scripts of resident uitestrig. Signed-off-by: Mohanraj209 Signed-off-by: MadhuMosip --- .../certs_upload/postman/README.md | 39 ++ .../certs_upload/postman/collection.json | 436 ++++++++++++++++++ .../resident-ui/certs_upload/postman/env.json | 29 ++ resident-ui/src/assets/config.json | 2 +- 4 files changed, 505 insertions(+), 1 deletion(-) create mode 100644 deploy/resident-ui/certs_upload/postman/README.md create mode 100644 deploy/resident-ui/certs_upload/postman/collection.json create mode 100644 deploy/resident-ui/certs_upload/postman/env.json diff --git a/deploy/resident-ui/certs_upload/postman/README.md b/deploy/resident-ui/certs_upload/postman/README.md new file mode 100644 index 00000000..ba697ea0 --- /dev/null +++ b/deploy/resident-ui/certs_upload/postman/README.md @@ -0,0 +1,39 @@ +# Resident Cert Upload (_Work-in-progress_) + +The folder here contains Postman Collection to upload RESIDENT 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 │ 8 │ 0 │ +├─────────────────────────┼─────────────────────┼─────────────────────┤ +│ test-scripts │ 8 │ 0 │ +├─────────────────────────┼─────────────────────┼─────────────────────┤ +│ prerequest-scripts │ 4 │ 0 │ +├─────────────────────────┼─────────────────────┼─────────────────────┤ +│ assertions │ 9 │ 0 │ +├─────────────────────────┴─────────────────────┴─────────────────────┤ +│ total run duration: 3.7s │ +├─────────────────────────────────────────────────────────────────────┤ +│ total data received: 7.16KB (approx) │ +├─────────────────────────────────────────────────────────────────────┤ +│ average response time: 432ms [min: 112ms, max: 1461ms, s.d.: 413ms] │ +└─────────────────────────────────────────────────────────────────────┘ + +``` diff --git a/deploy/resident-ui/certs_upload/postman/collection.json b/deploy/resident-ui/certs_upload/postman/collection.json new file mode 100644 index 00000000..e8e7946c --- /dev/null +++ b/deploy/resident-ui/certs_upload/postman/collection.json @@ -0,0 +1,436 @@ +{ + "info": { + "_postman_id": "5a43932c-5022-4731-bafc-282af54996a2", + "name": "Automated Cert Upload for Resident", + "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": "GET RESIDENT Root Certificate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "var data = JSON.stringify(jsonData.response.certificate);\r", + "console.log(data);\r", + "pm.environment.set(\"Resrootcert\",data);\r", + "\r", + "var jsonData = JSON.parse(responseBody);\r", + "pm.test(\"Got RESIDENT-ROOT-cert\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.eql(null);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/v1/keymanager/getCertificate?applicationId=ROOT", + "host": [ + "{{url}}" + ], + "path": [ + "v1", + "keymanager", + "getCertificate" + ], + "query": [ + { + "key": "applicationId", + "value": "ROOT" + } + ] + } + }, + "response": [] + }, + { + "name": "POST RESIDENT_Root certificate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "var jsonData = JSON.stringify(jsonData.errors);\r", + "if (jsonData==\"[]\"){\r", + " pm.test(\"Posted RESIDENT-ROOT-Cert\", 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" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "postman.setGlobalVariable('requesttime', (new Date()).toISOString());" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"id\": \"string\",\r\n \"metadata\": {},\r\n \"request\": {\r\n \"certificateData\":{{Resrootcert}},\r\n \"partnerDomain\": \"AUTH\"\r\n },\r\n \"requesttime\": \"{{requesttime}}\",\r\n \"version\": \"string\"\r\n}\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": "GET resident certificate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "var data = JSON.stringify(jsonData.response.certificate);\r", + "console.log(data);\r", + "pm.environment.set(\"Rescert\",data);\r", + "var jsonData = JSON.parse(responseBody);\r", + "pm.test(\"Got Resident-cert\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.eql(null);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/v1/keymanager/getCertificate?applicationId=RESIDENT", + "host": [ + "{{url}}" + ], + "path": [ + "v1", + "keymanager", + "getCertificate" + ], + "query": [ + { + "key": "applicationId", + "value": "RESIDENT" + } + ] + } + }, + "response": [] + }, + { + "name": "POST Resident certificate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "var jsonData = JSON.stringify(jsonData.errors);\r", + "if (jsonData==\"[]\"){\r", + " pm.test(\"Posted RESIDENT cert\", 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" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "postman.setGlobalVariable('requesttime', (new Date()).toISOString());" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"id\": \"string\",\r\n \"metadata\": {},\r\n \"request\": {\r\n \"certificateData\":{{Rescert}},\r\n \"partnerDomain\": \"AUTH\"\r\n },\r\n \"requesttime\": \"{{requesttime}}\",\r\n \"version\": \"string\"\r\n}\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": "GET Mpartner default resident cert", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "var data = JSON.stringify(jsonData.response.certificate);\r", + "console.log(data);\r", + "pm.environment.set(\"MPDRcert\",data);\r", + "var jsonData = JSON.parse(responseBody);\r", + "pm.test(\"Got mpartner-default-resident-cert\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.eql(null);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/v1/keymanager/getCertificate?applicationId=RESIDENT&referenceId=mpartner-default-resident", + "host": [ + "{{url}}" + ], + "path": [ + "v1", + "keymanager", + "getCertificate" + ], + "query": [ + { + "key": "applicationId", + "value": "RESIDENT" + }, + { + "key": "referenceId", + "value": "mpartner-default-resident" + } + ] + } + }, + "response": [] + }, + { + "name": "POST mpartner default resident cert", + "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", + "if (jsonData==\"[]\"){\r", + " pm.test(\"Posted Mpartner-default-resident cert\", 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", + "}\r", + "var jsonData = JSON.parse(responseBody);\r", + "var data = JSON.stringify(jsonData.response.signedCertificateData);\r", + "pm.environment.set(\"signedmpartnerdefaultresidentcert\",data);\r", + "var jsonData = JSON.parse(responseBody);\r", + "pm.test(\"Got signed-certificate\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.eql([]);\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\":{{MPDRcert}},\r\n \"partnerDomain\": \"AUTH\",\r\n \"partnerId\": \"mpartner-default-resident\"\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": [] + }, + { + "name": "Upload Signed Certificate Copy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "\r", + "pm.test(\"Posted Signed certificate\", function () {\r", + " var jsonData = pm.response.json();\r", + " pm.expect(jsonData.errors).to.eql(null);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"id\": \"string\",\r\n \"metadata\": {},\r\n \"request\": {\r\n \"applicationId\": \"RESIDENT\",\r\n \"certificateData\":{{signedmpartnerdefaultresidentcert}},\r\n \"referenceId\": \"mpartner-default-resident\"\r\n },\r\n \"requesttime\": \"{{requesttime}}\",\r\n \"version\": \"string\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/v1/keymanager/uploadCertificate", + "host": [ + "{{url}}" + ], + "path": [ + "v1", + "keymanager", + "uploadCertificate" + ] + } + }, + "response": [] + } + ] +} diff --git a/deploy/resident-ui/certs_upload/postman/env.json b/deploy/resident-ui/certs_upload/postman/env.json new file mode 100644 index 00000000..5df9b0ec --- /dev/null +++ b/deploy/resident-ui/certs_upload/postman/env.json @@ -0,0 +1,29 @@ +{ + "id": "97f5ce5c-9a16-432d-be16-dcb1feeb5669", + "name": "Automated Cert Upload for Resident", + "values": [ + { + "key": "Resrootcert", + "value": "", + "enabled": true + }, + { + "key": "Rescert", + "value": "", + "enabled": true + }, + { + "key": "MPDRcert", + "value": "", + "enabled": true + }, + { + "key": "signedmpartnerdefaultresidentcert", + "value": "", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2021-11-10T10:15:11.999Z", + "_postman_exported_using": "Postman/8.12.5" +} diff --git a/resident-ui/src/assets/config.json b/resident-ui/src/assets/config.json index 2aadc93b..fa1f4bc2 100644 --- a/resident-ui/src/assets/config.json +++ b/resident-ui/src/assets/config.json @@ -1,5 +1,5 @@ { - "baseUrl": "https://api-internal.dev1.mosip.net/resident/v1", + "baseUrl": "https://api-internal.qa-plan.mosip.net/resident/v1", "version": "v1", "validateToken": "admin/authorize/admin/validateToken", "login": "/login/", From 54c17bbaac8b000ea4fc9b0a5a8a80e90636d04e Mon Sep 17 00:00:00 2001 From: MadhuMosip Date: Mon, 25 Nov 2024 18:32:29 +0530 Subject: [PATCH 31/33] [MOSIP-35421] Added copy_cm.sh and copy_secrets.sh files Signed-off-by: MadhuMosip --- deploy/copy_cm.sh | 24 ++++++++++++++++++++++++ deploy/copy_secrets.sh | 22 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 deploy/copy_cm.sh create mode 100644 deploy/copy_secrets.sh diff --git a/deploy/copy_cm.sh b/deploy/copy_cm.sh new file mode 100644 index 00000000..fdcb6430 --- /dev/null +++ b/deploy/copy_cm.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Copy configmaps from other namespaces +# DST_NS: Destination namespace + +function copying_cm() { + UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh + COPY_UTIL=./copy_cm_func.sh + DST_NS=resident + + 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 diff --git a/deploy/copy_secrets.sh b/deploy/copy_secrets.sh new file mode 100644 index 00000000..92d4db05 --- /dev/null +++ b/deploy/copy_secrets.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Copy secrets from other namespaces +# DST_NS: Destination namespace + +function copying_secrets() { + UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh + COPY_UTIL=./copy_cm_func.sh + DST_NS=resident + + wget -q $UTIL_URL -O copy_cm_func.sh && chmod +x copy_cm_func.sh + + $COPY_UTIL secret keycloak-client-secrets keycloak $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_secrets # calling function From 27ec92101fe0cf220850d3f36eb6cae8d7be0c41 Mon Sep 17 00:00:00 2001 From: MadhuMosip Date: Mon, 25 Nov 2024 18:34:43 +0530 Subject: [PATCH 32/33] [MOSIP-35421] Removed copy_cm.sh and copy_secrets.sh files Signed-off-by: MadhuMosip --- deploy/copy_cm.sh | 24 ------------------------ deploy/copy_secrets.sh | 22 ---------------------- 2 files changed, 46 deletions(-) delete mode 100644 deploy/copy_cm.sh delete mode 100644 deploy/copy_secrets.sh diff --git a/deploy/copy_cm.sh b/deploy/copy_cm.sh deleted file mode 100644 index fdcb6430..00000000 --- a/deploy/copy_cm.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Copy configmaps from other namespaces -# DST_NS: Destination namespace - -function copying_cm() { - UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh - COPY_UTIL=./copy_cm_func.sh - DST_NS=resident - - 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 diff --git a/deploy/copy_secrets.sh b/deploy/copy_secrets.sh deleted file mode 100644 index 92d4db05..00000000 --- a/deploy/copy_secrets.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Copy secrets from other namespaces -# DST_NS: Destination namespace - -function copying_secrets() { - UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh - COPY_UTIL=./copy_cm_func.sh - DST_NS=resident - - wget -q $UTIL_URL -O copy_cm_func.sh && chmod +x copy_cm_func.sh - - $COPY_UTIL secret keycloak-client-secrets keycloak $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_secrets # calling function From 5c5ac6579827033b9959ce52ce0262367d62d321 Mon Sep 17 00:00:00 2001 From: MadhuMosip Date: Mon, 25 Nov 2024 18:45:01 +0530 Subject: [PATCH 33/33] [MOSIP-35421] Added copy_cm.sh and copy_secrets.sh files Signed-off-by: MadhuMosip --- deploy/copy_cm.sh | 24 ++++++++++++++++++++++++ deploy/copy_secrets.sh | 22 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 deploy/copy_cm.sh create mode 100644 deploy/copy_secrets.sh diff --git a/deploy/copy_cm.sh b/deploy/copy_cm.sh new file mode 100644 index 00000000..fdcb6430 --- /dev/null +++ b/deploy/copy_cm.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Copy configmaps from other namespaces +# DST_NS: Destination namespace + +function copying_cm() { + UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh + COPY_UTIL=./copy_cm_func.sh + DST_NS=resident + + 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 diff --git a/deploy/copy_secrets.sh b/deploy/copy_secrets.sh new file mode 100644 index 00000000..92d4db05 --- /dev/null +++ b/deploy/copy_secrets.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Copy secrets from other namespaces +# DST_NS: Destination namespace + +function copying_secrets() { + UTIL_URL=https://raw.githubusercontent.com/mosip/mosip-infra/master/deployment/v3/utils/copy_cm_func.sh + COPY_UTIL=./copy_cm_func.sh + DST_NS=resident + + wget -q $UTIL_URL -O copy_cm_func.sh && chmod +x copy_cm_func.sh + + $COPY_UTIL secret keycloak-client-secrets keycloak $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_secrets # calling function