As a part of my my customized travis build I would like to use Travis command-line client inside after_success script. I need that to trigger some operations on other travis jobs (other repositories) after each successfull build in this particular repo. So two questions:
Is it possible at all?
If so is there any smart or quick way to do that?
As far as I know Travis Cli has several ruby dependencies that may not be available by default. But perhaps it is by default installed on travis VMs.
Yes, this is completely possible. However, this would only work for language: ruby jobs.
For your specific case, you can do:
after_success:
# install travis cli
- gem install --no-document travis
# setup travis shell autocomplete
- echo "y" | travis --version
# do travis cli stuff
- travis do stuff
If you have a project using another language, then this becomes much more complicated.
Related
Is there a simple way to check whether a repository uses continuous integration, and which CI platform (e.g. Jenkins, Travis CI)?
Example: OpenCV. See https://github.com/opencv/opencv. By skimming through the repo, I have no idea whether CI is used (although I supposed so), and what kind of CI it uses.
Most CI platforms use a configuration file or directory placed at the root of the repository. It probably the quickest way to identify the tool used by each repo. Here are a few examples:
.travis.yml for Travis
.gitlab-ci.yml for Gitlab
.drone.yml for Drone CI
.circleci/ for CircleCI
.github/workflows for Github
Jenkins situation is slightly more complex since users can have a Jenkinsfile directly in there repository or not.
I have a python project, locally I have setup tox to automate pep8, bandit scans, pytest etc...
Now I 'm asked to move to existing CICD and they have given me a Jenkins file.
I need to add these tox functionality to Jenkins that Jenkins file. Can I directly run these tox commands in the jenkins? Or do I need to look for similar functionality using Jenkins plugins ?
There is literally documentation on the tox website for using it in conjunction with Jenkins - https://tox.readthedocs.io/en/latest/example/jenkins.html.
Try to use Stackoverflow to get help with a solution that you came up with.
I have a github-repository, that is linked to automated build on Docker. Consequently, on each commit to master-branch, docker triggers building of Docker-image.
Also, each commit is tested by Travis CI automatically.
My question is: is there any way to trigger Docker only if travis finishes successfully? Do I need some sort of webhook or something like that for my goal?
You could trigger the Travis CI test after the repository is pushed. Then, in the deploy step you could trigger a build on Docker. Or even do the build inside Travis, and just push the image to the repository you are using.
Travis has a nice overview of how to make this flow happen here.
The gist is that you're going to need to have sudo: required, so you're going to be running in a VM instead of inside Docker, as is the standard way in Travis. You also need to add docker as a service, much like you'd add redis or postgres for an integration test. The Pushing Docker Image to a Registry section has a lot of info on setting things up for the actual deployment. I'd use an actual deploy step with the script provider, rather than after_success, but that's up to you.
I am trying to find a solution to automate installation and configuration of Jenkins & SonarQube. The idea is to provide an easy to use provisioning utility for setting up CI. Ideally I would love to automate the following
Installation
Set up users,Build, Unit testing and Code coverage
Is there an SDK, CLI or similar which can be used from batch script?
Thanks
You can use the Jenkins docker image for the installation part - even if you're not using Docker you can still copy the installation procedure:
https://github.com/jenkinsci/docker
For the setup of jobs I would recommend the Job DSL:
https://github.com/jenkinsci/job-dsl-plugin
For the rest you can use the Jenkins CLI or you can manually configure it once and then extract the corresponding XML file from the Jenkins home and copy it into other installations.
Is there any way I can integrate Jenkins with Chef Server so that I can create jobs to be executed? I don't want to have to go to the Chef Workstation.
Do I need to install jenkins on a separate server or the chef workstation?
Can I execute all the recipes directly from the Jenkins console?
Yes. You can create jobs in jenkins and can be integrated with chef. Knife search would be the best option. you can run chef-client to run recipes through jenkins to any machine.
Look into this chef-plugin. It might help. I have not tried it.
I hope this helps.
We managed to have this working except automatic deployment (I am doing some research if there is such thing yet).
What I recommend is having Jenkins slave connecting to your master (i.e. using Swarm plugin). This slave could be machine (i.e. Ubuntu server edition) with QEMU/KVM virtualization, Ruby, Vagrant (or other tool), ChefClien, TestKitchen, RSpecs (chefspecs) and Foodcritic. There is Chef Development Kit that has many of this.
What build do:
Checkout your chef repository
Run `kitchen test all' (or only subset of your suites)
If status is 0 then execute rspec --format doc (from yours cookbook directory
If status is 0 then execute foodcritic -f
If status is 0 then you can upload your cookbook knife upload cookbooks/my_cookbook
What we haven't figure out yet is:
Update (increase) version of cookbook (if doing release)
Still quite error prone approach using status and shell scripts in jenkins build
More resources:
Foodcritic CI
try these Jenkins plugins:
https://github.com/zhelyan/jenkins-chef-api
together with
https://github.com/zhelyan/jenkins-chef-wrapper