Skip to content

Commit

Permalink
Merge branch 'main' into reference_entity_add_vertex
Browse files Browse the repository at this point in the history
  • Loading branch information
Sreejit-K committed Jan 27, 2024
2 parents 4485020 + cdf08c0 commit 33c0ba5
Show file tree
Hide file tree
Showing 695 changed files with 37,781 additions and 10,388 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
RELEASE_VERSION=v0.0.13
RELEASE_VERSION=v1.0.0
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# This is a basic workflow that is manually triggered

name: Build and Publish

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch: # Inputs the workflow accepts.
inputs:
version:
description: 'Enter the version number of the build to be generated'
required: true
type: string

env:
DOCKER_REGISTRY: ghcr.io
DOCKER_NAMESPACE: sunbird-rc

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs: # This workflow contains a single job called "greet"
release-all:
name: Build Docker Images and Push to Github Container Registry
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: [release-sunbird-rc-core]
steps:
- name: Test
run: echo "Test"

install-dependencies:
name: Install and configure dependencies
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps: # Runs a single command using the runners shell
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
cache: 'maven'
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
- name: Log in to GHCR Docker Registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Dependencies
run: |
sh configure-dependencies.sh
cd java && ./mvnw clean install
rm -rf java/claim/target/*.jar
jar xvf ../java/registry/target/registry.jar && cp ../java/Dockerfile ./
release-sunbird-rc-core:
name: Build and release Sunbird-RC core
needs: install-dependencies
runs-on: ubuntu-latest
env:
IMAGE_NAME: sunbird-rc-core
steps:
- name: Extract metadata (tags, labels) for Sunbird-RC Core
id: registry-meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_NAMESPACE }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=raw,value=${{ inputs.version }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: target/Dockerfile
push: true
tags: ${{ steps.registry-meta.outputs.tags }}
labels: ${{ steps.registry-meta.outputs.labels }}
6 changes: 6 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ jobs:
cache: 'maven'
- name: Set up properties
run: sh configure-dependencies.sh
# # debug step
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# with:
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow ie Sreejith-K
# limit-access-to-actor: true
- name: Build and test
run: make test
# test:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@ coverage
out

.ipynb_checkpoints
db-data
db-data*
es-data*
keycloak-mobile*.jar
12 changes: 6 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ node {
}

stage('Build image') {
app = docker.build("dockerhub/sunbird-rc-core","target")
claimApp = docker.build("dockerhub/sunbird-rc-claim-ms","java/claim")
app = docker.build("ghcr.io/sunbird-rc/sunbird-rc-core","target")
claimApp = docker.build("ghcr.io/sunbird-rc/sunbird-rc-claim-ms","java/claim")
}

// stage('Test image') {
Expand All @@ -27,20 +27,20 @@ node {


stage('Push image') {
docker.withRegistry('', 'dockerhub') {
docker.withRegistry('ghcr.io', 'sunbird-rc') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
docker.withRegistry('', 'dockerhub') {
docker.withRegistry('ghrc.io', 'sunbird-rc') {
claimApp.push("${env.BUILD_NUMBER}")
claimApp.push("latest")
}
}

// stage('Deploy image') {
// sh "ssh [email protected] 'kubectl get pods -n ndear'"
// sh "ssh [email protected] 'kubectl set image deployment/registry registry=dockerhub/sunbird-rc:${env.BUILD_NUMBER} --record --namespace=ndear'"
// sh "ssh [email protected] 'kubectl set image deployment/claim-ms claim-ms=dockerhub/sunbird-rc-claim-ms:${env.BUILD_NUMBER} --record --namespace=ndear'"
// sh "ssh [email protected] 'kubectl set image deployment/registry registry=ghcr.io/sunbird-rc/sunbird-rc:${env.BUILD_NUMBER} --record --namespace=ndear'"
// sh "ssh [email protected] 'kubectl set image deployment/claim-ms claim-ms=ghcr.io/sunbird-rc/sunbird-rc-claim-ms:${env.BUILD_NUMBER} --record --namespace=ndear'"
// }

}
Expand Down
103 changes: 39 additions & 64 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,108 +1,83 @@
#SOURCES = $(wildcard java/**/*.java)
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
SOURCES := $(call rwildcard,java/,*.java)
RELEASE_VERSION = v0.0.13
RELEASE_VERSION = v1.0.0
IMAGES := ghcr.io/sunbird-rc/sunbird-rc-core ghcr.io/sunbird-rc/sunbird-rc-nginx ghcr.io/sunbird-rc/sunbird-rc-context-proxy-service \
ghcr.io/sunbird-rc/sunbird-rc-public-key-service ghcr.io/sunbird-rc/sunbird-rc-keycloak ghcr.io/sunbird-rc/sunbird-rc-certificate-api \
ghcr.io/sunbird-rc/sunbird-rc-certificate-signer ghcr.io/sunbird-rc/sunbird-rc-notification-service ghcr.io/sunbird-rc/sunbird-rc-claim-ms \
ghcr.io/sunbird-rc/sunbird-rc-digilocker-certificate-api ghcr.io/sunbird-rc/sunbird-rc-bulk-issuance ghcr.io/sunbird-rc/sunbird-rc-metrics \
ghcr.io/sunbird-rc/id-gen-service ghcr.io/sunbird-rc/encryption-service
build: java/registry/target/registry.jar
echo ${SOURCES}
rm -rf java/claim/target/*.jar
cd target && rm -rf * && jar xvf ../java/registry/target/registry.jar && cp ../java/Dockerfile ./ && docker build -t dockerhub/sunbird-rc-core .
cd target && rm -rf * && jar xvf ../java/registry/target/registry.jar && cp ../java/Dockerfile ./ && docker build -t ghcr.io/sunbird-rc/sunbird-rc-core .
make -C java/claim
make -C services/certificate-api docker
make -C services/certificate-signer docker
make -C services/notification-service docker
make -C deps/keycloak build
make -C services/public-key-service docker
make -C services/context-proxy-service docker
docker build -t dockerhub/sunbird-rc-nginx .
make -C services/metrics docker
make -C services/digilocker-certificate-api docker
make -C services/bulk_issuance docker
make -C services/id-gen-service docker
make -C services/encryption-service docker
docker build -t ghcr.io/sunbird-rc/sunbird-rc-nginx .

java/registry/target/registry.jar: $(SOURCES)
echo $(SOURCES)
sh configure-dependencies.sh
cd java && ./mvnw clean install

test:
test: build
@docker-compose down
@rm -rf db-data* || echo "no permission to delete"
# test with ES & standard definition manager
@RELEASE_VERSION=latest KEYCLOAK_IMPORT_DIR=java/apitest/src/test/resources KEYCLOAK_SECRET=a52c5f4a-89fd-40b9-aea2-3f711f14c889 DB_DIR=db-data-1 docker-compose up -d db es keycloak registry certificate-signer certificate-api
# test with distributed definition manager and native search
@docker-compose --env-file test_environments/test_with_distributedDefManager_nativeSearch.env up -d db keycloak registry certificate-signer certificate-api redis
@echo "Starting the test" && sh build/wait_for_port.sh 8080
@echo "Starting the test" && sh build/wait_for_port.sh 8081
@docker-compose ps
@curl -v http://localhost:8081/health
@cd java/apitest && ../mvnw -Pe2e test || echo 'Tests failed'
@cd java/apitest && ../mvnw -Pe2e test
@docker-compose down
@rm -rf db-data-1 || echo "no permission to delete"
# test with distributed definition manager
@RELEASE_VERSION=latest KEYCLOAK_IMPORT_DIR=java/apitest/src/test/resources KEYCLOAK_SECRET=a52c5f4a-89fd-40b9-aea2-3f711f14c889 MANAGER_TYPE=DistributedDefinitionsManager DB_DIR=db-data-2 docker-compose up -d db es keycloak registry certificate-signer certificate-api redis
# test with kafka(async), events, notifications,
@docker-compose --env-file test_environments/test_with_asyncCreate_events_notifications.env up -d db es clickhouse redis keycloak registry certificate-signer certificate-api kafka zookeeper notification-ms metrics
@echo "Starting the test" && sh build/wait_for_port.sh 8080
@echo "Starting the test" && sh build/wait_for_port.sh 8081
@docker-compose ps
@curl -v http://localhost:8081/health
@cd java/apitest && ../mvnw -Pe2e test || echo 'Tests failed'
@cd java/apitest && MODE=async ../mvnw -Pe2e test
@docker-compose down
@rm -rf db-data-2 || echo "no permission to delete"
# test with native search service
@RELEASE_VERSION=latest KEYCLOAK_IMPORT_DIR=java/apitest/src/test/resources KEYCLOAK_SECRET=a52c5f4a-89fd-40b9-aea2-3f711f14c889 DB_DIR=db-data-3 SEARCH_PROVIDER_NAME=dev.sunbirdrc.registry.service.NativeSearchService EXPAND_REFERENCE=false docker-compose up -d db keycloak registry certificate-signer certificate-api
@echo "Starting the test" && sh build/wait_for_port.sh 8080
# test with fusionauth
@docker-compose --env-file test_environments/test_with_fusionauth.env -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml up -d db es fusionauth fusionauthwrapper
sleep 20
@echo "Starting the test" && sh build/wait_for_port.sh 9011
@echo "Starting the test" && sh build/wait_for_port.sh 3990
sleep 20
@docker-compose --env-file test_environments/test_with_fusionauth.env -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml up -d --no-deps registry
@echo "Starting the test" && sh build/wait_for_port.sh 8081
@docker-compose ps
@docker-compose -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml ps
@curl -v http://localhost:8081/health
@cd java/apitest && ../mvnw -Pe2e test || echo 'Tests failed'
@docker-compose down
@cd java/apitest && MODE=fusionauth ../mvnw -Pe2e test || echo 'Tests failed'
@docker-compose -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml down
@rm -rf db-data-3 || echo "no permission to delete"
# test with kafka(async)
@ASYNC_ENABLED=true RELEASE_VERSION=latest KEYCLOAK_IMPORT_DIR=java/apitest/src/test/resources KEYCLOAK_SECRET=a52c5f4a-89fd-40b9-aea2-3f711f14c889 DB_DIR=db-data-4 docker-compose up -d db es keycloak registry certificate-signer certificate-api kafka zookeeper
@echo "Starting the test" && sh build/wait_for_port.sh 8080
@echo "Starting the test" && sh build/wait_for_port.sh 8081
@docker-compose ps
@curl -v http://localhost:8081/health
@cd java/apitest && MODE=async ../mvnw -Pe2e test || echo 'Tests failed'
@docker-compose down
@rm -rf db-data-4 || echo "no permission to delete"
# test with elastic search service
@RELEASE_VERSION=latest KEYCLOAK_IMPORT_DIR=java/apitest/src/test/resources KEYCLOAK_SECRET=a52c5f4a-89fd-40b9-aea2-3f711f14c889 DB_DIR=db-data-5 SEARCH_PROVIDER_NAME=dev.sunbirdrc.registry.service.ElasticSearchService EXPAND_REFERENCE=false docker-compose up -d db keycloak registry certificate-signer certificate-api
@echo "Starting the test" && sh build/wait_for_port.sh 8080
@echo "Starting the test" && sh build/wait_for_port.sh 8081
@docker-compose ps
@curl -v http://localhost:8081/health
@cd java/apitest && ../mvnw -Pe2e test || echo 'Tests failed'
@docker-compose down
@rm -rf db-data-5 || echo "no permission to delete"
make -C services/certificate-signer test
make -C services/public-key-service test
make -C services/context-proxy-service test
make -C services/bulk_issuance test

clean:
@rm -rf target || true
@rm java/registry/target/registry.jar || true
release: test
docker tag dockerhub/sunbird-rc-core dockerhub/sunbird-rc-core:$(RELEASE_VERSION)
docker tag dockerhub/sunbird-rc-claim-ms dockerhub/sunbird-rc-claim-ms:$(RELEASE_VERSION)
docker tag dockerhub/sunbird-rc-notification-service dockerhub/sunbird-rc-notification-service:$(RELEASE_VERSION)
docker tag dockerhub/sunbird-rc-certificate-signer dockerhub/sunbird-rc-certificate-signer:$(RELEASE_VERSION)
docker tag dockerhub/sunbird-rc-certificate-api dockerhub/sunbird-rc-certificate-api:$(RELEASE_VERSION)
docker tag dockerhub/sunbird-rc-keycloak dockerhub/sunbird-rc-keycloak:$(RELEASE_VERSION)
docker tag dockerhub/sunbird-rc-public-key-service dockerhub/sunbird-rc-public-key-service:$(RELEASE_VERSION)
docker tag dockerhub/sunbird-rc-context-proxy-service dockerhub/sunbird-rc-context-proxy-service:$(RELEASE_VERSION)
docker tag dockerhub/sunbird-rc-nginx dockerhub/sunbird-rc-nginx:$(RELEASE_VERSION)
docker push dockerhub/sunbird-rc-core:latest
docker push dockerhub/sunbird-rc-core:$(RELEASE_VERSION)
docker push dockerhub/sunbird-rc-claim-ms:latest
docker push dockerhub/sunbird-rc-claim-ms:$(RELEASE_VERSION)
docker push dockerhub/sunbird-rc-notification-service:latest
docker push dockerhub/sunbird-rc-notification-service:$(RELEASE_VERSION)
docker push dockerhub/sunbird-rc-certificate-signer:latest
docker push dockerhub/sunbird-rc-certificate-signer:$(RELEASE_VERSION)
docker push dockerhub/sunbird-rc-certificate-api:latest
docker push dockerhub/sunbird-rc-certificate-api:$(RELEASE_VERSION)
docker push dockerhub/sunbird-rc-keycloak:latest
docker push dockerhub/sunbird-rc-keycloak:$(RELEASE_VERSION)
docker push dockerhub/sunbird-rc-public-key-service:latest
docker push dockerhub/sunbird-rc-public-key-service:$(RELEASE_VERSION)
docker push dockerhub/sunbird-rc-context-proxy-service:latest
docker push dockerhub/sunbird-rc-context-proxy-service:$(RELEASE_VERSION)
docker push dockerhub/sunbird-rc-nginx:latest
docker push dockerhub/sunbird-rc-nginx:$(RELEASE_VERSION)
@cd tools/cli/ && npm publish


for image in $(IMAGES); \
do \
echo $$image; \
docker tag $$image:latest $$image:$(RELEASE_VERSION);\
docker push $$image:latest;\
docker push $$image:$(RELEASE_VERSION);\
done
@cd tools/cli/ && npm publish
Loading

0 comments on commit 33c0ba5

Please sign in to comment.