Skip to content

Conversation

@welteki
Copy link
Member

@welteki welteki commented Jun 17, 2025

Description

Add support for streaming build logs when building function using the OpenFaaS Function Builder API

Switch to the "github.com/openfaas/go-sdk/builder" package for building functions.

  • Use the builder.FunctionBuilder to invoke the Function Builder API for remote builds.
    Both the faas-cli up and faas-cli publish command stream build logs to sdout if the Function Builder API supports it.

  • Switch to using the builder.CreateBuildeContext and builder.MakeTar functions from the Go SDK instead of their local variants.

Motivation and Context

  • I have raised an issue to propose this change (required)

Provide real time feedback on build progress for remote builds.

How Has This Been Tested?

  • Verified both the faas-cli up and faas-cli publish command work as expected when using the remoter builder. Verified build logs are streamed in real time when using the latest version of the function builder.

    faas-cli  up --remote-builder http://127.0.0.1:8081 \
      --payload-secret $HOME/.openfaas/payload.txt
    faas-cli publish --remote-builder http://127.0.0.1:8081 \
      --payload-secret $HOME/.openfaas/payload.txt
  • Verified both the faas-cli up and faas-cli publish command still work with older versions (<0.4.3) of the function builder that do not support streaming build logs.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@welteki welteki force-pushed the builder branch 3 times, most recently from c0f2273 to a9c9fb1 Compare June 17, 2025 20:27
@alexellis
Copy link
Member

Can you show that FAAS_DEBUG=1 works as expected?

Switch to the Go SDK for remote builds with the up and publish commands.
Both commands now stream build logs if the Function Builder API supports
it.

Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
welteki added 3 commits June 19, 2025 15:51
A version of the creaetBuildContext function has been included in the Go
SDK.

Srart using the builder.CreateBuildContext function from the Go SDK to
reduce code duplication.

Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
Additional packages defined through build options were ignored when
using a remote builder.

Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
@alexellis
Copy link
Member

faas-cli publish --remote-builder http://127.0.0.1:8081/build fails - perhaps parse the URL and only add /build if there is no path already there?

Only keep scheme and host when initialzing the builder client.

Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
Copy link
Member

@alexellis alexellis left a comment

Choose a reason for hiding this comment

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

LGTM

@alexellis alexellis merged commit 70eb80d into openfaas:master Jul 8, 2025
1 check passed
@welteki welteki deleted the builder branch July 9, 2025 08:37
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.

2 participants