35

This is my first day using Travis CI. I made some mistakes, I've tried removing and adding the repository again, but Travis CI build history is still there, with broken links for old commits.

Any chance to remove those old builds?

7 Answers 7

38

You can use the travis command line tool

Login first using travis login then you can do the following

LAST_BUILD_NUMBER=68
for i in $(seq 1 $LAST_BUILD_NUMBER ); do  travis logs $i --delete --force ; done

This will remove the "logs" so there's no information aside from the header and any confidential information will no longer be visible.

1
  • 2
    The command removes the log, but will it still say that the build has failed? Commented Apr 23, 2017 at 21:22
25

There's no way for the user to remove builds, but if you really want them removed I think your best bet is to email support ([email protected]) and ask them to remove it manually.

1
  • 1
    Ok, thanks. It's just for consistency, but really there is no need to contact the support!
    – gremo
    Commented Dec 14, 2012 at 22:17
9

Per https://twitter.com/travisci/status/557932883571392512

Since at least 2015/01/21 you can now delete [the log] from the web UI:

travis web ui remove log

2
  • 1
    I tried it, it removes the log, however it will still say that the build has failed. Commented Apr 23, 2017 at 21:23
  • 1
    Correct, it only removes the log, not the actual build.
    – swooby
    Commented Apr 24, 2017 at 23:22
6

As henrikhodne, build deletion is not possible.

From https://github.com/travis-ci/travis-ci/issues/877 (mirror) where the issue was raised:

Closing this issue for good, as this isn't on the roadmap for the near future. (Jul 23, 2015)

0
5

You can click on the Remove log button

Screenshot

2
  • 5
    Removing the log is not the same as removing the build.
    – Toilal
    Commented May 22, 2018 at 8:55
  • 1
    @Toilal yep, but most people (including myself) were searching how to remove the build logs
    – Sam Denty
    Commented May 22, 2018 at 12:59
5

Another way to PURGE EVERYTHING which results in:

  • removing all the build history from Travis CI
  • removing the repo from Travis CI
  • removing the repo data from GitHub (all issues, PRs, wiki, everything)
  • removing all the dangling commits from git push -f

First make sure you have screenshots/backups/... of all your settings in Travis and in remote repository + that you have a 1to1 mirror of your remote repository (meaning ALL your branches properly downloaded to the local repo). That should be possible just with git clone, git fetch and maybe even git checkout to each of the branches, so that you have all the history available locally (correct me if I forget some step).

Then you want to go to your remote server e.g. GitHub and delete the repository (Settings - Danger Zone - Delete this repository). All your issues, PRs, wikis, any settings are gone now. Then create the same-named repository on GitHub again (do NOT! initialize it with anything, no license, no readme, no nothing).

Now all the dangling commits which would be cleaned locally via git gc are gone from the remote repo (stealthy GitHub links begone!). Anything that should be the bare repo.git folder should be overwritten (unless GitHub isn't doing something silly).

Proceed and go to Travis CI profile:

https://travis-ci.org/profile/<username>

Press Sync account under My account and check the Travis repo. All the settings and build history should be gone now too.

Now either remove the GitHub repo and resync again or proceed with the restoring:

git push -u origin <branch name>  # repeat for each branch

Go to your settings backups (e.g. screenshots) and set everything the way it was before.

2
  • 1
    This worked for me. However, it seemed it was necessary for me to run "Sync Account" before re-forking it from the base repo (to register the deletion from GitHub), and then re-fork it and run "Sync Account" again to pick up the new changes. Commented Feb 12, 2019 at 2:17
  • This also worked for me. I had to fiddle with a few things here and there but nothing a little poking around didn't fix. Thanks for this @KeyWeeUsr!
    – jrnxf
    Commented Sep 9, 2019 at 5:30
1

I was able to wipe the Travis build history simply.

I'm logging into to travis-ci.org via my Github account.

I went into travis-ci-org, and hit the + to show all repositories:

go to repos

Then I turned off Travis CI for the repo in question by flipping this toggle:

enter image description here

In Github, I renamed my repo.

Then I hit "Sync account" in the upper left.

Sync account

For my final step, I flipped that toggle back on under the new repo name.

Voila - no Travis history. I triggered a build manually and now everything is clean and clear.

Not the answer you're looking for? Browse other questions tagged or ask your own question.