~technomancy/fennel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
4 3

[PATCH fennel] Skip IRC reporting if we can't determine Git remote

Details
Message ID
<172468841777.4404.8441242112915951493-0@git.sr.ht>
DKIM signature
missing
Download raw message
Patch: +4 -0
From: Michel Lind <salimma@fedoraproject.org>

This means either Git is not installed, or the test is being run from a
published tarball and not a Git checkout.

In either case, that means we don't want to report the build result
(many Linux distributions also build with network access disabled, so
reporting will fail anyway) - and we should exit with status code 0, as
this is not actually an error.

Signed-off-by: Michel Lind <salimma@fedoraproject.org>
---
 test/irc.lua | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/test/irc.lua b/test/irc.lua
index e065800..d001145 100644
--- a/test/irc.lua
+++ b/test/irc.lua
@@ -3,6 +3,10 @@ local channel = os.getenv("IRC_CHANNEL")
local url = os.getenv("JOB_URL") or "???"

local remote = io.popen("git remote get-url origin"):read('*l')
if remote == nil then
    -- no git / no git repo, this is not an upstream CI job
    os.exit(0)
end
local is_origin = remote:find('~technomancy/fennel$') ~= nil

local branch = io.popen("git rev-parse --abbrev-ref HEAD"):read('*l')
-- 
2.45.2

[fennel/patches/.build.yml] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D3PZ13E10OFZ.2DGYNKL7G39QS@fra01>
In-Reply-To
<172468841777.4404.8441242112915951493-0@git.sr.ht> (view parent)
DKIM signature
missing
Download raw message
fennel/patches/.build.yml: SUCCESS in 30s

[Skip IRC reporting if we can't determine Git remote][0] from [~michel-slm][1]

[0]: https://lists.sr.ht/~technomancy/fennel/patches/54721
[1]: michel@michel-slm.name

✓ #1312255 SUCCESS fennel/patches/.build.yml https://builds.sr.ht/~technomancy/job/1312255
Details
Message ID
<871q2buuwi.fsf@asthra>
In-Reply-To
<172468841777.4404.8441242112915951493-0@git.sr.ht> (view parent)
DKIM signature
pass
Download raw message
~michel-slm <michel-slm@git.sr.ht> writes:

> This means either Git is not installed, or the test is being run from a
> published tarball and not a Git checkout.
>
> In either case, that means we don't want to report the build result
> (many Linux distributions also build with network access disabled, so
> reporting will fail anyway) - and we should exit with status code 0, as
> this is not actually an error.

Good catch; thanks! I think until recently no one had ever tried to run
the test suite on a computer that didn't have git installed. But of
course this is the better move.

Applied and pushed.

-Phil
Details
Message ID
<ZsyzLWE9A2twc1j4@michel-fedora-PC198L6J>
In-Reply-To
<871q2buuwi.fsf@asthra> (view parent)
DKIM signature
pass
Download raw message
On Mon, Aug 26, 2024 at 09:09:42AM -0700, Phil Hagelberg wrote:
> ~michel-slm <michel-slm@git.sr.ht> writes:
> 
> > This means either Git is not installed, or the test is being run from a
> > published tarball and not a Git checkout.
> >
> > In either case, that means we don't want to report the build result
> > (many Linux distributions also build with network access disabled, so
> > reporting will fail anyway) - and we should exit with status code 0, as
> > this is not actually an error.
> 
> Good catch; thanks! I think until recently no one had ever tried to run
> the test suite on a computer that didn't have git installed. But of
> course this is the better move.
> 
> Applied and pushed.
> 
Thanks! Yeah, the breaking changes happened between 1.5.0 and 1.5.1 -
prior to that the code accidentally worked in our build system as the
Git remote was predefined, and the one git operation was to determine
the branch -- that will fail, return nil, and nil is not 'main' so
everything else got skipped.

While prior to my patch we now try to use the result of the first 'git'
operation assuming it was not nil.

Best regards,

-- 
 _o) Michel Lind
_( ) identities: https://keyoxide.org/5dce2e7e9c3b1cffd335c1d78b229d2f7ccc04f2
Details
Message ID
<87wmk2t1ic.fsf@asthra>
In-Reply-To
<ZsyzLWE9A2twc1j4@michel-fedora-PC198L6J> (view parent)
DKIM signature
pass
Download raw message
Michel Lind <michel@michel-slm.name> writes:

> Thanks! Yeah, the breaking changes happened between 1.5.0 and 1.5.1 -
> prior to that the code accidentally worked in our build system as the
> Git remote was predefined, and the one git operation was to determine
> the branch -- that will fail, return nil, and nil is not 'main' so
> everything else got skipped.

Oh, that's funny; I ran into a really similar situation just over the
weekend trying to package it for Debian, except the problem was not
finding the branch; the builder system didn't have git at all. I assumed
yours was the same.

Oh well; the fix is the same either way.

-Phil
Reply to thread Export thread (mbox)