Skip to content

Permit multiple urls to fetchurl. - #230

Open
Abdiramen wants to merge 8 commits into
256lights:mainfrom
Abdiramen:oz/fetch_urls
Open

Permit multiple urls to fetchurl.#230
Abdiramen wants to merge 8 commits into
256lights:mainfrom
Abdiramen:oz/fetch_urls

Conversation

@Abdiramen

@Abdiramen Abdiramen commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

resolves #68

@Abdiramen
Abdiramen force-pushed the oz/fetch_urls branch 2 times, most recently from f364872 to e536cb4 Compare July 3, 2026 14:02
@Abdiramen Abdiramen changed the title POC: Fetch urls Permit multiple urls to fetchurl. Jul 3, 2026
@Abdiramen
Abdiramen marked this pull request as ready for review July 3, 2026 19:00
Comment thread internal/backend/builtin.go Outdated
Comment thread internal/backend/builtin.go Outdated
Comment thread internal/backend/builtin.go Outdated
Comment thread internal/backend/builtin.go Outdated
Comment thread internal/frontend/prelude.lua Outdated
Comment thread internal/frontend/prelude.lua Outdated
Comment thread internal/frontend/prelude.lua Outdated
Comment thread internal/backend/realize_test.go Outdated
Comment thread internal/backend/realize_test.go
return fmt.Errorf("missing url environment variable")
}

var err error

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the new internal/multierror package to collect all the errors to report.

expectBuildFail bool
}{
{
name: "FetchSingularUrl",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +1275 to +1281
if err != nil && test.expectBuildFail {
return
}
if err != nil {
gotLog, _ := backendtest.ReadLog(ctx, client, realizeResponse.BuildID, drvPath)
t.Fatalf("build drv: %v\nlog:\n%s", err, gotLog)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would still be good to show the log anyway.

Suggested change
if err != nil && test.expectBuildFail {
return
}
if err != nil {
gotLog, _ := backendtest.ReadLog(ctx, client, realizeResponse.BuildID, drvPath)
t.Fatalf("build drv: %v\nlog:\n%s", err, gotLog)
}
if err != nil {
gotLog, _ := backendtest.ReadLog(ctx, client, realizeResponse.BuildID, drvPath)
t.Logf("build drv: %v\nlog:\n%s", err, gotLog)
if !test.expectBuildFail {
t.Fail()
}
return
}

error("Either url or urls must be set")
end

local name

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity, let's grab args.name first and then check the fallback. It was a little hard to see that behavior on first read.

Suggested change
local name
local name = args.name
if not name then

Comment on lines +26 to +30
if args.url == nil then
name = args.name or baseNameOf(args.urls[1])
else
name = args.name or baseNameOf(args.url)
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, for clarity, let's flip this condition.

Suggested change
if args.url == nil then
name = args.name or baseNameOf(args.urls[1])
else
name = args.name or baseNameOf(args.url)
end
if args.url then
name = baseNameOf(args.url)
else
name = baseNameOf(args.urls[1])
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permit multiple URLs to fetchurl

2 participants