Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merging mec-1.2.0.1 to unraf-1.2.0.1 #1

Merged
merged 8 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/workflows/kernel_notification_manual_push_trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Kernel Notification Maven Package upon a push


on: workflow_dispatch

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
ref: ${{ github.ref }}
java-version: 11
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Setup branch and env
run: |
# Strip git ref prefix from version
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV
- name: Setup branch and GPG public key
run: |
# Strip git ref prefix from version
echo ${{ env.BRANCH_NAME }}
# echo ${{ env.GPG_TTY }}
# sudo apt-get --yes install gnupg2
# gpg2 --import ./.github/keys/mosipgpgkey_pub.gpg
# gpg2 --quiet --batch --passphrase=${{secrets.gpg_secret}} --allow-secret-key-import --import ./.github/keys/mosipgpgkey_sec.gpg

- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-${{ env.BRANCH_NAME }}
- name: Setup the settings file for ossrh server
run: echo "<settings> <servers> <server> <id>ossrh</id> <username>${{secrets.ossrh_user}}</username> <password>${{secrets.ossrh_secret}}</password> </server> </servers> <profiles> <profile> <id>ossrh</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <gpg.executable>gpg2</gpg.executable> <gpg.passphrase>${{secrets.gpg_secret}}</gpg.passphrase> </properties> </profile> <profile> <id>allow-snapshots</id> <activation><activeByDefault>true</activeByDefault></activation> <repositories> <repository> <id>snapshots-repo</id> <url>https://oss.sonatype.org/content/repositories/snapshots</url> <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> <repository> <id>releases-repo</id> <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>false</enabled></snapshots> </repository> </repositories> </profile> <profile> <id>sonar</id> <properties> <sonar.sources>.</sonar.sources> <sonar.host.url>https://sonarcloud.io</sonar.host.url> </properties> <activation> <activeByDefault>false</activeByDefault> </activation> </profile> </profiles> </settings>" > $GITHUB_WORKSPACE/settings.xml

- name: Build with Maven
run: |
cd kernel/kernel-notification-service
mvn -B package -s $GITHUB_WORKSPACE/settings.xml -DskipTests -Dgpg.skip=true --file pom.xml

- name: Ready the springboot artifacts
run: find -name '*.jar' -executable -type f -exec zip release.zip {} +


- name: Upload the springboot jars
uses: actions/upload-artifact@v1
with:
name: release
path: ./release.zip

docker-kernel-notification-service:
needs: build

runs-on: ubuntu-latest
env:
NAMESPACE: ${{ secrets. dev_namespace_docker_hub }}
SERVICE_NAME: kernel-notification-service
SERVICE_LOCATION: kernel/kernel-notification-service

steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v1
with:
name: release
path: ./

- name: Setup branch name
run: |
# Strip git ref prefix from version
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
echo ${{ env.BRANCH_NAME }}

