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

add Amazon Linux codebuild images to image override with opinionated runtimes #720

Closed
wants to merge 2 commits into from

Conversation

cnfait
Copy link
Contributor

@cnfait cnfait commented Sep 10, 2024

Description of changes:
Add support for AWS CodeBuild-curated, Amazon Linux-based images - extending what has already been done for Ubuntu-based images.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dgraeber dgraeber self-requested a review September 10, 2024 15:03
Copy link
Contributor

@dgraeber dgraeber left a comment

Choose a reason for hiding this comment

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

How does this address the docker invocation? I don't see how that was addressed. Was this tested?

Copy link
Contributor

@LeonLuttenberger LeonLuttenberger left a comment

Choose a reason for hiding this comment

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

I tried deploying a module with this and it threw this error:

Traceback (most recent call last):
  File "/Users/lutleon/Projects/github.com/idf-modules/.venv/bin/seedfarmer", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/lutleon/Projects/github.com/seed-farmer/seedfarmer/__main__.py", line 296, in main
    cli()
  File "/Users/lutleon/Projects/github.com/idf-modules/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/Projects/github.com/idf-modules/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/lutleon/Projects/github.com/idf-modules/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/Projects/github.com/idf-modules/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/Projects/github.com/idf-modules/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/Projects/github.com/seed-farmer/seedfarmer/__main__.py", line 151, in apply
    commands.apply(
  File "/Users/lutleon/Projects/github.com/seed-farmer/seedfarmer/commands/_deployment_commands.py", line 861, in apply
    destroy_deployment(
  File "/Users/lutleon/Projects/github.com/seed-farmer/seedfarmer/commands/_deployment_commands.py", line 560, in destroy_deployment
    destroy_response = list(workers.map(_exec_destroy, mdos))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/anaconda3/lib/python3.12/concurrent/futures/_base.py", line 619, in result_iterator
    yield _result_or_cancel(fs.pop())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/anaconda3/lib/python3.12/concurrent/futures/_base.py", line 317, in _result_or_cancel
    return fut.result(timeout)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/anaconda3/lib/python3.12/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/anaconda3/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/Users/lutleon/anaconda3/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/Projects/github.com/seed-farmer/seedfarmer/commands/_deployment_commands.py", line 535, in _exec_destroy
    return _execute_destroy(mdo)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/Projects/github.com/seed-farmer/seedfarmer/commands/_deployment_commands.py", line 291, in _execute_destroy
    resp = commands.destroy_module(mdo)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/Projects/github.com/seed-farmer/seedfarmer/commands/_module_commands.py", line 318, in destroy_module
    runtime_versions=get_runtimes(active_codebuild_image),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lutleon/Projects/github.com/seed-farmer/seedfarmer/commands/_runtimes.py", line 38, in get_runtimes
    return cir_d[k]
           ~~~~~^^^
KeyError: 'AL2_STANDARD_5'

@cnfait
Copy link
Contributor Author

cnfait commented Sep 11, 2024

How does this address the docker invocation? I don't see how that was addressed. Was this tested?

Yes of course, I wouldn't have opened the PR otherwise. What do you mean by docker invocation though?

@LeonLuttenberger I'm not too sure why you have this error/how that can happen, perhaps there is a way to use this feature I'm not aware of. As en example of the testing I'm doing, I've edited the Python runtime of AL2_STANDARD_5 and deployed a module, checking which version of Python is effectively used in CodeBuild. By default, with codebuildImage: aws/codebuild/amazonlinux2-x86_64-standard:5.0, you get Python 3.11. If you edit AL2_STANDARD_5 = {"nodejs": "18", "python": "3.11", "java": "corretto21"} to put 3.12, you do get Python 3.12 in the CodeBuild project. turns out putting corretto17 instead of corretto21 for AL2_STANDARD_5 makes the error go away as it means there is no duplicate value in the enum, and this is the value I've done my testing with originally.

I've changed the comprehension to loop over Enum __members__ to include aliases, let me know if you would prefer a different solution.

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.

3 participants