-
Notifications
You must be signed in to change notification settings - Fork 34
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
Dockerised binding regeneration #257
Conversation
217fd22
to
2ffd6a8
Compare
all done |
This is the minimal version I could find that fits all criteria: 1. Determinstic output: tree-sitter/tree-sitter#2755 2. Published for ARM64 3. Tests for reprolang pass
@@ -1,5 +1,6 @@ | |||
golang 1.19.10 | |||
nodejs 16.7.0 | |||
nodejs 16.20.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nodejs version in 16.x lineage that supports arm64 (for local development)
@@ -12,6 +12,6 @@ | |||
"nan": "^2.15.0" | |||
}, | |||
"devDependencies": { | |||
"tree-sitter-cli": "^0.20.4" | |||
"tree-sitter-cli": "0.21.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minimal version that is deterministic (tree-sitter/tree-sitter#2755), and available from arm64 (for local work), and available on NPM: https://www.npmjs.com/package/tree-sitter-cli?activeTab=versions (0.20.9 is missing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's for tests only, so doesn't matter
@@ -19,7 +19,7 @@ fi | |||
|
|||
echo "--- Haskell ---" | |||
command -v cabal > /dev/null 2>&1 || { echo >&2 "Haskell's 'cabal' command is not installed. Please install it first via https://www.haskell.org/ghcup/"; exit 1; } | |||
cabal install proto-lens-protoc-0.7.1.1 ghc-source-gen-0.4.3.0 --overwrite-policy=always --ghc-options='-j2 +RTS -A32m' --installdir="$PWD/.bin" | |||
cabal install proto-lens-protoc-0.8.0.1 ghc-source-gen-0.4.5.0 --overwrite-policy=always --ghc-options='-j2 +RTS -A32m' --installdir="$PWD/.bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumps required because latest GHC doesn't support original versions...
"build": "tsc --build --force bindings/typescript", | ||
"prettier": "prettier --write --list-different '**/*.{ts,js(on)?,md,yml}'", | ||
"prettier-check": "prettier --check '**/*.{ts,js(on)?,md,yml}'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to reference node_modules directly
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64,linux/arm64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is slow (VERY slow), this workflow runs only on main and nothing depends on it - so it finishes when it finishes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the container I can build all the bindings locally so I'm happy with this. Had one question about the image name
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- run: docker pull ghcr.io/sourcegraph/scip:latest || echo "no suitable cache" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it scip-bindings-env
everywhere else, but just scip
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, last place where I forgot to update it.
Frankly I don't think this helps at all, but I will still update the image once I'm back at the computer
# Configures this workflow to run every time a change is pushed to the branch called `release`. | ||
on: | ||
push: | ||
branches: ['main'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we limit running this only to specific commits? I'm worried we might get rate-limited if we try making a few changes in a single day given the size of the image. However, the docs don't mention any limits for total pull/push. https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think with Github's own registry rate limiting is not really an issue, but I will at least limit the concurrency of this job to avoid producing intermediate docker images for commits that aren't top of branch.
# We're changing the owner of the checkout folder to a particular user id, | ||
# matching the user id of `asdf` user we create inside the docker container. | ||
sudo chown -R 1001:1001 . && ./dev/generate-all-in-docker.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed because otherwise we might get permission errors inside the container? I don't understand why we need to create a separate asdf
user inside the container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for this is that I failed to make asdf work with a root user - there were some errors coming out from asdf itself which I didn't have time to debug.
It's an eyesore to have to do this, but to avoid it we'd need to make asdf work with root – which might not be worth the time, given the entire docker container is just a minimal hack to get back to reproducibility.
Hmm looks like the image publishing step failed on my PR after merging: https://github.com/sourcegraph/scip/actions/runs/9691568032/job/26743288072 should we rip that out for now? |
I will fix that workflow, I have a working one I can just copypaste. |
Fixes GRAPH-709
Several of us had problems with local environment trying to regenerate bindings.
We're switching to the dockerised build as a stopgap solution.
Test plan