-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
31 lines (31 loc) · 955 Bytes
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pipeline {
environment {
DATABASE_URL = credentials('database-url')
RAILS_MASTER_KEY = credentials('rails-master-key')
}
agent {
dockerfile {
args '-u root -e DATABASE_URL=$DATABASE_URL -e RAILS_MASTER_KEY=$RAILS_MASTER_KEY -e RAILS_ENV=test -e DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true --network="host"'
additionalBuildArgs "-t haiafara-jenkins-build:${env.BRANCH_NAME}-${env.BUILD_NUMBER}"
}
}
stages {
stage('test') {
steps {
sh 'sed -i "s/haiafara_test/haiafara_test_$EXECUTOR_NUMBER/g" config/database.yml'
sh 'bundle exec rails db:test:prepare'
sh 'ln -s /usr/src/app/node_modules node_modules'
sh 'bundle exec rails webpacker:compile'
sh 'bundle exec rspec'
}
}
}
/*
post {
always {
echo 'Clean up Docker images'
sh 'docker rmi --force $(docker images --quiet --filter=reference="jenkins-test-build")'
}
}
*/
}