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

Explicit toolchain dependency (or stop using jsii/superchain) #1065

Closed
eladb opened this issue Sep 13, 2021 · 8 comments · Fixed by #2510
Closed

Explicit toolchain dependency (or stop using jsii/superchain) #1065

eladb opened this issue Sep 13, 2021 · 8 comments · Fixed by #2510
Labels
refactor Major refactoring work

Comments

@eladb
Copy link
Contributor

eladb commented Sep 13, 2021

Currently, all JSII projects use a "kitchen sink" container image called jsii/superchain which bundles all the tools needed to build & package JSII projects. This is a pragmatic solution, but it's not optimal. It means, for example, that users don't have much control over their build environment and that builds & releases are quite slow since they have to pull this huge image on every run.

Projen should offer a fine-grained model for toolchain dependencies and have the various workflows synthesize based on this model. This will also allow us to offer developer-side support for tool installations (via tools like homebrew for example).

Abstractly, project types should be able to declare their toolchain dependencies via the Dependencies API. Probably via some special type of dependencies (or repurpose one of the existing types).

Then, we need some kind of a provider pattern that will allow mapping toolchain dependency to a provider-specific definition. For example, GitHub workflows will use one of the actions/setup-xxx actions to install tools in workflows based on the project model. We will be able to then offer a local provider that will check that a certain tool is installed locally and even control it via tools like nvm or rvm, etc.

@eladb
Copy link
Contributor Author

eladb commented Sep 13, 2021

@RomainMuller @Chriscbr @iliapolo curious what y'all think about this.

@mmcculloh-dms
Copy link
Contributor

Sounds like this can go towards this issue as well. I think having a new dependency type for this sort of thing would be super useful.

@Chriscbr
Copy link
Contributor

releases are quite slow since they have to pull this huge image on every run

Just to put a number on this - from what I'm seeing, it takes about 50-70 seconds to pull the jsii/superchain at the beginning of every GitHub workflow run. (Q: will be longer/shorter with the newer superchain images?) Meanwhile running actions/setup-xxx actions typically take a few seconds each from what I've seen.

Part of me wonders if running on container images is the correct solution in the long run, since they're supposed to be this universal-ish tool for defining build/runtime environments. At some point once you have enough dependencies, saving them as an image should (in theory) save you some time. But this assumes you have already have the image built and downloaded...

I feel like any long term solution should probably support both kinds of strategies:

  • "I'm providing an image with all of the toolchain dependencies"
  • "I want the toolchain dependencies to all be set up by projen in the CI/CD provider I choose"

@github-actions
Copy link
Contributor

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.

@github-actions github-actions bot added the stale label Nov 13, 2021
@eladb
Copy link
Contributor Author

eladb commented Nov 14, 2021

Keep

@eladb eladb removed the stale label Nov 14, 2021
@github-actions
Copy link
Contributor

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon.

@github-actions github-actions bot added the stale label Jan 14, 2022
@eladb eladb removed the stale label Jan 14, 2022
@github-actions
Copy link
Contributor

This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label.

@github-actions github-actions bot added the stale label Mar 16, 2022
@mrgrain mrgrain added refactor Major refactoring work and removed stale labels Nov 2, 2022
@mrgrain
Copy link
Contributor

mrgrain commented Nov 2, 2022

There is also a huge issue with running Docker in Docker on GitHub action and sharing files on the file system.
I had a to write a nasty workaround: https://github.com/mrgrain/streamlink-serverless/blob/main/projenrc/WorkflowDockerPatch.ts

Also related #2094

mrgrain added a commit that referenced this issue Mar 15, 2023
… in workflows

BREAKING CHANGE: default to node16
To use any other Node version, explicitly provide the desired version number

BREAKING CHANGE: remove `jsii/superchain` image from AwsCdkConstructLibrary workflows
Using `jsii/superchain` provides no tangible benefit over installing dependencies with GitHub Actions.
However because AWS CDK Constructs often require to run docker commands, with image GitHub Action workflows end up attempting to run Docker in Docker.
This is not trivial to achieve (see #2094 & aws/aws-cdk#8799).
Additionally the existing build and package workflows had an inconsistent usage of the image, causing further problems.

To restore the old behavior, set `options.workflowContainerImage` to the desired image.

Fixes #2094
Closes #1065
mrgrain added a commit that referenced this issue Mar 15, 2023
… in workflows

BREAKING CHANGE: default to node16
To use any other Node version, explicitly provide the desired version number

BREAKING CHANGE: remove `jsii/superchain` image from AwsCdkConstructLibrary workflows
Using `jsii/superchain` provides no tangible benefit over installing dependencies with GitHub Actions.
However because AWS CDK Constructs often require to run docker commands, with image GitHub Action workflows end up attempting to run Docker in Docker.
This is not trivial to achieve (see #2094 & aws/aws-cdk#8799).
Additionally the existing build and package workflows had an inconsistent usage of the image, causing further problems.

To restore the old behavior, set `options.workflowContainerImage` to the desired image.

Fixes #2094
Closes #1065
mrgrain added a commit that referenced this issue Mar 21, 2023
… in workflows

BREAKING CHANGE: default to node16
To use any other Node version, explicitly provide the desired version number

BREAKING CHANGE: remove `jsii/superchain` image from AwsCdkConstructLibrary workflows
Using `jsii/superchain` provides no tangible benefit over installing dependencies with GitHub Actions.
However because AWS CDK Constructs often require to run docker commands, with image GitHub Action workflows end up attempting to run Docker in Docker.
This is not trivial to achieve (see #2094 & aws/aws-cdk#8799).
Additionally the existing build and package workflows had an inconsistent usage of the image, causing further problems.

To restore the old behavior, set `options.workflowContainerImage` to the desired image.

Fixes #2094
Closes #1065
@mergify mergify bot closed this as completed in #2510 Mar 21, 2023
mergify bot pushed a commit that referenced this issue Mar 21, 2023
…flows (#2510)

BREAKING CHANGE: default to node16
To use any other Node version, explicitly provide the desired version number

BREAKING CHANGE: remove `jsii/superchain` image from AwsCdkConstructLibrary workflows
Using the `jsii/superchain` image provides no tangible benefit over installing dependencies with GitHub Actions. However AWS CDK Constructs often require to run docker commands, and thus using the image forces GitHub Action to exectute commands as Docker in Docker. This is does not work in many situations and generic fixes are not reliable (see #2094 & aws/aws-cdk#8799). Additionally the existing build and package workflows had an inconsistent usage of the image, causing more problems.

To restore the old behavior, set `options.workflowContainerImage` to the desired image.

Fixes #2094
Closes #1065

---
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Major refactoring work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants