diff --git a/Jenkinsfile b/Jenkinsfile
index 49cdcaee..7c30452c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -7,71 +7,238 @@ kind: Pod
spec:
containers:
- name: hybris
- image: signet/hybris-ant:6.6.0.15_3.0.3-UAT
+ image: signet/hybris-ant:1811_21-V8
command:
- /bin/bash
tty: true
+ - name: maven
+ image: maven:3.6.1-slim
+ command:
+ - cat
+ tty: true
'''
label 'sample-java-app'
idleMinutes 10
defaultContainer 'jnlp'
}
- }
+ }
- stages {
+
+ stages {
- stage('Build') {
- steps {
+ stage('Build') {
+ steps {
- container('hybris') {
+ container('hybris') {
- sh '''
- #!/bin/bash
- java -version
- pwd
+ sh '''
+ #!/bin/bash
+ export JAVA_HOME=/app/sapjvm8/sapjvm_8/
+ java -version
+ pwd
+ cd /
+ ls
+ cd /hybris-commerce-suite/
+ ls
+ ps -ef | grep java
+ cd /app/sapjvm8
+ ls
- mkdir -p /hybris-commerce-suite/hybris/bin/custom/training/trainingstorefront/
+ mkdir -p /hybris-commerce-suite/hybris/bin/custom/training/trainingstorefront/
- cp -R /$WORKSPACE/bin/custom/training/trainingstorefront/ /hybris-commerce-suite/hybris/bin/custom/training/trainingstorefront/
- cd /hybris-commerce-suite/hybris/bin/custom/training/trainingstorefront/
- ls
- cd /hybris-commerce-suite/hybris/bin/platform
- . ./setantenv.sh
- ant server -Dinput.template=develop
- '''
- }
- }
- }
+ cp -R /$WORKSPACE/bin/custom/training/trainingstorefront/ /hybris-commerce-suite/hybris/bin/custom/training/trainingstorefront/
+ cd /hybris-commerce-suite/hybris/bin/custom/training/trainingstorefront/
+ ls
+ cd /hybris-commerce-suite/hybris/bin/platform
+ . ./setantenv.sh
+ java -version
+ #ant addonuninstall -Daddonnames=assistedservicestorefront,smarteditaddon,captchaaddon,profiletagaddon -DaddonStorefront.yacceleratorstorefront=signetstorefront
+ #ant addoninstall -Daddonnames=assistedservicestorefront,smarteditaddon,captchaaddon,profiletagaddon -DaddonStorefront.yacceleratorstorefront=signetstorefront
+ ant customize clean build -Dinput.template=develop
+ ant production -Dproduction.legacy.mode=true -Dproduction.include.tomcat=true
+
+ '''
+ echo "Performing npm build..."
+ sh '''
+ cd /$WORKSPACE/bin/custom/training/trainingstorefront/web/
+ pwd
+ npm install -g grunt-cli
+ npm install grunt --save-dev
+ npm install grunt-contrib-less --save-dev
+ npm install grunt-contrib-watch --save-dev
+ npm install grunt-sync --save-dev
+ grunt
+
+ '''
+ }
+ }
+ }
- stage('Unit Test') {
- steps {
- container('hybris') {
-
- sh '''
+ stage('Unit Test') {
+ steps {
+ container('hybris') {
- cd /hybris-commerce-suite/hybris/bin/platform
- . ./setantenv.sh
- ant unittests
- '''
- }
- }
- }
+ sh '''
+
+ export JAVA_HOME=/app/sapjvm8/sapjvm_8/
+
+ cd /hybris-commerce-suite/hybris/bin/platform
+ . ./setantenv.sh
+ ant unittests
+
+ '''
+
+ jacoco(
+ execPattern: '**/*.exec',
+ classPattern: '**/*.class',
+ sourcePattern: '**/*.java',
+ exclusionPattern: '**/test*'
+ )
+
+ }
+ }
+ }
- stage('Sonarqube') {
- environment {
- scannerHome = tool 'Sonarqube'
- }
- steps {
- withSonarQubeEnv(installationName:'Sonarqube') {
- sh ''' $scannerHome/bin/sonar-scanner -X -Dsonar.projectName=hybris_sample -Dsonar.projectKey=hybris_sample -Dsonar.projectVersion=1.0 -Dsonar.extensions=trainingstorefront-Dsonar.host.url='https://sonarqube.sgn.devops.accentureanalytics.com/' -Dsonar.login=5f5c96ea5e46f6f532379d711295755534744ef8 -Dsonar.exclusions=file:**/gensrc/**,**/*demo.html,web/webroot/**/web.xml,web/webroot/WEB-INF/config/**/*,web/webroot/WEB-INF/lib/**/*,web/webroot/WEB-INF/views/welcome.jsp,web/webroot/index.jsp,**/*BeforeViewHandler*.java,web/webroot/static/bootstrap/js/*.js,web/webroot/static/theme/js/*.js,web/webroot/signetsmarteditmodule/js/*.js,**/*Constants.java,**/jalo/**,**/email/context/**,**/*Form*.java,web/src/**,**/platform/**,src/com/hybris/yprofile/**,resources/apache-nutch-1.16-custom-code/apache-nutch-1.16/**,**/*.java
- '''
- }
- timeout(time: 10, unit: 'MINUTES') {
- waitForQualityGate abortPipeline: true
- }
- }
- }
+ stage('Code Quality') {
+ environment {
+ scannerHome = tool 'Sonarqube'
+ }
+ steps {
+ container('maven') {
+ withSonarQubeEnv(installationName:'Sonarqube') {
+ sh ''' $scannerHome/bin/sonar-scanner -X -Dsonar.projectName=hybris_${BRANCH_NAME} -Dsonar.projectKey=hybris_sample -Dsonar.projectVersion=1.0 -Dsonar.qualityGate=Hybris_Sonar -Dsonar.extensions=trainingstorefront-Dsonar.host.url='https://sonarqube.sgn.devops.accentureanalytics.com/' -Dsonar.login=5f5c96ea5e46f6f532379d711295755534744ef8 -Dsonar.exclusions=file:**/gensrc/**,**/*demo.html,web/webroot/**/web.xml,web/webroot/WEB-INF/config/**/*,web/webroot/WEB-INF/lib/**/*,web/webroot/WEB-INF/views/welcome.jsp,web/webroot/index.jsp,**/*BeforeViewHandler*.java,web/webroot/static/bootstrap/js/*.js,web/webroot/static/theme/js/*.js,web/webroot/signetsmarteditmodule/js/*.js,**/*Constants.java,**/jalo/**,**/email/context/**,**/*Form*.java,web/src/**,**/platform/**,src/com/hybris/yprofile/**,resources/apache-nutch-1.16-custom-code/apache-nutch-1.16/**,**/*.java
+ '''
+ }
+ timeout(time: 10, unit: 'MINUTES') {
+ //sleep(60)
+ waitForQualityGate abortPipeline: true
+ }
+ }
+ }
+ }
+ stage('Create Temp Branch') {
+
+ steps {
+ echo "Create temp branch for cloud"
+ }
- }
+ }
+
+ stage('Deploy') {
+ when { expression { BRANCH_NAME == 'dev' || BRANCH_NAME == 'release' } }
+ steps {
+ container('hybris') {
+
+ echo "I am executing Deploy to target environment."
+ sh '''
+ cd /app/sap_cli/bin/
+ export JAVA_HOME=/app/sapmachine-jdk-11.0.10/
+ ./sapccm --help
+ '''
+
+ /*
+ sapccm config set auth-credentials {TOKEN_VALUE}
+ echo "Create a Build"
+ sapccm build create –application-code=commerce-cloud --branch=BRANCH_NAME –name=BUILD_NAME –no-wait –subscription-code= SUBSCRIPTION_CODE
+
+ echo "Check a Build"
+ sapccm build show –subscription-code=SUBSCRIPTION_CODE --build-code=BUILD_CODE
+
+ echo "Create a Deployment"
+ sapccm deployment create –build-code=BUILD_CODE --subscription-code=SUBSCRIPTION_CODE --database-update-mode=NONE/UPDATE/INITIALIZE --environment-code=d1/s1/p1 --strategy=CREATE/ROLLING_UPDATE --subscriptioni-code=SUBSCRIPTION_CODE
+
+ echo "Check Deployment"
+ sapccm deployment list –subscription-code=SUBSCRIPTION_CODE
+ */
+
+ }
+ }
+ }
+
+ stage('Post Deploy Tests') {
+ when { expression { BRANCH_NAME == 'dev' || BRANCH_NAME == 'release' } }
+ parallel {
+ stage('Smoke Test') {
+ steps {
+
+ script {
+ propfile = readProperties(file: './devops.properties')
+ println("SmokeTest:" + propfile['smoke_test'])
+ println("reading properties ...")
+ if (propfile['smoke_test'] == "true") {
+ echo "I am executing Smoke Test on target dev environment post deployment"
+
+ /*RESP=`curl -X GET "${bamboo.uri}/RequestsRunning" -H "accept: application/xml" -H "authorization: bearer lR0AA2qfq7v9Ry96vDAgqcer1GPVd5yStmv1_aJVFS43rk06EytB7WsS0_owoiXIgpOXmZVEfkY4ST0JwHtRBk7RH0QRaldWtQT8udC0VdimdGx38RddY2sGaeeF0t9Aflr5rh1Jc_EUfkNK8YrKVxQ6kxB05aCe46CD2fkognv7TiJATmht-ycUjEsd_oy8jH5EK9fmn9eL-wXavNTQcEdsUmFm3-2r3IJDzMK7XCa74qu353yOKLvVyZ1yYQBnc1_fY5GS1BDrFLUZprxpAS30lGEu-d_JTTOQ989UJtIEB3cZzDkIQzeqdYBGCsiDdjdHo2DC1FK2kVPyBITTbQ"`
+ echo "The response for current execution status is: $RESP"
+ if [ "$RESP" != "[]" ];
+ then
+ echo "There is a test executing currently in Worksoft. Hence, not proceeding with the execution of Worksoft test cases."
+ exit 1
+ else
+ echo "There are no tests executing right now. Hence, proceeding with Worksoft test execution"
+ fi
+ # To abort the request before attempting to re-run, uncomment and run below line.
+ # abort=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/Request/${bamboo.RequestID}/abort/)
+ guid=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "parameters: {TestEnv}{${bamboo.stage_name}}" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/ExecuteRequest/ | tr -d \")
+ echo "The GUID is: $guid"
+ status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \})
+ echo "The status is: $status"
+ while [[ $status != *"Completed"* ]]
+ do
+ status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \})
+ echo "The status is: $status"
+ sleep 15
+ done
+ status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/)
+ echo "The status is: $status"
+ execstatus=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $3}' | tr -d \" | tr -d \})
+ echo "The exec status is: $execstatus"
+ if [[ $execstatus != *Passed* ]];
+ then
+ echo "Failed"
+ exit 1
+ else
+ echo "Passed"
+ exit
+ fi
+ exit */
+ }
+ }
+ }
+ }
+ stage('Security Test') {
+ steps {
+ echo 'I am running Security Test here'
+ }
+ }
+ }
+ }
+ }
+ post {
+
+ always {
+ script {
+ //if (propfile['javadoc'] == "true") {
+ javadoc(javadocDir: "/$WORKSPACE/", keepAll: true)
+ //}
+ }
+ }
+
+ failure {
+ /*mail bcc: '',
+ body: "Example
\n
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}",
+ cc: '',
+ charset: 'UTF-8',
+ from: '',
+ mimeType: 'text/html',
+ replyTo: '',
+ subject: "ERROR CI: Project name -> ${env.JOB_NAME}",
+ to: "foo@foomail.com";*/
+ echo 'I am sending a notification with failure'
+ }
+ success {
+ echo 'I am sending a notification with success'
+ }
+ }
}
diff --git a/bin/custom/training/trainingstorefront/Gruntfile.js b/bin/custom/training/trainingstorefront/Gruntfile.js
new file mode 100644
index 00000000..63f7cbc9
--- /dev/null
+++ b/bin/custom/training/trainingstorefront/Gruntfile.js
@@ -0,0 +1,84 @@
+module.exports = function(grunt) {
+ // Project configuration.
+ grunt.initConfig({
+ pkg: grunt.file.readJSON('package.json'),
+ watch: {
+ less: {
+ files: ['webroot/WEB-INF/_ui-src/shared/less/variableMapping.less','webroot/WEB-INF/_ui-src/shared/less/generatedVariables.less',
+ 'webroot/WEB-INF/_ui-src/responsive/lib/ybase-*/less/*', 'webroot/WEB-INF/_ui-src/**/themes/**/less/*.less'],
+ tasks: ['less'],
+ },
+ fonts: {
+ files: ['webroot/WEB-INF/_ui-src/**/themes/**/fonts/*'],
+ tasks: ['sync:syncfonts'],
+ },
+ ybasejs: {
+ files: ['webroot/WEB-INF/_ui-src/responsive/lib/ybase-0.1.0/js/**/*.js'],
+ tasks: ['sync:syncybase'],
+ },
+ jquery: {
+ files: ['webroot/WEB-INF/_ui-src/responsive/lib/jquery*.js'],
+ tasks: ['sync:syncjquery'],
+ },
+ },
+ less: {
+ default: {
+ files: [
+ {
+ expand: true,
+ cwd: 'webroot/WEB-INF/_ui-src/',
+ src: '**/themes/**/less/style.less',
+ dest: 'webroot/_ui/',
+ ext: '.css',
+ rename:function(dest,src){
+ var nsrc = src.replace(new RegExp("/themes/(.*)/less"),"/theme-$1/css");
+ return dest+nsrc;
+ }
+ }
+ ]
+ },
+ },
+
+ sync : {
+ syncfonts: {
+ files: [{
+ expand: true,
+ cwd: 'webroot/WEB-INF/_ui-src/',
+ src: '**/themes/**/fonts/*',
+ dest: 'webroot/_ui/',
+ rename:function(dest,src){
+ var nsrc = src.replace(new RegExp("/themes/(.*)"),"/theme-$1");
+ return dest+nsrc;
+ }
+ }]
+ },
+ syncybase: {
+ files: [{
+ cwd: 'webroot/WEB-INF/_ui-src/responsive/lib/ybase-0.1.0/js/',
+ src: '**/*.js',
+ dest: 'webroot/_ui/responsive/common/js',
+ }]
+ },
+ syncjquery: {
+ files: [{
+ cwd: 'webroot/WEB-INF/_ui-src/responsive/lib',
+ src: 'jquery*.js',
+ dest: 'webroot/_ui/responsive/common/js',
+ }]
+ }
+ }
+
+});
+
+ // Plugins
+ grunt.loadNpmTasks('grunt-contrib-watch');
+ grunt.loadNpmTasks('grunt-contrib-less');
+ grunt.loadNpmTasks('grunt-sync');
+
+
+ // Default task(s). Run 'grunt watch' to start the watching task or add 'watch' to the task list and run 'grunt'.
+ grunt.registerTask('default', ['less', 'sync']);
+
+
+
+};
diff --git a/bin/custom/training/trainingstorefront/package.json b/bin/custom/training/trainingstorefront/package.json
index 0840dec7..72e7bb08 100644
--- a/bin/custom/training/trainingstorefront/package.json
+++ b/bin/custom/training/trainingstorefront/package.json
@@ -1,29 +1,21 @@
{
"name": "trainingstorefront",
"version": "0.0.0",
- "description": "For maintain and scan deliverable JS Libraries of the accelerator",
+ "description": "grunt config for the accelerator",
+ "private": true,
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "start": "grunt"
+ },
+ "author": "",
+ "license": "ISC",
"devDependencies": {
- "less-rhino" : "^1.7.3",
- "lessc-rhino" : "^1.7.3"
+ "grunt": "^0.4.5",
+ "grunt-contrib-less": "^1.0.1",
+ "grunt-contrib-watch": "^0.6.1",
+ "plugin": "^0.3.3"
},
"dependencies": {
- "enquire" : "2.1.2",
- "Imager" : "",
- "jquery" : "3.2.1",
- "jquery-ui" : "1.12.1",
- "jquery.blockUI" : "2.66",
- "jquery.colorbox" : "1.5.14",
- "jquery.currencies" : "",
- "jquery.form" : "4.2.2",
- "jquery.hoverIntent" : "1.8.1",
- "jquery.pstrength" : "1.2",
- "jquery.slideviewer" : "1.2",
- "jquery.syncheight" : "1.5",
- "jquery.tabs" : "",
- "jquery.tmpl" : "1.0.0",
- "jquery.waitforimages" : "1.4.2",
- "jquery.zoom" : "1.7.13",
- "owl.carousel" : "1.3.3",
- "purify" : ""
+ "grunt-sync": "0.0.8"
}
}
diff --git a/devops.properties b/devops.properties
new file mode 100644
index 00000000..9bf70d67
--- /dev/null
+++ b/devops.properties
@@ -0,0 +1 @@
+smoke_test=true