Skip to content
Open
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
File renamed without changes.
2 changes: 1 addition & 1 deletion .openshift-applier/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# From 'openshift-applier'
- src: https://github.com/redhat-cop/openshift-applier
scm: git
version: v2.0.9
version: v2.0.10
name: openshift-applier
42 changes: 7 additions & 35 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pipeline {
environment {
// Global Vars
NAMESPACE_PREFIX="<YOUR_NAME>"
GITLAB_DOMAIN = "gitlab.apps.change.me.com"
GITLAB_PROJECT = "<GIT_USERNAME>"
GITLAB_DOMAIN = "<GITLAB_FQDN>"
GITLAB_USERNAME = "<GITLAB_USERNAME>"

PIPELINES_NAMESPACE = "${NAMESPACE_PREFIX}-ci-cd"
APP_NAME = "todolist"
Expand All @@ -18,7 +18,7 @@ pipeline {
JOB_NAME = "${JOB_NAME}".replace("/", "-")

GIT_SSL_NO_VERIFY = true
GIT_CREDENTIALS = credentials('jenkins-git-creds')
GIT_CREDENTIALS = credentials("${NAMESPACE_PREFIX}-ci-cd-gitlab-auth")
}

// The options directive is for configuration that applies to the whole job.
Expand Down Expand Up @@ -73,16 +73,13 @@ pipeline {
}
}
steps {
// git branch: 'develop',
// credentialsId: 'jenkins-git-creds',
// url: 'https://gitlab-${NAMESPACE_PREFIX}-ci-cd.apps.somedomain.com/${NAMESPACE_PREFIX}/todolist.git'
sh 'printenv'

echo '### Install deps ###'
sh 'npm install'

echo '### Running tests ###'
sh 'npm run test:all:ci'
// sh 'npm run test:all:ci'

echo '### Running build ###'
sh 'npm run build:ci'
Expand All @@ -96,19 +93,18 @@ pipeline {
post {
always {
archive "**"
junit 'test-report.xml'
junit 'reports/server/mocha/test-results.xml'
// ADD TESTS REPORTS HERE

// publish html

// Notify slack or some such
}
success {
echo "Git tagging"
sh'''
git config --global user.email "jenkins@jmail.com"
git config --global user.name "jenkins-ci"
git tag -a ${JENKINS_TAG} -m "JENKINS automated commit"
# git push https://${GIT_CREDENTIALS_USR}:${GIT_CREDENTIALS_PSW}@${GITLAB_DOMAIN}/${GITLAB_PROJECT}/${APP_NAME}.git --tags
git push https://${GIT_CREDENTIALS_USR}:${GIT_CREDENTIALS_PSW}@${GITLAB_DOMAIN}/${GITLAB_USERNAME}/${APP_NAME}.git --tags
'''
}
failure {
Expand Down Expand Up @@ -178,29 +174,5 @@ pipeline {
waitUnit: 'sec'
}
}
stage("e2e test") {
agent {
node {
label "jenkins-slave-npm"
}
}
when {
expression { GIT_BRANCH ==~ /(.*master|.*develop)/ }
}
steps {
unstash 'source'

echo '### Install deps ###'
sh 'npm install'

echo '### Running end to end tests ###'
sh 'npm run e2e:ci'
}
post {
always {
junit 'reports/e2e/specs/*.xml'
}
}
}
}
}
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"serve": "vue-cli-service serve --open",
"serve:all": "npm-run-all -p -r serve dev:server",
"start": "node server/app.js",
"stop:all": "killall node",
"clean": "rm -rf reports package-contents* reports dist ",
"build:client": "vue-cli-service build",
"build:ci": "cp src/config/openshift.js src/config/index.js && npm run build:client && mkdir -p package-contents && cp -vr dist server Dockerfile package.json package-contents",
Expand All @@ -100,10 +101,11 @@
"test:server:ci": "export MOCHA_FILE='reports/server/mocha/test-results.xml' && export NODE_ENV=ci && node_modules/.bin/nyc node_modules/.bin/mocha 'server/**/*.spec.js' -R mocha-junit-reporter --exit",
"test:all": "npm run test:client && npm run test:server",
"test:all:ci": "npm run test:client && npm run test:server:ci",
"selenium": "java -Dwebdriver.chrome.driver=\"$(pwd)/node_modules/chromedriver/lib/chromedriver/chromedriver\" -jar $(pwd)/node_modules/selenium-server/lib/runner/selenium-server-standalone-3.11.0.jar -port 8084",
"selenium": "nohup java -Dwebdriver.chrome.driver=\"$(pwd)/node_modules/chromedriver/lib/chromedriver/chromedriver\" -jar $(pwd)/node_modules/selenium-server/lib/runner/selenium-server-standalone-3.11.0.jar -port 8084 0<&- &>/dev/null &",
"e2e": "export SELENIUM_PORT=443; export SELENIUM_SSL=1; export SELENIUM_HOST=$(oc get routes/$(oc get routes | grep 8084 | cut -d ' ' -f 1) --template='{{.spec.host}}') && export E2E_TEST_ROUTE=$(oc get routes/$(oc get routes | grep 8080 | cut -d ' ' -f 1) --template='{{.spec.host}}') && echo \"testing app on https://${E2E_TEST_ROUTE} \n with selenium address ${SELENIUM_HOST}\" && vue-cli-service e2e --env jenkins --url https://${E2E_TEST_ROUTE}",
"e2e:jenkins": "npm-run-all -p -r selenium e2e:ci",
"e2e:jenkins": "npm-run-all selenium e2e:ci",
"e2e:ci": "vue-cli-service e2e --env jenkins --url http://${E2E_TEST_ROUTE}",
"e2e:ide": "vue-cli-service e2e --url=http://localhost:8080 --env jenkins",
"lint": "vue-cli-service lint",
"lint:ci": "vue-cli-service lint --format checkstyle > eslint-report.xml",
"jshint": "./node_modules/.bin/grunt jshint",
Expand All @@ -118,7 +120,7 @@
"mongo:start": "docker start mongo-local",
"mongo:start-ide": "mongod --dbpath /projects/mongo",
"mongo:stop-ide": "killall mongod",
"prepare-nexus": "curl -X POST -u admin:admin123 -H 'Content-Type: application/json' -H 'Accept: application/json' -d @nexus.json http://${NEXUS_SERVICE_HOST}:${NEXUS_SERVICE_PORT}/service/siesta/rest/v1/script && curl -X POST -u admin:admin123 -H 'Content-Type: text/plain' -H 'Accept: application/json' http://${NEXUS_SERVICE_HOST}:${NEXUS_SERVICE_PORT}/service/siesta/rest/v1/script/zip/run",
"prepare-nexus": "curl -X POST -u admin:admin123 -H 'Content-Type: application/json' -H 'Accept: application/json' -d @nexus.json https://${NEXUS_SERVICE_HOST}:${NEXUS_SERVICE_PORT}/service/siesta/rest/v1/script && curl -X POST -u admin:admin123 -H 'Content-Type: text/plain' -H 'Accept: application/json' https://${NEXUS_SERVICE_HOST}:${NEXUS_SERVICE_PORT}/service/siesta/rest/v1/script/zip/run",
"publish": "curl -vvv -u admin:admin123 --upload-file package-contents.zip http://${NEXUS_SERVICE_HOST}:${NEXUS_SERVICE_PORT}/repository/zip/com/redhat/todolist/${JOB_NAME}.${BUILD_NUMBER}/package-contents.zip",
"publish:get": "curl -vvv http://admin:admin123@${NEXUS_SERVICE_HOST}:${NEXUS_SERVICE_PORT}/repository/zip/com/redhat/todolist/${BUILD_TAG}/package-contents.zip -o package-contents.zip"
},
Expand Down