-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile_CNP
35 lines (28 loc) · 1.16 KB
/
Jenkinsfile_CNP
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
32
33
34
35
#!groovy
@Library("Infrastructure")
def type = "ruby"
def product = "et-pet"
def component = "admin"
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)
def rubyBuilder = new uk.gov.hmcts.contino.RubyBuilder(this)
withPipeline(type, product, component) {
env.RAILS_ENV = 'test'
env.DB_HOST = 'localhost'
env.DB_USER = 'postgres'
env.DB_PORT = '5421'
env.DB_PASSWORD = 'postgres'
env.NODE_OPTIONS='--openssl-legacy-provider'
env.ENABLE_COVERAGE='true'
before('test') {
sh script:"""
yarn install
docker stop pet-et-admin-test-postgres && docker rm pet-et-admin-test-postgres || echo 'Ignoring failure in stopping old postgres'
docker run --rm --name pet-et-admin-test-postgres --publish 5421:5432 -e POSTGRES_PASSWORD=postgres -d postgres
""", label: 'Start test postgres'
rubyBuilder.bundle("exec rails db:create db:migrate")
}
afterAlways('test') {
sh script: "docker stop pet-et-admin-test-postgres && docker rm pet-et-admin-test-postgres || echo 'Ignoring failure in stopping postgres'",
label: "docker stop pet-et-admin-test-postgres"
}
}