Search code examples
jenkinscontinuous-integrationcompass

Compass compile on Jenkins CI


I have the following execute script on my CI environment

cd /var/www/html

php vendor/bin/phpunit app/tests --log-junit /var/lib/jenkins/jobs/Closecall/workspace/tests/reports/junit.xml
php vendor/bin/phinx migrate -e development
sudo compass compile

SSHing onto the CI and compiling myself works fine, however when the CI executes this on build I get the following error

+ sudo compass compile
sudo: no tty present and no askpass program specified
Build step 'Execute shell' marked build as failure
Recording test results
Finished: FAILURE

Any ideas?


Solution

  • sudo by default tries to open /dev/tty for read-write. You might not have /dev/tty available on the machine you use to build. The need for tty is configured in the /etc/sudoers file.

    sudo has an option -S to read the password from standard input instead of /dev/tty. You should be able to compile using sudo -S.

    The -S (stdin) option causes sudo to read the password from the standard input instead of the terminal device. The password must be followed by a newline character.

    http://linux.die.net/man/8/sudo