Skip to content

Conversation

@jiegillet
Copy link
Contributor

@jiegillet jiegillet commented Mar 1, 2022

This PR is meant to address everything left to do before deployment.

Docker

It took me a while to figure out how docker works and how to debug it (especially since both elm and elm-review don't have explicit offline modes), but thanks to useful advice from Slack, I think I managed to get to something that works. I ended up with something very similar to elm-test-runner.
Of course, please do review carefully since this is my first docker build.

I made various changes to the shell scripts so that the same ones can run both locally and in docker.

CI

I copied docker.yml pretty much as is (I only removed the master branch) from an Elixir repo, that should be fine. It doesn't run on my fork, probably @ErikSchierboom has to do some admin magic on it?

elm_tests.yml runs all the tests with elm-test (not elm-test-rs because version 1.1 doesn't allow tests with the same name, but IMO they make sense here. I didn't check later versions), checks the formatting, runs elm-review on the repo, and runs run-tests-in-docker.sh, which is basically bin/smoke_test.sh in the container.

elm-review

I took the approach of (quote from README)

As a rule of thumb, if we expect the students to follow specific rules when writing their solutions, we should hold ourselves to the same standards in our source code.

So I would like to keep the rules from the repo the same as the common rules we use for the students (we don't have any active at the moment, but I'm expecting we will add NoUnused and Simplify at some point).

All changes from the elm code was suggested from those rules.

README

I wrote one.

Going live

We will need to merge that PR so we can check if the analyzer works as intended. You will get a comment if you use either List.filter or List.filterMap.

Maintaining the repo

At this point, I would like to request to become a maintainer on the Elm track, if I can get the blessing of @mpizenberg and @ceddlyburge.

I changed the CODEOWNER file so that we don't need admins to review each PR that don't touch the .github repo.

@jiegillet jiegillet requested a review from a team as a code owner March 1, 2022 14:26
Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

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

Great stuff! I've left some comments.

@iHiD Could you give this repo access to the proper secrets?

mkdir -p "$OUTPUT_DIR"
docker run \
--rm \
--network none \
Copy link
Member

Choose a reason for hiding this comment

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

Just a FYI: we currently don't yet run on a readonly filesystem, but this might change in the future. You don't have to change anything, but just wanted to point it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What does readonly mean exactly? Not being able to create any sort of file anywhere on the container?
Because if that's the case, it would become a lot more tricky to make the analyzer or even test runner work...

Copy link
Member

Choose a reason for hiding this comment

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

Complementary remark, the test runner cannot work "simply" in readonly because the elm compiler is writing to a lock file inside $HOME/.elm during compilation. It can be done by changing the location of the $ELM_HOME variable to a writable place during execution but that's very cumbersome for the docker code, because it also means copying the contents of that directory to have all pre-installed packages available.

Copy link
Member

Choose a reason for hiding this comment

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

No network is fine though, my remark was just regarding readonly

Copy link
Member

Choose a reason for hiding this comment

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

What does readonly mean exactly? Not being able to create any sort of file anywhere on the container?
Because if that's the case, it would become a lot more tricky to make the analyzer or even test runner work...

It would mean that by default all directories are indeed not writable, save for a couple of exceptions: the /tmp dir and the /output dir. But as we've not yet implemented this (or decided we want this), I wouldn't worry about it. Note that most of the test runners have been implemented this way (to work with readonly), but for some tracks it can indeed be more of a bother.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If /tmp stays writable, then I believe we can make it work. No worries then :)

@@ -0,0 +1,2 @@
{"summary":"Check the comments for things to fix. 🛠 ","comments":[{"comment":"elm.strain.do_not_use_filter","type":"essential","params":{}}]}
Copy link
Member

Choose a reason for hiding this comment

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

It's important to have https://github.com/exercism/website-copy/pull/2161/files merged before the analyzer property is set to true in the track's config.json file: https://github.com/exercism/elm/blob/main/config.json#L19

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted! I didn't know about that line inconfig.json, thank you.

I don't think I can request a review from @mpizenberg or @ceddlyburge on website-copy, they are not on the list. How can we add them in there? We will need to approve analyzer comments in the future. Maybe in the mean time you could approve it?

Copy link
Member

Choose a reason for hiding this comment

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

I've approved.

