Travis-ci console asks for answers - grails

How can i answer a question made by the console in travis-ci? I made a script that is downloading gvm but right after it completes i receive something like this:
"Do you want grails 2.1.5 to be set as default? (Y/n):"
Right after this question the build can't go foward, i tried to use expects but i was not very successful, my travis.yml is this:
language: groovy
jdk:
- oraclejdk7
before_install:
rm -rf ~/.gvm
curl -s get.gvmtool.net > ~/install_gvm.sh
chmod 775 ~/install_gvm.sh
~/install_gvm.sh
source "/home/travis/.sdkman/bin/sdkman-init.sh"
sdk install grails 2.1.5
echo "gvm_auto_answer=Y" > ~/.sdkman/bin/config
branches:
only:
- master
script: grails test-app --non-interactive
EDIT Grails wrapper is not working as you can see here
https://travis-ci.org/jpms2/ResS/builds/81761164
I seemed to find a problem like mine that happened with gvm instalation, the solution to this problem was a command like this:
echo "gvm_auto_answer=true" >> ~/.gvm/etc/config
So i tried to use this command and had no success:
echo "gvm_auto_answer=Y" >> ~/.sdkman/etc/config

I did find a way to pass the log message, using
echo sdkman_auto_answer=true > ~/.sdkman/etc/config
my travis.yml file is like this now:
language: groovy
jdk:
- oraclejdk7
before_install:
rm -rf ~/.gvm
curl -s get.gvmtool.net > ~/install_gvm.sh
chmod 775 ~/install_gvm.sh
~/install_gvm.sh
echo sdkman_auto_answer=true > ~/.sdkman/etc/config
source "/home/travis/.sdkman/bin/sdkman-init.sh"
sdk install grails 2.1.5
branches:
only:
- master
script: grails test-app --non-interactive

Related

codeceptjs tests 'before each' hook error fails to launch chrome. tests were working fine a week ago

