Skip to content
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

new runtime check fails for docker build #361

Closed
1 task done
stevie- opened this issue Oct 21, 2022 · 4 comments · Fixed by #362
Closed
1 task done

new runtime check fails for docker build #361

stevie- opened this issue Oct 21, 2022 · 4 comments · Fixed by #362

Comments

@stevie-
Copy link

stevie- commented Oct 21, 2022

Description

With the latest version 4.1.2 and 4.1.3 a new shell check for runtime parameter was introduced. This breaks our workflows on github runner ubuntu-20.04 (or any runner which has not the selected runtime version installed). We still set python3.7 runtime which is not available on the runner, which is known and thus we use docker to build our lambdas.

It seems that this check is executed before the build process switches to the docker runtime.
Please check why this code is not working with the docker build setting.

  • ✋ I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version [Required]: 4.1.3

  • Terraform version:
    v1.2.9

  • Provider version(s):
    hashicorp/local v2.2.3
    hashicorp/aws v4.36.0
    hashicorp/null v3.1.1
    hashicorp/external v2.2.2

Reproduction Code [Required]

{
  create      = true
  create_role = true

  function_name = "python3.7-docker-build-fails"
  handler       = "app.lambda_handler"
  runtime       = "python3.7"
  source_path = [
    {
      path             = "../lambdas/trigger-lambda/src",
      pip_requirements = "../lambdas/trigger-lambda/requirements.txt",
    }
  ]

  build_in_docker   = true
  docker_image      = "lambci/lambda:build-python3.7"
  docker_build_root = "../lambdas/trigger-lambda/docker"
}
# requirements.txt
jsonpath-ng==1.5.2

Steps to reproduce the behavior:

< Are you using workspaces? > no workspaces
< Have you cleared the local cache (see Notice section above)? > clean cache
< List steps in order that led up to the issue you encountered > update module to 4.1.3 and rerun unchanged code

Expected behavior

The check for runtime binary should be done inside docker container.

Actual behavior

│ Error: External Program Execution Failed
│
│   with module.lambda.data.external.archive_prepare[0],
│   on .terraform/modules/lambda/package.tf line 10, in data "external" "archive_prepare":
│   10:   program = [local.python, "${path.module}/package.py", "prepare"]
│
│ The data source received an unexpected error while attempting to execute
│ the program.
│
│ Program: /path/to/bin/python3
│ Error Message: Traceback (most recent call last):
│   File "REDACTED/aws/lambda_function/.terraform/modules/lambda/package.py", line 1403, in <module>
│     main()
│   File "REDACTED/aws/lambda_function/.terraform/modules/lambda/package.py", line 1399, in main
│     exit(args.command(args))
│   File "REDACTED/aws/lambda_function/.terraform/modules/lambda/package.py", line 1198, in prepare_command
│     build_plan = bpm.plan(source_path, query)
│   File "REDACTED/aws/lambda_function/.terraform/modules/lambda/package.py", line 768, in plan
│     pip_requirements_step(pip_requirements, prefix,
│   File "REDACTED/aws/lambda_function/.terraform/modules/lambda/package.py", line 661, in pip_requirements_step
│     raise RuntimeError(
│ RuntimeError: Python interpreter version equal to defined lambda runtime
│ (python3.7) should be available in system PATH
│
│ State: exit status

Terminal Output Screenshot(s)

Additional context

@AllanBenson001
Copy link
Contributor

I had the same issue when merging the latest version of code into my branch for this PR - #360

A fix is included in that PR (because I was unable to proceed without it) but it might be necessary to apply the same fix to a separate branch if I can't get the other changes included in that PR merged

@lorengordon
Copy link
Contributor

Related question: What is the appetite for running docker during the plan phase? Obviously you would need docker, and it would need to pull the image...

@antonbabenko
Copy link
Member

This issue has been resolved in version 4.1.4 🎉

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants