fix: artifacts/server: properly format IP/port for listen address #135

Merged
earl-warren merged 1 commit from :fix-artifact-ip into main 2025-06-09 09:01:40 +00:00
Member

Hi!

This primarily fixes the listen address for the artifact server - currently, if an plain IPv6 address is passed (e.g. 2001:db8::1), it results in 2001:db::1:3456 as the formatted address.

It also this changes so that artifactServerAddr is represented as a net.IP and artifactServerPort as uint16, thus making the whole thing a bit more typesafe.
As the latter breaks the API for config.Runner (by changing the struct field types), I hope this is okay - otherwise, I'll just drop the commit if compatibility is more desired.
done.
The corresponding runner PR: forgejo/runner#576

Hi! This primarily fixes the listen address for the artifact server - currently, if an plain IPv6 address is passed (e.g. `2001:db8::1`), it results in `2001:db::1:3456` as the formatted address. ~~It also this changes so that `artifactServerAddr` is represented as a `net.IP` and `artifactServerPort` as `uint16`, thus making the whole thing a bit more typesafe. As the latter breaks the API for `config.Runner` (by changing the struct field types), I hope this is okay - otherwise, I'll just drop the commit if compatibility is more desired.~~ done. The corresponding runner PR: https://code.forgejo.org/forgejo/runner/pulls/576
earl-warren requested changes 2025-05-25 06:46:14 +00:00
Dismissed
earl-warren left a comment
Contributor

Good fix 👍

The runner makes no promise regarding backward compatibility, the amount of work required to change the type of the fields is going to be a burden immediately and only brings marginal benefits.

I think it is best to keep it in another pull request, separated from the bug fix.

Good fix 👍 The runner makes no promise regarding backward compatibility, the amount of work required to change the type of the fields is going to be a burden immediately and only brings marginal benefits. I think it is best to keep it in another pull request, separated from the bug fix.
earl-warren changed title from fix: artifacts/server: properly format IP/port for listen address to fix: artifacts/server: properly format IP/port for listen address [skip cascade] 2025-05-25 06:51:44 +00:00
Contributor

Marking as [skip cascade] so that it does not trigger the full test suite until it is ready to succeed.

Marking as [skip cascade] so that it does not trigger the full test suite until it is ready to succeed.
@ -120,2 +121,2 @@
h.outboundIP,
h.listener.Addr().(*net.TCPAddr).Port)
return fmt.Sprintf("http://%s",
net.JoinHostPort(h.outboundIP, strconv.FormatUint(uint64(port), 10)),

Could you please find where this should be tested and add a testcase?

Could you please find where this should be tested and add a testcase?
Author
Member

Done. Not really familiar with the go unit testing framework, so please do not hestitate if there are better ways to do things.

Done. Not really familiar with the go unit testing framework, so please do not hestitate if there are better ways to do things.
c8h4 marked this conversation as resolved
Author
Member

The runner makes no promise regarding backward compatibility, the amount of work required to change the type of the fields is going to be a burden immediately and only brings marginal benefits.

I think it is best to keep it in another pull request, separated from the bug fix.

Right, I'll just drop that change. 👍

> The runner makes no promise regarding backward compatibility, the amount of work required to change the type of the fields is going to be a burden immediately and only brings marginal benefits. > > I think it is best to keep it in another pull request, separated from the bug fix. Right, I'll just drop that change. 👍
c8h4 force-pushed fix-artifact-ip from 7fb03fd711
Some checks failed
/ cascade (pull_request_target) Failing after 1m29s
checks / unit (pull_request) Failing after 2m0s
checks / integration (pull_request) Has been skipped
to 74ed568cb9
Some checks failed
/ cascade (pull_request_target) Has been skipped
checks / integration (pull_request) Has been cancelled
checks / unit (pull_request) Has been cancelled
2025-05-25 12:45:53 +00:00
Compare
c8h4 force-pushed fix-artifact-ip from 74ed568cb9
Some checks failed
/ cascade (pull_request_target) Has been skipped
checks / integration (pull_request) Has been cancelled
checks / unit (pull_request) Has been cancelled
to 9d57dc9ba1
Some checks failed
/ cascade (pull_request_target) Has been skipped
checks / unit (pull_request) Failing after 1m48s
checks / integration (pull_request) Has been skipped
2025-05-25 12:58:01 +00:00
Compare
c8h4 force-pushed fix-artifact-ip from 9d57dc9ba1
Some checks failed
/ cascade (pull_request_target) Has been skipped
checks / unit (pull_request) Failing after 1m48s
checks / integration (pull_request) Has been skipped
to 3fbcc2c7ef
All checks were successful
/ cascade (pull_request_target) Has been skipped
checks / unit (pull_request) Successful in 2m50s
checks / integration (pull_request) Successful in 56s
2025-05-25 17:16:22 +00:00
Compare
earl-warren requested changes 2025-05-26 05:19:50 +00:00
Dismissed
@ -299,3 +300,3 @@
// run server
go func() {
logger.Infof("Start server on http://%s:%s", addr, port)
logger.Infof("Start server on http://%s", server.Addr)

Port is missing here.

Port is missing here.
Author
Member

http.Addr is set to the correct host:port string above, so this just reuses that.
But if you want I can change that.

`http.Addr` is set to the correct `host:port` string above, so this just reuses that. But if you want I can change that.
earl-warren changed title from fix: artifacts/server: properly format IP/port for listen address [skip cascade] to fix: artifacts/server: properly format IP/port for listen address 2025-05-26 05:20:02 +00:00
Contributor

Could you please update the title to reflect the current state of the PR? chore:...

Could you please update the title to reflect the current state of the PR? `chore:...`
Author
Member

@earl-warren wrote in #135 (comment):

Could you please update the title to reflect the current state of the PR? chore:...

I mean, it still fixes original problem, no?

@earl-warren wrote in https://code.forgejo.org/forgejo/act/pulls/135#issuecomment-40888: > Could you please update the title to reflect the current state of the PR? `chore:...` I mean, it still fixes original problem, no?
c8h4 force-pushed fix-artifact-ip from 3fbcc2c7ef
All checks were successful
/ cascade (pull_request_target) Has been skipped
checks / unit (pull_request) Successful in 2m50s
checks / integration (pull_request) Successful in 56s
to 31d7feaeb0
Some checks failed
checks / unit (pull_request) Successful in 1m7s
checks / integration (pull_request) Successful in 42s
/ cascade (pull_request_target) Failing after 1m40s
2025-06-01 10:11:08 +00:00
Compare
Contributor

cascading-pr updated at forgejo/runner#587

cascading-pr updated at https://code.forgejo.org/forgejo/runner/pulls/587
Contributor

Thanks for the gentle ping 😊

Thanks for the gentle ping 😊
earl-warren deleted branch fix-artifact-ip 2025-06-09 09:01:40 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No milestone
No project
No assignees
3 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/act!135
No description provided.