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

Merge release-5.1.0 into master #80

Open
wants to merge 112 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
fc2c0ef
Issue #SB- 000 fix: package version updated
Oct 18, 2019
6f9fcb9
fix: adding logic for RC
beepdot Nov 5, 2019
fbfe421
fix: adding logic for RC
beepdot Nov 5, 2019
32abf19
Merge pull request #40 from project-sunbird/test-240-RC1
Nov 5, 2019
aeabc62
Do-1203 Enabling the sonar cloud
Kaali09 Nov 18, 2019
c01475b
Merge pull request #42 from Kaali09/release-2.5.0
amorphous-1 Nov 18, 2019
6541ea0
Issue #0000 fix: Changed collection-editor pkg version to 2.6.0
gouravmore Nov 22, 2019
529702a
Issue #0000 merge: Merge pull request #43 from gouravmore/release-2.6.0
Nov 22, 2019
daee6cf
Update config.yml
amorphous-1 Dec 12, 2019
831cb23
Issue #SB-16429 feat: sonarqube changes
pallakartheekreddy Dec 18, 2019
0668b1e
Issue #SB-16429 feat: sonarqube changes
pallakartheekreddy Dec 18, 2019
999e973
Issue #SB-16429 fix: package version updated
pallakartheekreddy Dec 18, 2019
b0adb5a
Issue #SB-16429 merge: Merge pull request #47 from pallakartheekreddy…
Dec 19, 2019
5002439
Issue #SB-16745 fix: Resource: Privacy option
rahulshukla Dec 24, 2019
578b47d
Issue #SB-16745 fix: Added sonar property file
rahulshukla Dec 24, 2019
4e8a4bd
Issue #SB-16745 fix: Added global as npm dependency
rahulshukla Dec 24, 2019
146d3fc
Issue #SB-16745 merge: Merge pull request #48 from rahulshukla/releas…
Dec 24, 2019
23775fd
Issue #SB-16982 chore: updating build tasks, package manager configs.
rahulshukla Jan 7, 2020
d93b4f0
Issue #SB-17104 chore: updating build tasks, package manager configs.
rahulshukla Jan 8, 2020
a9a5977
Issue #SB-17104 merge: Merge pull request #49 from rahulshukla/releas…
Jan 8, 2020
b998039
Issue #SB-17104 chore: updating build tasks, package manager configs.
rahulshukla Jan 8, 2020
6ac48fd
Issue #SB-17104 merge: Merge pull request #51 from rahulshukla/releas…
Jan 8, 2020
6f01147
Issue #SB-17104 merge: Merge pull request #50 from project-sunbird/re…
vinukumar-vs Jan 8, 2020
48f2a48
Issue #SB-0000 fix: Content editor version changes
gouravmore Jan 30, 2020
402f991
Issue #SB-0000 fix: Content editor version changes
gouravmore Jan 30, 2020
0f5daac
Issue #SB-0000 merge: Merge pull request #52 from gouravmore/release-…
Jan 30, 2020
0429c95
Issue #SB-0000 fix: generic editor version changes for release-2.9.0
gouravmore Mar 24, 2020
32c6567
Issue #SB-0000 Merge: Merge pull request #53 from gouravmore/release-…
rahulshukla Mar 24, 2020
5dde89e
Change in version from 2.9.0 t0 2.10.0
Apr 1, 2020
630be2a
Issue #SB-00000 merged: version update version updateMerge pull reque…
rahulshukla Apr 1, 2020
04bd419
Update Jenkinsfile
G33tha Apr 7, 2020
4e311fc
Create auto_build_deploy
G33tha Apr 7, 2020
eea6d32
Update auto_build_deploy
G33tha Apr 15, 2020
a7dec24
Update auto_build_deploy
G33tha Apr 15, 2020
860861a
Merge pull request #55 from G33tha/release-2.10.0
amorphous-1 Apr 15, 2020
3aa4caa
Issue #0000 fix: Version updated to 3.0.0
gouravmore May 4, 2020
2a54791
Issue #0000 Merge: Merge pull request #56 from gouravmore/release-3.0
rahulshukla May 4, 2020
da72e03
Issue #SB-0000 chore:version change
Jun 17, 2020
07d9a31
Issue #SB-0000 Merge: Merge pull request #57 from rajnish-dargan/rele…
rahulshukla Jun 17, 2020
be6da26
Issue #SB-19594 feat: CF facilitate uploading of heavy contents from…
rahulshukla Jun 17, 2020
aa190d7
Issue #SB-19594 feat: CF facilitate uploading of heavy contents from…
rahulshukla Jun 17, 2020
1b7309b
Issue #SB-19594 feat: CF facilitate uploading of heavy contents from…
rahulshukla Jun 17, 2020
6b028f1
Issue #SB-19594 feat: CF facilitate uploading of heavy contents from…
rahulshukla Jun 17, 2020
8c12031
Issue #SB-19594 Merge: Merge pull request #58 from rahulshukla/releas…
rahulshukla Jun 17, 2020
fceeb97
Merge from Release 3.0.0 to Release 3.1.0: Merge pull request #59 fro…
rahulshukla Jun 30, 2020
5c6c994
Issue #SB-19760 fix: sonar project properties path changes and versio…
Dhirenaade Jul 17, 2020
7c410ae
Issue #SB-19760 fix: fix sonar failure.
Dhirenaade Jul 17, 2020
f76659c
Issue #SB-19760 fix: sonar scanner failure for args.
Dhirenaade Jul 17, 2020
4130f1d
Issue #SB-19760 fix: sonar scanner failure for args 2.
Dhirenaade Jul 17, 2020
8f4915e
Issue #SB-19760 fix: check scanner failure.
Dhirenaade Jul 17, 2020
99588c7
Issue #SB-19760 fix: check revert and check sonar.
Dhirenaade Jul 17, 2020
1365793
Issue #SB-19760 fix: check revert and source sonar.
Dhirenaade Jul 17, 2020
2a96723
Issue #SB-19760 fix:sonar properties update.
Dhirenaade Jul 29, 2020
976b14a
Issue #SB-19760 Merge: Merge pull request #60 from Dhirenaade/circle…
rahulshukla Jul 30, 2020
d5c5d12
Merge pull request #61 from project-sunbird/release-3.1.0
rahulshukla Jul 30, 2020
9d98777
Issue #SB-0000 chore:version change
Sep 16, 2020
ea23171
Issue #SB-0000 Merge: Merge pull request #62 from rajnish-dargan/new-…
rahulshukla Sep 16, 2020
370d872
Issue #SB-0000 chore:version change
Nov 3, 2020
4a78896
Merge pull request #63 from rajnish-dargan/release-3.4.0
Nov 3, 2020
9da2377
Issue #SB-0000 chore:version change
rajnishdargan Nov 23, 2020
83150c3
Merge pull request #64 from rajnish-dargan/release-3.5.0
pallakartheekreddy Nov 24, 2020
ab0d0ab
Issue #SB-000 fix: package version fixes
rajnishdargan Nov 30, 2020
3590bdb
Issue #SB-000 fix: package version fixes
rajnishdargan Nov 30, 2020
527bcd6
Merge pull request #65 from rajnish-dargan/SB-0000
pallakartheekreddy Nov 30, 2020
9fac3cc
Issue #SB-000 fix: package version fixes
rajnishdargan Nov 30, 2020
904ea94
Merge remote-tracking branch 'upstream/release-3.5.0' into SB-0000
rajnishdargan Nov 30, 2020
9d066c3
Merge pull request #66 from rajnish-dargan/SB-0000
pallakartheekreddy Nov 30, 2020
ab91337
Issue #SB-0000 chore:version change
rajnishdargan Jan 7, 2021
e29dba6
Merge pull request #67 from rajnish-dargan/release-3.6.0
pallakartheekreddy Jan 7, 2021
c907097
Issue #SB-28704 fix: Documentation Generic editor
gouravmore Feb 23, 2022
f128195
Issue #SB-28704 fix: documetation for generic editor
gouravmore Feb 23, 2022
59a9da8
Issue #SB-28704 fix: Documentation Generic editor
gouravmore Feb 23, 2022
3d44c50
Issue #SB-28704 fix: Documentation Generic editor
gouravmore Feb 24, 2022
7072bfa
Issue #SB-28704 fix: Documentation Generic editor
gouravmore Feb 24, 2022
39028e1
Issue #SB-28704 fix: Documentation Generic editor
gouravmore Feb 24, 2022
4b5afa1
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
cd206eb
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
e77f6e0
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
5428860
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
61c30f9
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
dccc021
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
864c5c7
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
9a68825
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
64e9f33
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
b59ee06
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
f111efe
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
b1f5c1c
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
2894f5c
Issue #SB-28704 fix: generic editor - circle cli updates
gouravmore Feb 24, 2022
d5999ff
Issue #SB-28704 fix: generic editor documentation updates
gouravmore Feb 24, 2022
3118e94
Merge pull request #69 from gouravmore/release-4.8.0
pallakartheekreddy Feb 24, 2022
75771bb
Merge branch 'release-4.10.1'
HarishGangula Aug 5, 2022
741bef3
Issue KN-109 fix: build issue
HarishGangula Aug 5, 2022
2a0afd6
KN-109: Merge pull request #70 from HarishGangula/release-4.10.1
vinukumar-vs Aug 5, 2022
deedb1c
Issue KN-109 fix: updated build script
HarishGangula Aug 8, 2022
b893201
Issue KN-109 fix: removed publishing result since test cases removed
HarishGangula Aug 8, 2022
95d7ef1
Issue KN-109 fix: updated package lock file
HarishGangula Aug 8, 2022
de55276
Issue #KN-109 merge: Merge pull request #71 from HarishGangula/releas…
vinukumar-vs Aug 9, 2022
e7d8095
Issue #KN-133 fix: Cloud service provider storage header changes
vaibhavbhuva Aug 12, 2022
01a782a
Issue #KN-133 fix: Updated the content editor package
vaibhavbhuva Aug 16, 2022
ece935b
Issue #KN-133 fix: Updated the node version for sonarQube
vaibhavbhuva Aug 16, 2022
7e5d0be
Issue #KN-133 merge: Merge pull request #72 from vaibhavbhuva/release…
vinukumar-vs Aug 16, 2022
b1442b1
Issue #SB-30910 fix: Added build script for jenkins and auto deploy
vaibhavbhuva Sep 13, 2022
7461c44
Issue #SB-30910 fix: build script issue fixes
vaibhavbhuva Sep 13, 2022
2fbc2bc
Issue #SB-30910 fix: build script issue fixes
vaibhavbhuva Sep 14, 2022
a36fb70
Issue #SB-30910 merge: Merge pull request #73 from vaibhavbhuva/relea…
vinukumar-vs Sep 14, 2022
44fbb86
Issue #SB-30910 fix: build script issue fixes
vaibhavbhuva Sep 14, 2022
faf1cb6
Issue #SB-30910 merge: Merge pull request #74 from vaibhavbhuva/relea…
vinukumar-vs Sep 15, 2022
e712c78
Issue #SB-30910 fix: build script issue fixes
vaibhavbhuva Sep 15, 2022
b6f75c1
Issue #SB-30910 merge : Merge pull request #75 from vaibhavbhuva/rele…
vinukumar-vs Sep 15, 2022
392690a
Issue #SB-30910 fix: Updated artifact version number
vaibhavbhuva Sep 16, 2022
da532a1
Issue #SB-30910 merge: Merge pull request #76 from vaibhavbhuva/relea…
vinukumar-vs Sep 16, 2022
8f530da
Issue #SB-30910 merge: Merge pull request #77 from vaibhavbhuva/relea…
vinukumar-vs Sep 19, 2022
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
45 changes: 34 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,68 @@
version: 2.1
jobs:
build:
working_directory: ~/generic-editor
docker:
- image: circleci/node:6.10-browsers
- image: circleci/node:10.0.0-browsers
environment:
version_number: $CIRCLE_BRANCH
build_number: $CIRCLE_BUILD_NUM
steps:
- checkout
- checkout:
path: ~/generic-editor

- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}

- run:
name: clone plugins
command: |
prnumber=$(echo $CI_PULL_REQUEST | awk -F'/' '{print $NF}')
prdata=$(curl -X GET -u $GITHUB_USER_TOKEN:x-oauth-basic https://api.github.com/repos/project-sunbird/sunbird-generic-editor/pulls/$prnumber)
if [ -z $CIRCLE_PR_NUMBER ]; then
target_branch=$CIRCLE_BRANCH
git clone https://github.com/project-sunbird/sunbird-content-plugins.git plugins -b $target_branch
else
prdata=$(curl -X GET -u $GITHUB_USER_TOKEN:x-oauth-basic https://api.github.com/repos/project-sunbird/sunbird-generic-editor/pulls/$CIRCLE_PR_NUMBER)
target_branch=$(echo "${prdata}" | jq -r '.base.ref')
git clone https://github.com/project-sunbird/sunbird-content-plugins.git plugins -b $target_branch

- run: sudo npm install -g [email protected] [email protected] [email protected] codacy-coverage
fi

- run: sudo npm install -g [email protected] [email protected] [email protected]
- run: npm install
- run: cd app && bower cache clean --allow-root
- run: cd app && bower install --force --allow-root
#- run: gulp clone-plugins
- run: gulp packageCorePlugins
- run: npm run plugin-build
- run: npm run build
- run: npm run test

- run: cp ./coverage/PhantomJS*/cobertura-coverage.xml /tmp/
- run: mkdir -p /tmp/coverage && cp /home/circleci/generic-editor/coverage/lcov/PhantomJS\ 2.1.1\ \(Linux\ 0.0.0\)/lcov.info /tmp/coverage

- store_artifacts:
path: /tmp/cobertura-coverage.xml
destination: cobertura-coverage.xml

path: /tmp/coverage
destination: coverage

- run:
name: Install NVM
command: 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh|bash'

- run:
name: alter node version
command: 'source ~/.nvm/nvm.sh && nvm install 14 && nvm use 14 && nvm alias default 14 && node -v'

- run:
name: Install sonar scanner
command: 'source ~/.nvm/nvm.sh && sudo npm install -g sonarqube-scanner'

- run:
name: Sonar scanner
command: source ~/.nvm/nvm.sh && sonar-scanner -Dsonar.projectKey=project-sunbird_sunbird-generic-editor -Dsonar.organization=project-sunbird -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.cobertura.reportPath=/coverage/PhantomJS*/cobertura-coverage.xml -Dsonar.language=js

- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths: ./node_modules



workflows:
version: 2.1
build_and_test:
Expand Down
34 changes: 10 additions & 24 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,29 @@ node() {
sh "cd plugins && git checkout origin/${branch_name} -b ${branch_name}"
} else {
def scmVars = checkout scm
checkout scm: [$class: 'GitSCM', branches: [[name: "refs/tags/${params.github_release_tag}"]], userRemoteConfigs: [[url: scmVars.GIT_URL]]]
artifact_version = params.github_release_tag
checkout scm: [$class: 'GitSCM', branches: [[name: "${params.github_release_tag}"]], userRemoteConfigs: [[url: scmVars.GIT_URL]]]
commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
branch_name = params.github_release_tag
artifact_version = params.github_release_tag + "_" + commit_hash
branch_name = params.github_release_tag.split('_')[0].split('\\.')[0] + "." + params.github_release_tag.split('_')[0].split('\\.')[1]
println(ANSI_BOLD + ANSI_YELLOW + "github_release_tag specified, building from github_release_tag: " + params.github_release_tag + ANSI_NORMAL)
sh "git clone https://github.com/project-sunbird/sunbird-content-plugins.git plugins"
sh """
cd plugins
checkout_tag=\$(git ls-remote --tags origin release-* | grep -o 'release-.*' | sort -V | tail -n1)
checkout_tag=\$(git ls-remote --tags origin $branch_name* | grep -o "$branch_name.*" | sort -V | tail -n1)
git checkout tags/\${checkout_tag} -b \${checkout_tag}
"""
}
echo "artifact_version: " + artifact_version

stage('Build') {
sh """
export version_number=${branch_name}
export build_number=${commit_hash}
rm -rf generic-editor
node -v
npm -v
npm install
cd app
bower cache clean
bower install --force
cd ..
gulp packageCorePlugins
npm run plugin-build
npm run build
#gulp build
npm run test
"""
run_testcase = false
sh('chmod 777 build.sh')
sh("bash ./build.sh ${branch_name} ${commit_hash} ${run_testcase}")
}

stage('Publish_test_results') {
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage/PhantomJS*/cobertura-coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
}
// stage('Publish_test_results') {
// cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage/PhantomJS*/cobertura-coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
// }

stage('ArchiveArtifacts') {
sh """
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[![npm version](https://badge.fury.io/js/%40project-sunbird%2Fgeneric-editor.svg)](https://badge.fury.io/js/%40project-sunbird%2Fgeneric-editor) [![Build Status](https://travis-ci.org/project-sunbird/sunbird-generic-editor.svg?branch=release-1.11.0)](https://travis-ci.org/project-sunbird/sunbird-generic-editor)

## Introduction
The generic editor is used to create contents which can be uploaded as files(H5P, epub, PDF, HTML, Youtube, Video).

Generic editor for all non-ECML contents (H5P, epub, PDF, HTML, Youtube, Video).

## Configuration

```js
window.context = {
Expand Down Expand Up @@ -89,12 +89,13 @@ window.config = {
],
corePlugins: [],
corePluginMapping: {},
useProxyForURL: false
useProxyForURL: false,
cloudStorage: {}
}
```

| Property Name | Description | Default Value |
| --- | --- | --- |
| Property Name | Description | Default Value | Example |
| --- | --- | --- | --- |
| `user` | It is a `object`, Which should contain the user details(userId, name) | NA |
| `sid` | It is a `string`, Session identifier | NA |
| `contentId ` | It is a `string`, content identifier | NA |
Expand All @@ -107,7 +108,9 @@ window.config = {
| `pluginRepo ` | It is a `string`, From which location plugins should load | /plugins |
| `dispatcher ` | It is a `string`,Where the telemetry should log ex(console, piwik, library, local) | console |
| `plugins ` | It is a `array`, Array of plugins ex:`[{id:"org.sunbird.header",ver:"1.0",type:"plugin"}]`| NA |
| `cloudStorage` | It is `object` and which defines cloud storage configuration which contains presigned_headers for diff service provider for example: Azure, AWS | ``` cloudStorage: { presigned_headers: { 'x-ms-blob-type': 'BlockBlob' // This header is specific to azure storage provider. } } ``` | The default configuration can be overwrite by passing empty headers. ***For example:*** If you don't want to pass any headers for AWS than pass as empty headers as below: ``` cloudStorage: { presigned_headers: { } } ```

## Integration

```js

Expand Down Expand Up @@ -158,4 +161,4 @@ This project is licensed under the MIT License - see the [LICENSE](https://githu
We use [SemVer](https://semver.org/) for versioning. For the versions available, see the [tags](https://github.com/project-sunbird/sunbird-generic-editor/tags) on this repository.

## Any Issues?
We have an open and active [issue tracker](https://project-sunbird.atlassian.net/issues/). Please report any issues.
We have an open and active [issue tracker](https://project-sunbird.atlassian.net/issues/). Please report any issues.
2 changes: 1 addition & 1 deletion app/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"oclazyload": "^1.0.9",
"ngSafeApply": "./libs/Scope.SafeApply.js",
"izitoast": "^1.1.3",
"contenteditor": "https://sunbirddev.blob.core.windows.net/sunbird-content-dev/content-editor/scripts/base-editor.min.js"
"contenteditor": "https://sunbirdstagingpublic.blob.core.windows.net/sunbird-content-staging-knowlg/content-editor/scripts/base-editor.min.js"
},
"appPath": "app",
"moduleName": "editorApp",
Expand Down
20 changes: 19 additions & 1 deletion app/scripts/dev/localhost-ce.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,23 @@ window.config = {
baseURL: "",
previewURL: "/preview/preview.html",
apislug: "/action",
dispatcher: "local"
dispatcher: "local",
cloudStorage: {
"presigned_headers": {
'x-ms-blob-type': 'BlockBlob' // This header is specific to azure storage provider.
/* TODO: if more configurations comes for cloud service provider
than we have do in more generic way like below:
For example:
cloudStorage: {
provider: 'azure' // azure, aws, etc..
azure: {
url: 'https://www.azureblogstorage.com'
presigned_headers: {
x-ms-blob-type: 'BlockBlob'
}
}
}
*/
}
}
}
4 changes: 3 additions & 1 deletion app/scripts/genericeditor/genericeditor-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ org.ekstep.contenteditor.config = _.assign(org.ekstep.contenteditor.config, {
plugins: [
{ 'id': 'org.ekstep.sunbirdcommonheader', 'ver': '1.4', 'type': 'plugin' },
{ 'id': 'org.ekstep.metadata', 'ver': '1.1', 'type': 'plugin' },
{ 'id': 'org.ekstep.sunbirdmetadata', 'ver': '1.1', 'type': 'plugin' }
{ 'id': 'org.ekstep.sunbirdmetadata', 'ver': '1.1', 'type': 'plugin' },
{ 'id': 'org.ekstep.uploadlargecontent', 'ver': '1.0', 'type': 'plugin' }
],
extContWhitelistedDomains: 'youtube.com,youtu.be'
})

63 changes: 63 additions & 0 deletions auto_build_deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@Library('deploy-conf') _
node() {
try {
String ANSI_GREEN = "\u001B[32m"
String ANSI_NORMAL = "\u001B[0m"
String ANSI_BOLD = "\u001B[1m"
String ANSI_RED = "\u001B[31m"
String ANSI_YELLOW = "\u001B[33m"

ansiColor('xterm') {
tag_name = env.JOB_NAME.split("/")[-1]
pre_checks()
stage('Checkout') {
cleanWs()
def scmVars = checkout scm
checkout scm: [$class: 'GitSCM', branches: [[name: "refs/tags/$tag_name"]], userRemoteConfigs: [[url: scmVars.GIT_URL]]]
commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
artifact_version = tag_name
branch_name = tag_name.split('_')[0].split('\\.')[0] + "." + tag_name.split('_')[0].split('\\.')[1]
run_testcase = true
sh "git clone https://github.com/project-sunbird/sunbird-content-plugins.git plugins"
sh """
cd plugins
checkout_tag=\$(git ls-remote --tags origin $branch_name* | grep -o "$branch_name.*" | sort -V | tail -n1)
git checkout tags/\${checkout_tag} -b \${checkout_tag}
"""
}
echo "artifact_version: " + artifact_version

// stage Build
sh('chmod 777 build.sh')
sh("./build.sh ${branch_name} ${commit_hash} ${run_testcase}")


// stage Publish_test_results
cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'coverage/PhantomJS*/cobertura-coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false


// stage ArchiveArtifacts
sh """
mkdir generic-editor-artifacts
cp generic-editor.zip generic-editor-artifacts
zip -j generic-editor-artifacts.zip:${artifact_version} generic-editor-artifacts/*
"""
archiveArtifacts "generic-editor-artifacts.zip:${artifact_version}"
sh """echo {\\"artifact_name\\" : \\"generic-editor-artifacts.zip\\", \\"artifact_version\\" : \\"${artifact_version}\\", \\"node_name\\" : \\"${env.NODE_NAME}\\"} > metadata.json"""
archiveArtifacts artifacts: 'metadata.json', onlyIfSuccessful: true
currentBuild.description = "${artifact_version}"

}
currentBuild.result = "SUCCESS"
slack_notify(currentBuild.result, tag_name)
email_notify()
auto_build_deploy()
}
catch (err) {
currentBuild.result = "FAILURE"
slack_notify(currentBuild.result, tag_name)
email_notify()
throw err
}

}
33 changes: 33 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
STARTTIME=$(date +%s)
NODE_VERSION=10.24.1
branch_name=$1
commit_hash=$2
runTest=$3
echo "runTest: " $runTest
echo "Starting editor build from build.sh"
set -euo pipefail
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install $NODE_VERSION
nvm use $NODE_VERSION
export version_number=$branch_name
export build_number=$commit_hash
rm -rf generic-editor
sudo apt-get install build-essential libpng-dev
node -v
npm -v
npm install
cd app
bower cache clean
bower install --force
cd ..
gulp packageCorePlugins
npm run plugin-build
npm run build
#gulp build
if [ $runTest == true ]
then
npm run test
fi
2 changes: 1 addition & 1 deletion deploy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generic-editor",
"version": "2.4.0",
"version": "3.6.0",
"description": "It is used to update files in deployment job",
"main": "gulpfile.js",
"scripts": {
Expand Down
8 changes: 5 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ gulp.task('build', ['minify', 'inject', 'replace', 'packageCorePlugins', 'zip'])

var corePlugins = [
"org.ekstep.uploadcontent-1.5",
"org.ekstep.assetbrowser-1.3",
"org.ekstep.uploadlargecontent-1.0",
]

gulp.task('minifyCorePlugins', function() {
Expand Down Expand Up @@ -300,14 +302,14 @@ gulp.task('packageCorePlugins', ["addDir", "minifyCorePlugins"], function() {
manifest.editor.dependencies.forEach(function(dependency) {
var resource = '/content-plugins/' + plugin + '/' + dependency.src;
if (dependency.type == 'js') {
fs.appendFile('generic-editor/scripts/coreplugins.js', "org.ekstep.pluginframework.resourceManager.loadExternalResource('" + resource + "', 'js')" + "\n");
fs.appendFile('generic-editor/scripts/coreplugins.js', "org.ekstep.pluginframework.resourceManager.loadExternalResource('" + resource + "', 'js')" + "\n", function(){});
} else if (dependency.type == 'css') {
fs.appendFile('generic-editor/scripts/coreplugins.js', "org.ekstep.pluginframework.resourceManager.loadExternalResource('" + resource + "', 'css')" + "\n");
fs.appendFile('generic-editor/scripts/coreplugins.js', "org.ekstep.pluginframework.resourceManager.loadExternalResource('" + resource + "', 'css')" + "\n", function(){});
}
});
}
var plugin = fs.readFileSync('plugins/' + plugin + '/editor/plugin.min.js', 'utf8');
fs.appendFile('generic-editor/scripts/coreplugins.js', 'org.ekstep.pluginframework.pluginManager.registerPlugin(' + JSON.stringify(manifest) + ',eval(\'' + plugin.replace(/'/g, "\\'") + '\'))' + '\n');
fs.appendFile('generic-editor/scripts/coreplugins.js', 'org.ekstep.pluginframework.pluginManager.registerPlugin(' + JSON.stringify(manifest) + ',eval(\'' + plugin.replace(/'/g, "\\'") + '\'))' + '\n', function(){});
});
return gulp.src('plugins/**/plugin.min.js', {
read: false
Expand Down
3 changes: 2 additions & 1 deletion karmaconf.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ module.exports = function(config) {
reporters: [
{ type: 'html', dir: 'coverage/' },
{ type: 'text-summary' },
{ type: 'cobertura' }
{ type: 'cobertura' },
{ type: 'lcov', dir: 'coverage/lcov' }
],
}
})
Expand Down
Loading