Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into issue701_UniqueIndexC…
Browse files Browse the repository at this point in the history
…reated
  • Loading branch information
chopadetejaswini committed Oct 13, 2023
2 parents b4a6861 + af9ddbf commit c2f05f7
Show file tree
Hide file tree
Showing 164 changed files with 5,345 additions and 5,654 deletions.
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 }}
10 changes: 8 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ jobs:
cache: 'maven'
- name: Set up properties
run: sh configure-dependencies.sh
- name: Build and test
run: make test
# # 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:
# runs-on: ubuntu-latest
# steps:
Expand Down
8 changes: 4 additions & 4 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 @@ -39,8 +39,8 @@ node {

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

}
Expand Down
22 changes: 10 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
SOURCES := $(call rwildcard,java/,*.java)
RELEASE_VERSION = v0.0.14
IMAGES := dockerhub/sunbird-rc-core dockerhub/sunbird-rc-nginx dockerhub/sunbird-rc-context-proxy-service \
dockerhub/sunbird-rc-public-key-service dockerhub/sunbird-rc-keycloak dockerhub/sunbird-rc-certificate-api \
dockerhub/sunbird-rc-certificate-signer dockerhub/sunbird-rc-notification-service dockerhub/sunbird-rc-claim-ms \
dockerhub/sunbird-rc-digilocker-certificate-api dockerhub/sunbird-rc-bulk-issuance dockerhub/sunbird-rc-metrics
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
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
Expand All @@ -20,34 +20,32 @@ build: java/registry/target/registry.jar
make -C services/metrics docker
make -C services/digilocker-certificate-api docker
make -C services/bulk_issuance docker
docker build -t dockerhub/sunbird-rc-nginx .
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: build
@echo "VIEW_DIR=java/apitest/src/test/resources/views" >> .env || echo "no permission to append to file"
@echo "SCHEMA_DIR=java/apitest/src/test/resources/schemas" >> .env || echo "no permission to append to file"
@docker-compose down
@rm -rf db-data* || echo "no permission to delete"
# test with distributed definition manager and native search
@SEARCH_PROVIDER_NAME=dev.sunbirdrc.registry.service.NativeSearchService 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-1 docker-compose up -d db keycloak registry certificate-signer certificate-api redis
@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 kafka(async), events, notifications,
@NOTIFICATION_ENABLED=true NOTIFICATION_URL=http://notification-ms:8765/notification-service/v1/notification TRACK_NOTIFICATIONS=true EVENT_ENABLED=true 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-2 docker-compose up -d db es keycloak registry certificate-signer certificate-api kafka zookeeper notification-ms metrics
@docker-compose --env-file test_environments/test_with_asyncCreate_events_notifications.env up -d db 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 && MODE=async ../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"
make -C services/certificate-signer test
Expand Down
Loading

0 comments on commit c2f05f7

Please sign in to comment.