Compare commits
6 commits
master
...
custom-pip
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c2d797d13 | ||
|
|
decebd1395 | ||
|
|
72afdb02db | ||
|
|
fb23d37963 | ||
|
|
88342e4a22 | ||
|
|
a77231a314 |
3 changed files with 28 additions and 13 deletions
38
books/jenkins/Jenkinsfile
vendored
38
books/jenkins/Jenkinsfile
vendored
|
|
@ -5,16 +5,16 @@ pipeline {
|
||||||
}
|
}
|
||||||
agent {
|
agent {
|
||||||
node {
|
node {
|
||||||
//TODO: Add label for Node.js jenkins agent
|
label 'nodejs'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
//TODO: Edit these vars as per your env
|
DEV_PROJECT = "zqjsga-books-dev"
|
||||||
DEV_PROJECT = "youruser-books-dev"
|
STAGE_PROJECT = "zqjsga-books-stage"
|
||||||
STAGE_PROJECT = "youruser-books-stage"
|
APP_GIT_URL = "https://github.com/shautvast/DO288-apps"
|
||||||
APP_GIT_URL = "https://github.com/youruser/DO288-apps"
|
//NEXUS_SERVER = "http://nexus-common.apps.cluster.domain.example.com/repository/nodejs"
|
||||||
NEXUS_SERVER = "http://nexus-common.apps.cluster.domain.example.com/repository/nodejs"
|
NEXUS_SERVER = "http://nexus-common.apps.eu45.prod.nextcle.com/repository/nodejs"
|
||||||
|
|
||||||
// DO NOT CHANGE THE GLOBAL VARS BELOW THIS LINE
|
// DO NOT CHANGE THE GLOBAL VARS BELOW THIS LINE
|
||||||
APP_NAME = "books"
|
APP_NAME = "books"
|
||||||
|
|
@ -58,7 +58,11 @@ pipeline {
|
||||||
'''
|
'''
|
||||||
|
|
||||||
echo '### Creating a new app in DEV env ###'
|
echo '### Creating a new app in DEV env ###'
|
||||||
//TODO: Create a new app and expose the service
|
sh '''
|
||||||
|
oc project ${DEV_PROJECT}
|
||||||
|
oc new-app --as-deployment-config --name books nodejs:12~${APP_GIT_URL} --build-env npm_config_registry=${NEXUS_SERVER} --context-dir ${APP_NAME}
|
||||||
|
oc expose svc/${APP_NAME}
|
||||||
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,7 +103,11 @@ pipeline {
|
||||||
timeout(time: 60, unit: 'MINUTES') {
|
timeout(time: 60, unit: 'MINUTES') {
|
||||||
input message: "Promote to Staging?"
|
input message: "Promote to Staging?"
|
||||||
}
|
}
|
||||||
//TODO: Tag the books:latest image stream as books:stage
|
script {
|
||||||
|
openshift.withCluster() {
|
||||||
|
openshift.tag("${DEV_PROJECT}/books:latest", "${STAGE_PROJECT}/books:stage")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,7 +121,11 @@ pipeline {
|
||||||
'''
|
'''
|
||||||
|
|
||||||
echo '### Creating a new app in Staging ###'
|
echo '### Creating a new app in Staging ###'
|
||||||
//TODO: Create a new app in stage using the books:stage image stream and expose the service
|
sh '''
|
||||||
|
oc project ${STAGE_PROJECT}
|
||||||
|
oc new-app --name books -i books:stage --as-deployment-config
|
||||||
|
oc expose svc/${APP_NAME}
|
||||||
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,8 +137,12 @@ pipeline {
|
||||||
routeHost = readFile('routehost').trim()
|
routeHost = readFile('routehost').trim()
|
||||||
|
|
||||||
openshift.withCluster() {
|
openshift.withCluster() {
|
||||||
//TODO: Watch deployment until pod is in 'Running' state
|
openshift.withProject( "${STAGE_PROJECT}" ) {
|
||||||
|
def deployment = openshift.selector("dc", "${APP_NAME}").rollout()
|
||||||
|
openshift.selector("dc", "${APP_NAME}").related('pods').untilEach(1) {
|
||||||
|
return (it.object().status.phase == "Running")
|
||||||
|
}
|
||||||
|
}
|
||||||
echo "Deployment to Staging env is complete. Access the app at the URL http://${routeHost}."
|
echo "Deployment to Staging env is complete. Access the app at the URL http://${routeHost}."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ const router = express.Router();
|
||||||
|
|
||||||
const authors = require('../data/authors');
|
const authors = require('../data/authors');
|
||||||
|
|
||||||
var user;
|
|
||||||
|
|
||||||
/* GET users listing. */
|
/* GET users listing. */
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ describe('Books App routes test', () => {
|
||||||
.get('/authors')
|
.get('/authors')
|
||||||
.end((err, res) => {
|
.end((err, res) => {
|
||||||
expect(res).to.have.status(200);
|
expect(res).to.have.status(200);
|
||||||
expect(res.text).to.include('James_Joyce');
|
expect(res.text).to.include('James Joyce');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue