I have an open source project that I'd like to test using travis-ci. Sadly it is rather flaky and I'd like to know the reason. The tests write very verbose log files, so I'd like to export these, upon failure to Github Gist. There are command line tools that allow me to do that, gist-paste for instance, however I don't know how to run them only upon failure and without overriding the return code of the unittests, i.e., I'd still like travis-ci to notice the failure.
Great idea. Travis CI has a step in the build lifecycle called after_failure which will be fired after your testing script step has run and failed, as outlined on the "customizing the build" documentation page here.
In your .travis.yml file, you would add an after_failure step with a call to your gist-paste command, after setting the relevant Git tokens as encrypted environment variables I assume. You can then access plenty of information about the build from the many environment variables set by Travis during the build.
Related
I am having an issue while trying to set up a Github action that runs my Jest test suite. It fails due to using snapshots. It appears the issue might be caused by the colored formatting on the error messages.
Screenshot provided because I couldn't get the color formatting to copy over to this question using only markdown.
The tests all pass locally, so I know the logic works. It is an issue in the Github test runner, but I'm not sure how to address it. If I remove those particular tests, it will drop my code coverage. How do I get the tests to pass in this environment?
Assuming you run your tests with npm test, you can set the environment variable FORCE_COLOR and thereby make jest use color in GitHub Actions as well:
- run: npm test
env:
FORCE_COLOR: true
The thing is that I have in my repository 2 folders, one for my development code, and another one for my preproduction code, and I need to upload those files from development environment to preproduction after a job finished checking my dev code, how can I do this with Jenkins jobs?
I mean making kind of a commit moving files to one another?
Thanks!!
Add Build → Add build step → Execute shell or Execute Windows batch command after your checking job and add the commands you would use on the command line there.
Instead of preserving both the development and pre-production files in the same repository, you can use 2 different repositories(instead of 2 folders on 1 repository).
It would be easy to push the files to pre-production repository on a successful build and it looks more organised.
The post section defines actions which will be run at the end of the Pipeline run. A number of additional Conditions blocks are supported within the post section: always, changed, failure, success, and unstable. These blocks allow for the execution of steps at the tail-end of the Pipeline run, depending on the status of the Pipeline.
Check this link:
https://jenkins.io/doc/book/pipeline/syntax/#post
stages {
stage('Example') {
steps {
echo 'Hello World'
}
}
}
post {
success{
echo 'You can checkout your pre-production repository here and push files on a successful build'
}
}
I am trying to setup an IBM Block Chain setup in my local environment.
I am referring to the below manual for setup :
https://console.ng.bluemix.net/docs/services/blockchain/ibmblockchain_tutorials.html
When following these steps:
1) Setup the environment
Install GoLang
SETUP GOROOT & GOPATH
2) SETUP GITHUB
Under GITHUB setup, at point 6, When I try to run the command go build ./
It should give No errors/text. But it is giving an exception. Please have a look at below screenshot for an exact exception.
Exception-screenshot.
Can anyone help me, how can I solve this error, Ideally build should be successful.
The error is pretty obvious.
Replace
stub *shim.ChaincodeStub with stub shim.ChaincodeStubInterface everywhere in your chaincode_start.go file.
Furthermore, read the following issue on github as it will really help,
https://github.com/IBM-Blockchain/ibm-blockchain-issues/issues/29
When I build my cloudbees project it gives the following error:
ERROR: No such file /scratch/jenkins/workspace/glassfish-myruby/pom.xml
Where my project name is glassfish-myruby.
Go to the job you created and click on the "Workspace" link on the left. This will show you how your project was checked out. The pom may be in a different place than you expect.
I ran into a similar problem. My project was building fine, then suddenly stopped with the same error:
Parsing POMs
ERROR: No such file /scratch/jenkins/workspace/MyMoney/pom.xml
Perhaps you need to specify the correct POM file path in the project configuration?
[cloudbees-deployer] Skipping deployment as build result is FAILURE
Finished: FAILURE
I realized the only thing I had changed was adding a GitHub page (as described in http://pages.github.com/)
For reasons I don't understand, this was causing my project to check out from the gh-pages branch instead of master, as reflected in the console output:
Commencing build of Revision 88d8d7ee822e02aa2cdae11e07265eb7a8403fed (origin/gh-pages)
This was also reflected in the jenkins workspace (it contained the GitHub pages files, rather than my project files).
I'm sure there is a way to get this to work AND use GitHub pages, but for me the GitHub page was just an experiment, so I deleted the branch using:
git push origin --delete gh-pages
I then also did another commit to make sure all was OK and rebuilt.
The project is now checking out from master again and building OK.
When I build project from terminal by using 'xcodebuild' command I succeed, but when I try to do run same script from cron task I receive error
"Code Sign error: The identity '****' doesn't match any valid certificate/private key pair in the default keychain"
I think problem is in settings and permissions of crontab utility, it seems crontab does not see my keychain
Can anyone provide me terminal command how to make my keychain visible for crontab
I encountered a similar issue with trying to build nightly via cron. The only resolution I found was to create a plist in /Library/LaunchDaemons/ and load it via launchctl. The key necessary is "SessionCreate" otherwise you will quickly run in to problems similar to what was encountered with trying to use cron -- namely that your user login.keychain is not available to the process. "SessionCreate" is similar to "su -l" in that (as far as I understand) it simulates a login and thus default keychains you expect will be available; otherwise, you are stuck with only the System keychain despite the task running as your user.
I found the answers (though not the top answer currently) here useful in troublw shooting this issue: Missing certificates and keys in the keychain while using Jenkins/Hudson as Continuous Integration for iOS and Mac development
You execute your cron job with which account ?
most probably the problem !!
You can add
echo `whoami`
at the beginning of your script to see with which user the script is launched.
Also when a Bash script is launched from cron, it don't use the same environment variable (non login shell) as when you launch it as a user.
When the script launches from cron, it doesn't load your $HOME/.profile (or .bash_profile). Anything you run from cron has to be 100% self-sufficient in terms of it's environment. I'd suggest you make yourself a file called something like "set_build_env.sh" It should contain everything from your .profile that you need to build, such as $PATH, $HOME, $CLASSPATH etc. Then in your build script, load set_build_env.sh using the dot notation or source cmd as ericc said. You should also remove the build-specific lines from your.profile and then source set_build_env from there too so only one place to maintain. Example:
source /home/dmitry/set_build_env.sh #absolute path
. /home/dmitry/set_build_env.sh #dot-space notation same as "source"