I asked this question several months ago here but the solution was obviously not helpful because here I am again with the exact same problem. in that link I was told to change my image from node:latest to node:13. this no longer fixes the problem. I have tried every version of node and none work. I have tried using premade images of puppeteer/codeceptjs but that does not work. here's the problem: 4 months ago I coded a bunch of tests. they worked fine so i set them up on gitlab to run automated tests. 2 months ago I had that issue. I went from node:latest to node:13 but as of last week NONE of the tests run. ZERO lines of code were changed between then and now. before any test runs I get the following error:
smoke tests done by user profile
"before each" hook: codeceptjs.before for "user creates a new page and inserts a regular 1":
Failed to launch chrome!
/builds/ameen3/me-cloud-user-tests/node_modules/puppeteer/.local-chromium/linux-706915/chrome-linux/chrome: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
now I have searched all over the place for solutions to this problem. I opened an issue on codeceptjs' GitHub page but I have no reason to think they will provide any solution (they previously told me to upgrade my puppeteer version but stopped responding when I mentioned I was using the most recent version). I also found this link but it does not work for me because it involves 'sudo' which causes my gitlab pipeline to fail because 'sudo is not a recognized command'. so then there's this page. I have tried all the solutions on that page but with no luck. if the solution even mentions the word 'yarn' my gitlab.ci-yml file is marked as invalid. I even created a package.config file and inputed the same thing as they suggested in the top answer but it didn't work.
I am using the most recent version of puppeteer and the most recent version of codeceptjs. this is the gitlab.ci-yml file that was working up until a week ago
image: node:13
all_tests:
script:
- apt-get update && apt-get install -yq libgconf-2-4
- apt-get update && apt-get install -y wget --no-install-recommends && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && apt-get update && apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont --no-install-recommends && rm -rf /var/lib/apt/lists/* && apt-get purge --auto-remove -y curl && rm -rf /src/*.deb
- npm install
- npm i codeceptjs-puppeteer
- npm i codeceptjs puppeteer
- ln -sf ./node_modules/.bin/codeceptjs /usr/local/bin/codeceptjs
- npm i --save arrify
- ./node_modules/.bin/codeceptjs run --steps
cache:
paths:
- ./node_modules/.bin/codeceptjs
after_script:
- echo "Cleaning up"
- rm -rf "%CACHE_PATH%/%CI_PIPELINE_ID%"
here is the config file which was working until a week ago:
exports.config = {
tests: './tests/test_test.js',
output: './output',
helpers: {
Puppeteer: {
url: "http://localhost",
show: false,
chrome: {
"args": ["--no-sandbox", "--disable-setuid-sandbox"]
}
}
},
include: {
I: './steps_file.js',
login: './pages/login.js',
confluence: './pages/confluence.js',
editor: './pages/editor.js',
},
bootstrap: null,
mocha: {},
name: 'tests'
};
this link (which I have also tried) says to add some stuff to my package.json file. I never created one of these because I never needed one to run tests. now I have created one and following their instructions the tests still fail with this error
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected token p in JSON at position 1 while parsing near 'npm install puppeteer...'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
npm ERR! A complete log of this run can be found in:
so if anyone could link me to or explain to me what is wrong with my .ci-yml file. or how to make a working one. or even how they work it would be great. I'm so tired of dealing this issue and I hate puppeteer/codeceptjs with a passion now. but seriously how do I make this ci-yml file to work because a week ago there were 0 issues and now I'm lucky if a test goes 2 minutes before cancelling.
You could try running npm init -y inside your project folder to create the package.json file.

Install specific version of a plugin with install-plugin command

I cant see examples of how to do this:
https://jenkins.io/doc/book/managing/plugins/
I backup a list of all plugins installed and their versions.
I want to use install-plugin command to install all plugins (and their specific versions) from the list.
I dont see option to specify version to install-plugin command
To install a specific version you can run the command and pass a parameter with a colon like this:
install-plugins.sh git:3.9.1
or alternatively add the list of plugins to a file (plugins.txt for instance):
git:3.9.1
saml:1.0.7
and run it with the following command:
install-plugins.sh plugins.txt
You can download jar file from here: https://github.com/jenkinsci/plugin-installation-manager-tool
$ rm -rf /usr/share/jenkins/plugins/ldap*
$ ls /usr/share/jenkins/plugins/ldap*
ls: cannot access '/usr/share/jenkins/plugins/ldap*': No such file or directory
$ echo $JAVA_OPTS
-Djenkins.install.runSetupWizard=false
$ java $JAVA_OPTS -jar /opt/jenkins-plugin-manager-2.12.8.jar --plugins ldap:2.7
Done
$ ls /usr/share/jenkins/plugins/ldap*
/usr/share/jenkins/plugins/ldap.jpi
$ echo "http://<jenkins-url>/restart"
http://<jenkins-url>/restart
$ ls /usr/share/jenkins/plugins/ldap*
/usr/share/jenkins/plugins/ldap.jpi
/usr/share/jenkins/plugins/ldap:
META-INF WEB-INF
$ cat /usr/share/jenkins/plugins/ldap/META-INF/MANIFEST.MF
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: rsandell
Build-Jdk: 1.8.0_211
Extension-Name: ldap
Specification-Title: The Jenkins Plugins Parent POM Project
Implementation-Title: ldap
Implementation-Version: 2.7
Group-Id: org.jenkins-ci.plugins
Short-Name: ldap
Long-Name: LDAP Plugin
Url: https://github.com/jenkinsci/ldap-plugin
Compatible-Since-Version: 1.16
Minimum-Java-Version: 1.8
Plugin-Version: 2.7
Hudson-Version: 2.277.1
Jenkins-Version: 2.277.1
Plugin-Dependencies: mailer:1.34
Plugin-Developers:
Plugin-License-Name: The MIT license
Plugin-License-Url: https://opensource.org/licenses/MIT
Plugin-ScmUrl: https://github.com/jenkinsci/ldap-plugin

How can I configure Travis CI to test correct loading a library repo under PlatformIO?

I have a library used by a number of Arduino projects. I use PlatformIO as my build system, so I've created a library.json file in the root of the library to identify dependent libraries that should be loaded when I include this library in a project. All good.
Sometimes the dependent libraries get changed - PlatformIO is particularly sensitive to renaming them in the Arduino library.properties file. It is a pain when I discover that my library is broken only when I try to build a project that uses it.
I'd like to configure Travis to run periodically (thanks, Travis cron jobs!) and confirm that I can load all dependent libaries.
pio ci does not really apply to libraries. pio test requires a PlatformIO subscription (highly recommended, but not always an option).
Put the following in .travis.yml:
```
PlatformIO dependency test
- language: python
python: 2.7
install:
- pip install -U platformio
script:
- mkdir test_platformio_deps
- cd test_platformio_deps
- echo "[env:adafruit_feather_m0]" > platformio.ini
- echo "platform = atmelsam" >> platformio.ini
- echo "board = adafruit_feather_m0" >> platformio.ini
- echo "framework = arduino" >> platformio.ini
- if [ "${TRAVIS_PULL_REQUEST_SLUG}" = "" ]; then echo "lib_deps = SPI, https://github.com/${TRAVIS_REPO_SLUG}" ; else echo "lib_deps = SPI, https://github.com/${TRAVIS_PULL_REQUEST_SLUG}#${TRAVIS_PULL_REQUEST_BRANCH}" ; fi >> platformio.ini
- cat platformio.ini
- mkdir src
- echo "int main() {}" > src/main.cpp
- platformio run
cache:
directories:
- "~/.platformio"
```
It will create a simple project that depends on your library and then attempt to build it. If all dependencies load, it will succeed.
The tricky line with TRAVIS_PULL_REQUEST_SLUG handles running the test within a PR.

Grails: command not found with Travis-CI

I want to use Travis-CI with my Grails 3.0.9 app. For this I created a .travis.yml file:
language: groovy
jdk:
- oraclejdk7
before_install:
- curl -s get.sdkman.io | bash
- source "$HOME/.sdkman/bin/sdkman-init.sh"
- sdk install grails 3.0.9
- sdk default grails 3.0.9
script: grails test-app --stacktrace
When the Travis-CI service wants to build my application, it ends up with this error:
$ export GRAILS_HOME=/home/travis/.sdkman/candidates/grails/3.0.9/
$ export PATH=$PATH:$GRAILS_HOME/bin
$ ./gradlew assemble
...
(downloading a lot of gradle dependencies)
...
BUILD SUCCESSFUL
$ grails test-app
/home/travis/build.sh: line 45: grails: command not found
So do I have to install Grails somehow else or is it because of a missing/wrong path variable?
I've found a working .travis.yml here:
language: groovy
jdk:
- oraclejdk7
before_install:
- curl -s http://get.sdkman.io | bash
- echo sdkman_auto_answer=true > ~/.sdkman/etc/config
- source "/home/travis/.sdkman/bin/sdkman-init.sh"
- sdk install grails 3.0.9
script: grails test-app --stacktrace
Update:
Use get.sdkman.io since get.gvmtool.net doesn't work anymore.

Travis build stucks on jacoco

This is my travis.yml
language: java
sudo: required
jdk:
- oraclejdk8
install: true
script:
- sudo apt-get update && sudo apt-get install oracle-java8-installer
- java -version
after_success:
- ./gradlew test jacocoTestReport coveralls
And this is the travis output:
[...]
:processTestResources
:testClasses
:test
Download https://repo1.maven.org/maven2/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.pom
Download https://repo1.maven.org/maven2/org/jacoco/org.jacoco.build/0.7.5.201505241946/org.jacoco.build-0.7.5.201505241946.pom
Download https://repo1.maven.org/maven2/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946.jar
No output has been received in the last 10 minutes, this potentially indicates a stalled build or something wrong with the build itself.
The build has been terminated
I have no idea why and how I can debug this :\ any hints?
Works on my machine.
It turned out it has nothing to do with jacoco. I'm using JavaFX with TestFX and, of course, it needs a frame buffer. It works after enabling xvfb:
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"

Resources