Skip to content

Commit

Permalink
Jenkins declarative pipeline (#659)
Browse files Browse the repository at this point in the history
* Jenkins declarative pipeline

- test declarative pipeline

* - update jenkinsfile

* - update wishlist test check

* - fix wishlist navigation
  • Loading branch information
shaunmaharaj authored Mar 31, 2020
1 parent 9e07ff5 commit 1e2b2b7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
40 changes: 25 additions & 15 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!groovy
currentBuild.description = "Image Tag: ${DOCKER_IMAGE_TAG}"

timestamps {
ansiColor('xterm') {
node('node-small') {
stage('SETUP') {
pipeline {
agent {
label 'node-small'
}

stages {
stage('SETUP') {
steps {
deleteDir()
dir('scm'){
checkout scm
Expand All @@ -12,7 +16,9 @@ timestamps {
git branch: SOLR_HOME_BRANCH, url: SOLR_HOME_GIT_URL
}
}
stage('BUILD') {
}
stage('BUILD') {
steps {
dir('scm') {
// Build the docker image, push to aws
sh """
Expand All @@ -26,7 +32,9 @@ timestamps {
"""
}
}
stage('UNDEPLOY_EXISTING') {
}
stage('UNDEPLOY_EXISTING') {
steps {
// Remove if exists: working directory, docker containers, and images
sh """
ssh -i ${EC2_INSTANCE_SSH_KEY} ${EC2_INSTANCE_USER}@${EC2_INSTANCE_HOST} \"\"\"
Expand All @@ -43,7 +51,9 @@ timestamps {
\"\"\"
"""
}
stage('DEPLOY') {
}
stage('DEPLOY') {
steps {
// Create the working directory
sh """
ssh -i ${EC2_INSTANCE_SSH_KEY} ${EC2_INSTANCE_USER}@${EC2_INSTANCE_HOST} "mkdir -p ref-store-service"
Expand Down Expand Up @@ -73,17 +83,17 @@ timestamps {
docker-compose up -d
\"\"\"
"""

currentBuild.description = "Image Tag: ${DOCKER_IMAGE_TAG}"
}
stage('TEST') {
}
stage('TEST') {
steps {
// Run unit & Puppeteer tests
timeout(time: 10, unit: 'MINUTES') {
sh """
ssh -i ${EC2_INSTANCE_SSH_KEY} ${EC2_INSTANCE_USER}@${EC2_INSTANCE_HOST} \"\"\"
sleep 35 && docker exec -t store sh -c 'export TEST_HOST=http://${EC2_INSTANCE_HOST}:8080 && CI=true npm test'
sh """
ssh -i ${EC2_INSTANCE_SSH_KEY} ${EC2_INSTANCE_USER}@${EC2_INSTANCE_HOST} \"\"\"
sleep 35 && docker exec -t store sh -c 'export TEST_HOST=http://${EC2_INSTANCE_HOST}:8080 && CI=true npm test'
\"\"\"
"""
"""
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/e2e/wishlist.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('Wishlist', () => {
// When I remove the wishlist item
await page.waitForSelector(REMOVE_FROM_WISHLIST_BUTTON);
await page.click(REMOVE_FROM_WISHLIST_BUTTON);
await page.waitForNavigation({ waitUntil: 'domcontentloaded' });
await page.waitForSelector(WISHLIST_CONTAINER);

// Then Lineitem is no longer in the wishlist
await page.waitForSelector(LOGGED_IN_BUTTON);
Expand Down

0 comments on commit 1e2b2b7

Please sign in to comment.