This is to continue the discussion started in #4600 about Jenkins and protractor.
I tested https://github.com/mark-adams/docker-chromium-xvfb/tree/master/images/base to run chrome in docker and it works well.
I guess we can adapt to run firefox instead since that's what we set in the protractor conf file.
Now the difficulty with protractor is that it needs to start the application and you probably need other elements to run (Database, Elastic Search, JHipster Registry, etc...)
So I see several possibilities:
Opinion ?
cc @mraible
~On second thought 2 and 3 would cause issues when multiple builds run in parallel.~
So it appears the best solution I found is actually (2) using docker container linking to give access to the containers. This is kinda like what is done in src/main/docker/app.yml but without docker-compose.
You can try the following pipeline script for instance
node {
stage('checkout') {
git url: 'https://github.com/jhipster/jhipster-sample-app.git'
}
def mysql = docker.image('mysql:5.7.13').run('-e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -e MYSQL_DATABASE=mysql')
docker.image('openjdk:8').inside("--link ${mysql.id}:mysql -u root -e MAVEN_OPTS=\"-Duser.home=./\"") {
stage('check tools') {
sh "java -version"
}
stage('clean') {
sh "./mvnw clean"
}
stage('run') {
sh "echo '{ \"allow_root\": true }' > /root/.bowerrc"
sh "export SPRING_DATASOURCE_URL=\"jdbc:mysql://mysql:3306/mysql?useUnicode=true&characterEncoding=utf8&useSSL=false\" && ./mvnw -Pprod"
}
}
}
Note: this script is not usable as-is as it will block at the end. A full script would need to run the server in background, wait that it is started, launch the protractor tests and call mysql.stop()
to remove the mysql container.
As this uses docker, it is dependent on #4600 being merged.
Also as there is quite a bit of work, are there people interested in having Protractor tests running in Jenkins (please thumb up if interested) ?
Closing this as #4903 is merged
Yes even though running the protractor tests is not part of the PR. But this will be a lot of work so no need to keep this issue opened.
Most helpful comment
So it appears the best solution I found is actually (2) using docker container linking to give access to the containers. This is kinda like what is done in src/main/docker/app.yml but without docker-compose.
You can try the following pipeline script for instance
Note: this script is not usable as-is as it will block at the end. A full script would need to run the server in background, wait that it is started, launch the protractor tests and call
mysql.stop()
to remove the mysql container.As this uses docker, it is dependent on #4600 being merged.
Also as there is quite a bit of work, are there people interested in having Protractor tests running in Jenkins (please thumb up if interested) ?