Travis CI running on Docker Image - Switch to last comited branch

Turbolay

I'm working on an operating systems, and I want to use Travis CI for continuous integration. Basically, my OS can perform a bunch of kernel tests on boot, and I want them to be run at every push.

However, setup environment is a bit complex, and so I'm using a Docker Image that I want my application to be run on the Docker Image, exactly like Tavis CI's example is doing: https://docs.travis-ci.com/user/docker/

As you can see in the Dockefile of the example: https://github.com/travis-ci/docker-sinatra/blob/master/Dockerfile , repo is clonned inside the Image, and soin Travis CI's configuration file (https://github.com/travis-ci/docker-sinatra/blob/master/.travis.yml), they just have to run "make".

This is easy because this project is a single branch project, but me I want the tests to be operated to the lastest comitted branch (The one which triggered Travis's build).

Which solution do you think I can use for this? Using environment variables on Travis CI that I the pass to Docker image and then checkout the branch passed as parameter? There is not more "classy options"?

I think both my Docker file and .travis.yml files are not necessary as there are WIP. Thank you.

Jonathan.Brink

To get the branch that was last committed to you can use a shell script like this:

git branch --sort=-committerdate | awk -F " " /*/'{print $2}'

The awk command is just cleaning up the output from the branch command so only the branch name is returned.

You can use the result of the above with git checkout to switch to the last updated branch before your make command.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Deploy Docker Image to CF using Travis CI

Travis CI to modify same branch

using docker image in travis ci (w/o Dockerfile or building a container)

Pipeline GitHub -> Travis CI -> Docker

Travis CI: Run branch conditional script

Travis CI: branch filters in build matrix items

Travis CI: Customize os per branch

Why is Docker image is not appearing on Docker Hub after being pushed from Travis CI

Automatic deployment of Docker image as last step of CI/CD pipeline

Running Docker image of Postman from Gitlab CI pipeline

Error running PowerCLI from Docker image on Gitlab CI/CD

Running Travis locally using docker

Travis CI - Running Command on Job Cancellation

Key - Error when running in Travis CI| Pytest

Travis CI running examples despite donttest

Travis-CI running two android emulators

Can Travis CI cache docker images?

Continuous Deployment Using Travis CI and Docker

Test docker containers using travis-ci

GraalVM with native-image compilation in Travis CI

How to run a command only if is the master branch in travis-ci?

How to restrict build failure emails to only a specific branch in travis CI?

ChromeHeadless giving timeout when running GitLab CI pipeline with Docker Centos 7.5 image

Error running gitlab-ci.yml script under Alpine Docker based Image

Getting gcc command not found when running the Makefile on travis CI

running sh script on travis CI: The command exited with 1

Django app failing in Travis CI: server not running on localhost

How to get sonarcloud running on Travis Ci with Python code

EntityManagerException while running in Travis CI, Spring Boot and PostgreSQL