- name: Get version info from pom
id: getPomVersion
uses: mavrosxristoforos/[email protected]
with:
xml-file: ./${{ env.SERVICE_LOCATION }}/pom.xml
xpath: /*[local-name()="project"]/*[local-name()="version"]

- name: Unzip and extract the ${{ env.SERVICE_NAME }}
run: unzip -uj "release.zip" "${{ env.SERVICE_LOCATION }}/target/*" -d "./${{ env.SERVICE_LOCATION }}/target"

- name: Build image
run: |
cd "./${{env.SERVICE_LOCATION}}"
docker build . --file Dockerfile --tag ${{ env.SERVICE_NAME }}

- name: Log into registry
run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin

- name: Push image
run: |
IMAGE_ID=$NAMESPACE/$SERVICE_NAME

# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo "push version ${{steps.getPomVersion.outputs.info}}"
VERSION=$BRANCH_NAME
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $SERVICE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Maven Package upon a push](https://github.com/mosip/commons/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0.1)](https://github.com/mosip/commons/actions/workflows/push_trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_commons&metric=alert_status)](https://sonarcloud.io/dashboard?branch=release-1.2.0.1&id=mosip_commons)
[![Maven Package upon a push](https://github.com/mosip/commons/actions/workflows/push-trigger.yml/badge.svg?branch=master)](https://github.com/mosip/commons/actions/workflows/push-trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_commons&metric=alert_status)](https://sonarcloud.io/dashboard?branch=master&id=mosip_commons)


# Commons
Expand Down
4 changes: 2 additions & 2 deletions kernel/kernel-notification-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ CMD if [ "$is_glowroot_env" = "present" ]; then \
rm -rf glowroot.zip ; \
sed -i 's/<service_name>/kernel-notification-service/g' glowroot/glowroot.properties ; \
wget -q --show-progress "${runtime_dep_url_env}/kernel-auth-adapter.jar" -O "${loader_path_env}"/kernel-auth-adapter.jar; \
wget -q --show-progress "${runtime_dep_url_env}/kernel-smsserviceprovider-msg91.jar" -O "${loader_path_env}"/kernel-smsserviceprovider-msg91.jar; \
wget -q --show-progress "${runtime_dep_url_env}/kernel-smsserviceprovider-fast2sms-1.2.0.1-B1.jar" -O "${loader_path_env}"/kernel-smsserviceprovider-fast2sms-1.2.0.1-B1.jar; \
java -jar -javaagent:glowroot/glowroot.jar -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" kernel-notification-service.jar ; \
else \
wget -q --show-progress "${runtime_dep_url_env}/kernel-auth-adapter.jar" -O "${loader_path_env}"/kernel-auth-adapter.jar; \
wget -q --show-progress "${runtime_dep_url_env}/kernel-smsserviceprovider-msg91.jar" -O "${loader_path_env}"/kernel-smsserviceprovider-msg91.jar; \
wget -q --show-progress "${runtime_dep_url_env}/kernel-smsserviceprovider-fast2sms-1.2.0.1-B1.jar" -O "${loader_path_env}"/kernel-smsserviceprovider-fast2sms-1.2.0.1-B1.jar; \
java -jar -Dloader.path="${loader_path_env}" -Dspring.cloud.config.label="${spring_config_label_env}" -Dspring.profiles.active="${active_profile_env}" -Dspring.cloud.config.uri="${spring_config_url_env}" kernel-notification-service.jar ; \
fi

23 changes: 23 additions & 0 deletions kernel/kernel-notification-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@
<kernel.logger.version>1.2.0.1</kernel.logger.version>
<jacoco.maven.plugin.version>0.8.5</jacoco.maven.plugin.version>
<springdoc.version>1.5.10</springdoc.version>
<kernel.templatemanager.velocity.version>1.2.0.1-B1</kernel.templatemanager.velocity.version>
<gson.version>2.8.4</gson.version>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -282,6 +284,27 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-templatemanager-velocity</artifactId>
<version>${kernel.templatemanager.velocity.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
</dependencies>

<distributionManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package io.mosip.kernel.emailnotification.constant;

/**
* The Enum ApiName.
*
* @author Rishabh Keshari
*/
public enum ApiName {

/** The auth. */
AUTH,

/** The authinternal. */
AUTHINTERNAL,

/** The master data. */
MASTER,


AUDIT,

/** The ida. */
IDA,


/** The idrepository. */
IDREPOSITORY,

/** The idrepository get id by uin. */
IDREPOGETIDBYUIN,

/** The uingenerator. */
UINGENERATOR,

/** The idrepodev. */
IDREPODEV,

/** The Cryptomaanger *. */
CRYPTOMANAGERDECRYPT,

ENCRYPTURL,

IDAUTHENCRYPTION,

IDAUTHPUBLICKEY,

/** The ReverseDataSync *. */
REVERSEDATASYNC,

/** The Device history *. */
DEVICESHISTORIES,

/** The Reg center device history *. */
REGISTRATIONCENTERDEVICEHISTORY,

/** The registration center timestamp *. */
REGISTRATIONCENTERTIMESTAMP,

/** The registration connector *. */
REGISTRATIONCONNECTOR,

/** The encryptionservice. */
ENCRYPTIONSERVICE,


/** The ridgeneration. */
RIDGENERATION,

/** The retrieveidentity. */
RETRIEVEIDENTITY,

/** The retrieveidentity using rid. */
RETRIEVEIDENTITYFROMRID,

/** The digitalsignature. */
DIGITALSIGNATURE,

/** The Vid creation. */
CREATEVID,

/** The user details. */
USERDETAILS,

/** get operator rid from id. */
GETRIDFROMUSERID,

/** The internalauth. */
INTERNALAUTH,

/** The templates. */
TEMPLATES,

GETUINBYVID,

DEVICEVALIDATEHISTORY,

DECRYPTPINBASSED, CREATEDATASHARE,
PDFSIGN,

NGINXDMZURL,

IDSCHEMAURL,
CREDENTIALDATAREQUEST,
CREDENTIALDATAREQUESTGENERATOR,
EMAIL_NOTIFICATION


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.mosip.kernel.emailnotification.constant;

public enum DateUtilConstants {
ILLEGALARGUMENT_ERROR_CODE("KER-UTL-101", "Invalid Argument Found"),
NULL_ARGUMENT_ERROR_CODE("KER-UTL-102", "Null Argument Found"),
PARSE_EXCEPTION_ERROR_CODE("KER-UTL-103", "Parsing error occours");

/** Error code. */
public final String errorCode;
/** Exception Message */
public final String exceptionMessage;

/**
* @param errorCode source Error code to use when no localized code is
* available
* @param exceptionMessage source exception message to use when no localized
* message is available.
*/
DateUtilConstants(final String errorCode, final String exceptionMessage) {
this.errorCode = errorCode;
this.exceptionMessage = exceptionMessage;
}

public String getErrorCode() {
return errorCode;
}

public String getEexceptionMessage() {
return exceptionMessage;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.mosip.kernel.emailnotification.constant;


public enum LoggerFileConstant {

SESSIONID,
REGISTRATIONID,
REFFERENCEID,
USERID,
APPLICATIONID,
UIN
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
public enum MailNotifierConstants {
MESSAGE_REQUEST_SENT("Email Request submitted"), MESSAGE_SUCCESS_STATUS("success"), ERROR_CODE("ERROR-CODE"),
LOGGER_TARGET("System.err"), EMPTY_STRING(""), DIGIT_ZERO("0");
LOGGER_TARGET("System.err"), EMPTY_STRING(""), DIGIT_ZERO("0"), LANGUAGE("eng");

/**
* The value.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.mosip.kernel.emailnotification.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* Instantiates a new error DTO.
*
* @param errorcode the errorcode
* @param message the message
*
* @author Rishabh Keshari
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ErrorDTO implements Serializable {

private static final long serialVersionUID = 2452990684776944908L;

/** The errorcode. */
private String errorCode;

/** The message. */
private String message;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.mosip.kernel.emailnotification.dto;

public class Metadata {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.mosip.kernel.emailnotification.dto;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

@Data
@Setter
@Getter
public class PasswordRequest {
public String appId;
public String password;
public String userName;
}
Loading
Loading