-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: sam build --use-container
fails for go1.x
on provided.al2
/al2023
runtimes
#5280
Comments
+1 |
@davidjb The halt is mostly due to how we support things like this. As the provided runtime has grown in support, we cannot keep adding runtime specific tools into one image. We haven't made any decisions on paths forward however you can do this yourself by providing |
Thanks @jfuss, glad to know solutions are being considered. As you've said about FROM public.ecr.aws/sam/build-provided.al2:latest-arm64
# Install Go
RUN curl -L https://go.dev/dl/go1.19.linux-arm64.tar.gz | tar -zx -C /usr/local
ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin
# Set GOPROXY envvar to avoid using the default proxy.golang.org proxy
ENV GOPROXY=direct
# Compatible with initial base image
ENTRYPOINT []
CMD ["/bin/bash"] Then build the image (e.g. [default.build.parameters]
use_container = true
build_image = [
"TestFunction=provided.al2-with_go",
"TestFunction2=provided.al2-with_go",
...
] This works, but you end up needing to re-specify the build image for each function explicitly (since other functions use different runtimes and I can't use a global build_image). There's also having to manage build processes for this extra container, and ensuring it's up-to-date etc. If SAM CLI were create the Docker image dynamically (e.g. if |
@davidjb what would your thoughts be for SAM CLI to provide some sort of per-runtime/buildmethod configuration interface? Maybe something along the lines of an environment variable like We're looking into ways of improving the configurations for the CLI and appreciate any suggestions you may have. |
@mildaniel That could be helpful for specific situations where customisation is need (e.g. a specific Go version for builds); having this as able to be specified in config as well as environment variables so it can be easily checked in to version control. That said, the problem in this case is just about having |
Building on to that last question, will the Go1.x image continue to get updated? It currently has 1.20 on it, but how long will it get updated/when should we plan to stop using it? (and will it get 1.21 for example)
|
sam build --use-container
fails for go1.x
on provided.al2
runtimesam build --use-container
fails for go1.x
on provided.al2
/al2023
runtimes
@adamdavis40208 As per https://docs.aws.amazon.com/lambda/latest/dg/lambda-golang.html (and various other pages), It's probably the same answer for you @vikhyat187 - using the old, deprecated |
Commenting just for notifications really - interested to see what the recommended way forward for Go via SAM is, when SAM is officially supported but the Seems like a bit of miscommunication between teams - Lambda team dropping support for the Go runtime, but SAM team not adding in the tooling for the recommended solution... |
Any news on this? the deprecation is about to be meet and there is not a fix for this :( |
Hey all, SAM CLI v1.108.0 (released two days ago) supports container-build for go1.x on
|
|
Description:
The standard
go1.x
runtime is based on AL1, which is both EOL and doesn't support ARM-based CPUs. The suggested replacement is to use theprovided.al2
orprovided.al20223
runtimes withBuildMethod: go1.x
. This workssam build
is run locally but only on hosts where issues like aws/aws-lambda-go#340 don't occur. In order to create a normalised build environment, I attempted to build withsam build --use-container
instead, which errors with:The reason for this is that the
go
binary is not present within thesam/build-provided.al2
image and thus preventing builds. A PR had been created at aws/aws-sam-build-images#71 to add Go into theprovided
andprovided.al2
runtimes but is under discussion as of the end of 2022.Steps to reproduce:
template.yml
:sam build --use-container
.Observed result:
Expected result:
Build to succeed and not error with
--use-container
.Alternatively, if there was a way to set local environment variables such they're passed to
go build
locally (e.g. when containers aren't used), that would be a workaround to the initial problem.Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
The text was updated successfully, but these errors were encountered: