1

Hey so I have a Jenkins Server which runs some tests on each commit made in gerrit. I now want to commit the results of the tests made by jenkins to the repo.

Any idea how i might be able to do this?

user3254126
  • 491
  • 1
  • 4
  • 15

2 Answers2

1

After the you run the tests, execute:

git add TEST-RESULTS-FILES
git commit --amend -C HEAD

And then:

git push origin HEAD:refs/for/BRANCH

These commands will add the tests results (git add), create a new patchset (git commit --amend) using the same commit message (-C HEAD) and push it to Gerrit (without submit).

You need to configure Jenkins to NOT use this patchset in a new build or you'll be stuck in a build/add/commit/push/build/add/... cycle forever.

  • Thanks for your answer but the problem is now that it runs the code and pushes the artifacts into the master branch but at the same time it also merges the changes made by the commit that triggered the test. I only want jenkins to push the test results into master and verify the commit but i do not want it to merge the commit. – user3254126 Mar 01 '17 at 14:34
  • Uhm... I updated the answer, now it'll create a new patchset in the same change instead of a new change. – Marcelo Ávila de Oliveira Mar 02 '17 at 10:42
0

Use Archive the Artifacts plugin in post-build action.

enter image description here

You will also be able to download those artifacts easily from the build page.

(OR)

If you want to publish test result, you can use other plugin like Publish HTML reports, Publish JUnit test result report etc.

RejeeshChandran
  • 4,168
  • 3
  • 21
  • 32
  • Yeah I already archive the artifacts but they are then only saved on the jenkins server and not integrated into the repo itself. I want the resulting files to be integrated into a test folder in the git repo. – user3254126 Feb 07 '17 at 12:59
  • For that refer http://stackoverflow.com/questions/19922435/how-to-push-changes-to-github-after-jenkins-build-completes – RejeeshChandran Feb 07 '17 at 13:07