git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Lars Schneider <larsxschneider@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git mailing list <git@vger.kernel.org>
Subject: Re: [PATCH 2/2] travis-ci: record and skip successfully built trees
Date: Fri, 29 Dec 2017 21:03:54 +0100	[thread overview]
Message-ID: <CAM0VKjk+LtW4dCuwsZ8ffXrN4HGL=ZC1budCOd53_w-20gwNag@mail.gmail.com> (raw)
In-Reply-To: <EFD040CE-E88C-4893-A304-4514BF221AC5@gmail.com>

On Thu, Dec 28, 2017 at 12:16 PM, Lars Schneider
<larsxschneider@gmail.com> wrote:
>
>> On 28 Dec 2017, at 00:00, SZEDER Gábor <szeder.dev@gmail.com> wrote:
>>
>> On Wed, Dec 27, 2017 at 8:15 PM, Lars Schneider
>> <larsxschneider@gmail.com> wrote:
>>>
>>>> On 27 Dec 2017, at 17:49, SZEDER Gábor <szeder.dev@gmail.com> wrote:
>>>> +# Skip the build job if the same tree has already been built and tested
>>>> +# successfully before (e.g. because the branch got rebased, changing only
>>>> +# the commit messages).
>>>> +skip_good_tree () {
>>>> +     if ! good_tree_info="$(grep "^$(git rev-parse $TRAVIS_COMMIT^{tree}) " "$good_trees_file")"
>>>> +     then
>>>> +             # haven't seen this tree yet; continue the build job
>>>> +             return
>>>> +     fi
>>>> +
>>>> +     echo "$good_tree_info" | {
>>>> +             read tree prev_good_commit prev_good_job_number prev_good_job_id
>>>> +
>>>> +             if test "$TRAVIS_JOB_ID" =  "$prev_good_job_id"
>>>
>>> Under what circumstances would that be true?
>>
>> When the user hits 'Restart job' on the Travis CI web interface,
>> $TRAVI_JOB_NUMBER and _ID remain the same in the restarted build job as
>> they were in the original.
>> So the condition is true when the user hits 'Restart job' on a build job
>> that was the first to successfully build and test the current tree.
>
> I think I would prefer it if Travis would rerun all jobs if I hit the
> "refresh" button. What is your intention here?

I considered that and don't think it's worth the effort.

First, I think it's a rather rare use case.  I don't know what others
are doing, but I only hit 'Restart job' to restart timeouted OSX build
jobs (and to test this patch :), and that already works with this patch.
I don't really see any reason to restart old successful build jobs,
except perhaps when a new version of one of the dependencies becomes
available (e.g. P4 and Git LFS versions are not hardcoded on OSX, we use
whatever homebrew delivers), to see that an older version still works
with the new dependencies.  Has anyone ever done something like that? :)

Second, we need to know when a build job is run after the user hit
'Restart job'.  Unless I overlooked something, Travis CI doesn't
indicate this.  I'm not sure this is documented explicitly, but it seems
that a restarted build job gets the same $TRAVIS_JOB_{NUMBER,ID}
variables as the original.  We could use this to identify restarted
build jobs, but to do that we would have to save this information at the
end of every successful build, too, and add additional checks to this
function, of course.

>>>> +             then
>>>> +                     cat <<-EOF
>>>> +                     Skipping build job for commit $TRAVIS_COMMIT.
>>>> +                     This commit has already been built and tested successfully by this build job.
>>>> +                     To force a re-build delete the branch's cache and then hit 'Restart job'.
>>>> +                     EOF
>>>> +             else
>>>> +                     cat <<-EOF
>>>> +                     Skipping build job for commit $TRAVIS_COMMIT.
>>>> +                     This commit's tree has already been built and tested successfully in build job $prev_good_job_number for commit $prev_good_commit.
>>>> +                     The log of that build job is available at https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$prev_good_job_id
>>>> +                     To force a re-build delete the branch's cache and then hit 'Restart job'.
>>>> +                     EOF
>>>
>>> Maybe add a few newlines before and after EOF to make the text more stand out?
>>> Or print it in a different color? Maybe red?
>>>
>>> See: https://travis-ci.org/szeder/git/jobs/322247836#L622-L625
>>
>> I considered using color for the first line, but then didn't do it,
>> because I didn't want to decide the color :)
>> Anyway, red is the general error/failure color, but this is neither.  It
>> could either be green, to match the color of the build job's result, or
>> something neutral like blue or yellow.
>
> You are right about red. I think I like yellow to express "warning".
> But this is just a nit.

OK, yellow it will be then.


> "skip_branch_tip_with_tag" could print its output yellow, too.
>
> - Lars

  reply	other threads:[~2017-12-29 20:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-27 16:49 [PATCH 0/2] Travis CI: skip commits with successfully built and tested trees SZEDER Gábor
2017-12-27 16:49 ` [PATCH 1/2] travis-ci: don't try to create the cache directory unnecessarily SZEDER Gábor
2017-12-27 19:46   ` Jonathan Nieder
2017-12-28 11:04     ` SZEDER Gábor
2017-12-28 18:13       ` Jonathan Nieder
2017-12-27 16:49 ` [PATCH 2/2] travis-ci: record and skip successfully built trees SZEDER Gábor
2017-12-27 19:15   ` Lars Schneider
2017-12-27 23:00     ` SZEDER Gábor
2017-12-27 23:24       ` SZEDER Gábor
2017-12-28 11:16       ` Lars Schneider
2017-12-29 20:03         ` SZEDER Gábor [this message]
2017-12-29 20:16           ` SZEDER Gábor
2017-12-30 19:17             ` Lars Schneider
2017-12-27 19:35   ` Lars Schneider
2017-12-28 10:31     ` SZEDER Gábor
2017-12-28 11:12       ` Lars Schneider
2017-12-28 19:01       ` Junio C Hamano
2017-12-31 10:12 ` [PATCHv2 0/3] Travis CI: skip commits with successfully built and tested trees SZEDER Gábor
2017-12-31 10:12   ` [PATCHv2 1/3] travis-ci: print the "tip of branch is exactly at tag" message in color SZEDER Gábor
2017-12-31 10:12   ` [PATCHv2 2/3] travis-ci: create the cache directory early in the build process SZEDER Gábor
2017-12-31 10:12   ` [PATCHv2 3/3] travis-ci: record and skip successfully built trees SZEDER Gábor
2017-12-31 11:27   ` [PATCHv2 0/3] Travis CI: skip commits with successfully built and tested trees Lars Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM0VKjk+LtW4dCuwsZ8ffXrN4HGL=ZC1budCOd53_w-20gwNag@mail.gmail.com' \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=larsxschneider@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).