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

Figure out nicer way to pre-install dependencies in Docker #3

Open
ErikSchierboom opened this issue Apr 16, 2021 · 3 comments
Open

Comments

@ErikSchierboom
Copy link
Member

Currently, we pre-install the dependencies for offline usage in the Dockerfile as follows:

COPY src/ src/
COPY build.gradle .
RUN gradle build

Basically, we have a "project" with two empty source files: https://github.com/exercism/groovy-test-runner/blob/main/src/main/groovy/TestRunner.groovy and https://github.com/exercism/groovy-test-runner/blob/main/src/test/groovy/TestRunnerSpec.groovy and a build.gradle file: https://github.com/exercism/groovy-test-runner/blob/main/build.gradle. Compiling this project forces the dependencies to be downloaded, which can then be used later on to run the student's solution without any networking (which is how test runners are executed).

While this works, it does feel a bit odd. Maybe there is a nicer solution?

@artamonovkirill
Copy link
Contributor

There's also a dependency between the test runner and the exercises.

While for Gradle itself it works more or less OK - Gradle maintains some level of backward/forward-compatibility, the dependencies in each exercise are pinned to a given version.

Therefore, any upgrade of the dependencies will require synchronization between this repo and the exercises repo. And it will as well cause a bit of "downtime" for running automated tests on the exercises (while the image with updated dependencies is build and pushed).

I was wondering if we can use a similar approach to one used for caching Gradle dependencies and executables between CI builds:

  1. Mount a folder to the exercises CI. I presume, Exercism runs on AWS, so it can be an S3 bucket.
  2. Set GRADLE_USER_HOME to point to this folder.
  3. Exercises CI (GitHub Actions) runs and downloads all dependencies and Gradle executables it needs to that folder.
  4. The same folder is mounted to the test runner Docker container, with GRADLE_USER_HOME pointing to it.
  5. Gradle test runner runs in offline mode and fetches all the dependencies for this "cache".

I can prepare a proof of concept next week.

@ErikSchierboom
Copy link
Member Author

ErikSchierboom commented May 25, 2021

I agree that keep dependencies in sync can be tedious. Theoretically your solution would work, but it would require us to make changes to our infrastructure with potential security issues. I don't think we'll add something like this anytime in the near future, unless @iHiD thinks otherwise.

As a workaround, you could automatically create an issue in this repo whenever the exercises CI detects a new dependency being added.

@iHiD
Copy link
Member

iHiD commented May 25, 2021

@artamonovkirill I like your idea. But we won't get chance to do that before the launch of v3 now. Maybe we leave this open until I have more cycles and then come back it?

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

No branches or pull requests

3 participants