I don't think I can request a review from @mpizenberg or @ceddlyburge on website-copy, they are not on the list. How can we add them in there? We will need to approve analyzer comments in the future. Maybe in the mean time you could approve it?

I don't know if @mpizenberg and/or @ceddlyburge want to be added to the website-copy team, as they'll get a lot more notifications then.

We have a separate team for reviewing website-copy PRs, so you could always ping them (@exercism / website-copy).
You could then first request a review from @mpizenberg or @ceddlyburge and when they're happy, ask for the website-copy team to approve and merge.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, I'd prefer not to be added to website-copy. I don't mind occasionally being pingged there for analyzer messages though, even if I cannot officially review. I might just comment if I find the time, or not if I don't.

Copy link
Member

Choose a reason for hiding this comment

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

I've just merged the website-copy PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I am added to website-copy, but I unwatched the repo, so I only get emails when people mention me or request a review. That works for me.
But sure, we can ping people for analyzer messages.

@ceddlyburge
Copy link
Contributor

At this point, I would like to request to become a maintainer on the Elm track, if I can get the blessing of @mpizenberg and @ceddlyburge.

You have my blessing :)

@mpizenberg
Copy link
Member

Mine too :)

Copy link
Contributor Author

@jiegillet jiegillet left a comment

Choose a reason for hiding this comment

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

Thank you very much.
I think I've addressed all the comments.

mkdir -p "$OUTPUT_DIR"
docker run \
--rm \
--network none \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What does readonly mean exactly? Not being able to create any sort of file anywhere on the container?
Because if that's the case, it would become a lot more tricky to make the analyzer or even test runner work...

@@ -0,0 +1,2 @@
{"summary":"Check the comments for things to fix. 🛠 ","comments":[{"comment":"elm.strain.do_not_use_filter","type":"essential","params":{}}]}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted! I didn't know about that line inconfig.json, thank you.

I don't think I can request a review from @mpizenberg or @ceddlyburge on website-copy, they are not on the list. How can we add them in there? We will need to approve analyzer comments in the future. Maybe in the mean time you could approve it?

@@ -0,0 +1,53 @@
FROM node:lts-alpine AS builder
Copy link
Contributor

Choose a reason for hiding this comment

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

I use a tool called HadoLint in VsCode to lint Dokerfiles. It has 3 warning messages and 1 info message for this file. There is nothing drastic but it is probably worth taking a look. If you can't run the tool yourself let me know and I can drop the messages in here or we can have a call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I managed to install it and make it happy :)
Thank you for the recommendation.

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this part of the smoke test? It might be worth making this obvious in some way if so.

@jiegillet jiegillet force-pushed the jie-analyzer-docker branch from f77ae93 to 68cc357 Compare March 6, 2022 01:57
@jiegillet
Copy link
Contributor Author

jiegillet commented Mar 6, 2022

I know I was told not to worry, but I modified run.sh and the smoke test so that it would run in read-only (but still writing in /tmp).

Is there anything left to do before generating the secrets and activating the analyzer in the Elm config file?

@mpizenberg
Copy link
Member

I know I was told not to worry, but I modified run.sh and the smoke test so that it would run in read-only

Haha It's like you just climbed a mountain, you have a great view, but there is this last spot, 50m away, and your journey would not be complete until you make sure the view isn't better from up there.

If I have a small nitpick (without checking in detail all the PR), why are some files are with an eol at the eof while some do not have an eol? I think the posix standard ask that we add an eol as the last char of a file. If you use VSCode it should be this setting: "files.insertFinalNewline": true

@jiegillet
Copy link
Contributor Author

Haha yeah, it's that kind of feeling. And when you reach this other perfect peak, you spot another one :)

Thank you for the EOL tip, it is something that I never really paid attention to, I do use VSCode and I've enabled the setting.

@@ -0,0 +1,21 @@
name: Deploy
Copy link
Member

Choose a reason for hiding this comment

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

This file is now a duplicate of the deploy.yml file and can be removed.

@ErikSchierboom ErikSchierboom added the x:size/massive Massive amount of work label Mar 7, 2022
@ErikSchierboom
Copy link
Member

ErikSchierboom commented Mar 8, 2022

From my point of view, this is ready to be merged!

@ceddlyburge
Copy link
Contributor

me too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

x:size/massive Massive amount of work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants