0

I have some doubts about the correct configuration of Jenkins to ensure the continuous integration of a Drupal project but I arrive at some contradictions. Let me explain: the deployment, after all, consists in executing:

cd / path / to / web / root
pull from git
drush config:import
drush cache:rebuild

The tests are launched with the command

../vendor/bin/phpunit --verbose --log-junit ../tests_output/phpunit.xml -c ../phpunit.xml

The contradiction is that I do not understand when to run the tests. Before the pull does not make sense because the last changes are missing, after the pull if any test goes wrong I should be able to restore the situation before the pull (but I'm not sure it's a safe action).

I'm trying to run the tests directly in the workspace of jenkins and to do this I also created a separate database, but at the moment I get the error:

Drupal\Tests\field_example\Functional\TextWidgetTest::testSingleValueField
Behat\Mink\Exception\ElementNotFoundException: Button with id|name|label|value "Log in" not found

What could be the best strategy to follow?

1 Answers1

0

So, your order seems ok - pull first then run tests. However, you can have 2 Jenkins jobs. First runs, your tasks. 2nd runs ONLY if your first job completes without failure. There are ways to get exit status from scripts - see following plugins/notes about that.

How to mark Jenkins builds as SUCCESS only on specific error exit values (other than 0)?

How to mark a build unstable in Jenkins when running shell scripts

salah-1
  • 1,299
  • 11
  • 15
  • I wrote a very simple test and jenkins worked well (this means that the script is correct, if the test goes wrong it stops all the execution). At this point the problem seems that from the workspace of jenkins I can not reach the db and the label "Log in" is not found. The test that goes wrong extends BrowserTestBase – Alessio Frabotta Sep 26 '18 at 09:04