From 60da832ac4f8acd1d1c537a6cec6d06cab26f487 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Fri, 16 Sep 2022 20:42:46 +0200 Subject: [PATCH 01/36] Switch base image --- .gitpod.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 234e7584a1..9e9921a13f 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,15 +1,11 @@ -image: ghcr.io/conda/conda-ci:main-linux-python3.9 +image: ghcr.io/mamba-org/micromamba-devcontainer:git-d24ecc1 tasks: - name: initialize init: | - mkdir -p .vscode - echo '{"python.defaultInterpreterPath": "/workspace/pymc/env/bin/python"}' > .vscode/settings.json - conda init bash && source ~/.bashrc - conda env update -f conda-envs/environment-dev.yml -p /workspace/pymc/env - conda activate /workspace/pymc/env + micromamba install --yes --name base --file conda-envs/environment-dev.yml pip install -e . - command: | - conda init bash && echo "conda activate /workspace/pymc/env" >> ~/.bashrc && source ~/.bashrc + # command: | + # conda init bash && echo "conda activate /workspace/pymc/env" >> ~/.bashrc && source ~/.bashrc vscode: extensions: From dece5e08ddfd935b73f61f85dc0008c824cbf125 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 17:24:31 +0200 Subject: [PATCH 02/36] Update base image --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 9e9921a13f..49b423c166 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: ghcr.io/mamba-org/micromamba-devcontainer:git-d24ecc1 +image: ghcr.io/mamba-org/micromamba-devcontainer:git-c50a81d tasks: - name: initialize init: | From 1859f43e7366a92abd991f8808aeb8b1be50512f Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 17:24:54 +0200 Subject: [PATCH 03/36] Add Live Share extension --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index 49b423c166..e8d6a00e65 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -11,6 +11,7 @@ vscode: extensions: - eamodio.gitlens - ms-python.python + - ms-vsliveshare.vsliveshare github: prebuilds: From da64c059667344d8bb1db7cd25440ef89ee6792e Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 20:37:12 +0200 Subject: [PATCH 04/36] Update devcontainer base image --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index e8d6a00e65..bb3eb95657 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: ghcr.io/mamba-org/micromamba-devcontainer:git-c50a81d +image: ghcr.io/mamba-org/micromamba-devcontainer:git-0f25eb5 tasks: - name: initialize init: | From a36c45e9d3ea69c2097b94d30dee9c5bfbe209f2 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 20:40:04 +0200 Subject: [PATCH 05/36] Use _dev-init.sh as startup command --- .gitpod.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index bb3eb95657..0c15095795 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -4,8 +4,8 @@ tasks: init: | micromamba install --yes --name base --file conda-envs/environment-dev.yml pip install -e . - # command: | - # conda init bash && echo "conda activate /workspace/pymc/env" >> ~/.bashrc && source ~/.bashrc + command: | + _dev-init.sh vscode: extensions: From 6bd45441e72fc27e1a1b86d61c70288f15cf855f Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 20:52:47 +0200 Subject: [PATCH 06/36] Also run _dev-init.sh in init section --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index 0c15095795..a99eef2d93 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -2,6 +2,7 @@ image: ghcr.io/mamba-org/micromamba-devcontainer:git-0f25eb5 tasks: - name: initialize init: | + _dev-init.sh micromamba install --yes --name base --file conda-envs/environment-dev.yml pip install -e . command: | From dde23811b57dd8f739a43f4178e0f7904722037b Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 22:24:51 +0200 Subject: [PATCH 07/36] Update base devcontainer --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index a99eef2d93..451b00fa59 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: ghcr.io/mamba-org/micromamba-devcontainer:git-0f25eb5 +image: ghcr.io/mamba-org/micromamba-devcontainer:git-a49ee3e tasks: - name: initialize init: | From d344190f99a3e92f5d2951d6668319cda45da947 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 22:25:37 +0200 Subject: [PATCH 08/36] Remove Live Share since doesn't exist on OpenVSX --- .gitpod.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 451b00fa59..4575504092 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -12,7 +12,6 @@ vscode: extensions: - eamodio.gitlens - ms-python.python - - ms-vsliveshare.vsliveshare github: prebuilds: From 6c368ae2060e0fcd2b8d97623d629584c88066a5 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 22:26:55 +0200 Subject: [PATCH 09/36] Add Pyright extension --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index 4575504092..1a272bc09a 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -12,6 +12,7 @@ vscode: extensions: - eamodio.gitlens - ms-python.python + - ms-pyright.pyright github: prebuilds: From ce59496217fa35291c4ad979f16997d35fa7b85b Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 22:28:10 +0200 Subject: [PATCH 10/36] Set default interpreter path --- .gitpod.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitpod.yml b/.gitpod.yml index 1a272bc09a..d00d97d016 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -2,9 +2,23 @@ image: ghcr.io/mamba-org/micromamba-devcontainer:git-a49ee3e tasks: - name: initialize init: | + # General devcontainer initialization, e.g. pre-commit _dev-init.sh + + # Create an empty object for .vscode/settings.json if the file doesn't exist + mkdir -p .vscode + [ -f .vscode/settings.json ] || echo "{}" > .vscode/settings.json + + # Set the default interpreter path + jq '.["python.defaultInterpreterPath"] = "/opt/conda/bin/python"' \ + .vscode/settings.json | sponge .vscode/settings.json + + # Install dependencies micromamba install --yes --name base --file conda-envs/environment-dev.yml + + # Install PyMC pip install -e . + command: | _dev-init.sh From 99da664ce5cce216b405e93376cf15cdad9578de Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 22:46:06 +0200 Subject: [PATCH 11/36] Install pre-commit hooks in background --- .gitpod.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitpod.yml b/.gitpod.yml index d00d97d016..9628ff9214 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -20,8 +20,12 @@ tasks: pip install -e . command: | + # Reinitialize devcontainer for good measure _dev-init.sh + # Install the hooks in the background if not already installed + pre-commit install --install-hooks & + vscode: extensions: - eamodio.gitlens From cc158bd491a907b5f4297a34b4093d7da05354bf Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 22:46:48 +0200 Subject: [PATCH 12/36] Also set python.pythonPath --- .gitpod.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 9628ff9214..12e4aacfd6 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -10,8 +10,10 @@ tasks: [ -f .vscode/settings.json ] || echo "{}" > .vscode/settings.json # Set the default interpreter path - jq '.["python.defaultInterpreterPath"] = "/opt/conda/bin/python"' \ - .vscode/settings.json | sponge .vscode/settings.json + jq ' + .["python.defaultInterpreterPath"] = "/opt/conda/bin/python" + | .["python.pythonPath"] = "/opt/conda/bin/python" + ' .vscode/settings.json | sponge .vscode/settings.json # Install dependencies micromamba install --yes --name base --file conda-envs/environment-dev.yml From 183cbdc5d039cfd14f28a8c611041c95bf2e613d Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 22:51:09 +0200 Subject: [PATCH 13/36] Remove deprecated python.pythonPath setting --- .gitpod.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 12e4aacfd6..ed3b44a6d1 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -12,7 +12,6 @@ tasks: # Set the default interpreter path jq ' .["python.defaultInterpreterPath"] = "/opt/conda/bin/python" - | .["python.pythonPath"] = "/opt/conda/bin/python" ' .vscode/settings.json | sponge .vscode/settings.json # Install dependencies From bc783b69b5d62cfaab56ffe5746a3e0ab0397cc5 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 22:57:28 +0200 Subject: [PATCH 14/36] Add Git History plugin --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index ed3b44a6d1..5e2d564527 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -32,6 +32,7 @@ vscode: - eamodio.gitlens - ms-python.python - ms-pyright.pyright + - donjayamanne.githistory github: prebuilds: From cff48013ba9fd459ba7a3d2d8f72f1b5fa7db160 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 22:58:06 +0200 Subject: [PATCH 15/36] Install pre-commit hooks in foreground --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 5e2d564527..f0f94bcdff 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -25,7 +25,7 @@ tasks: _dev-init.sh # Install the hooks in the background if not already installed - pre-commit install --install-hooks & + pre-commit install --install-hooks vscode: extensions: From e8c9e2788bfc52bce1f2403077ca996ce5e07f0c Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sat, 17 Sep 2022 23:49:24 +0200 Subject: [PATCH 16/36] Add .dockerignore --- .dockerignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..343af45d90 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +.mypy_cache From 55ddc4306985c19807c522c57fc9d20fc45d6527 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 00:00:47 +0200 Subject: [PATCH 17/36] Add dev.Dockerfile --- scripts/dev.Dockerfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/dev.Dockerfile diff --git a/scripts/dev.Dockerfile b/scripts/dev.Dockerfile new file mode 100644 index 0000000000..91c8ca7662 --- /dev/null +++ b/scripts/dev.Dockerfile @@ -0,0 +1,19 @@ +FROM ghcr.io/mamba-org/micromamba-devcontainer:git-a49ee3e + +COPY --chown=${MAMBA_USER}:${MAMBA_USER} conda-envs/environment-dev.yml /tmp/environment-dev.yml +RUN : \ + && micromamba install --yes --name base --file /tmp/environment-dev.yml \ + && micromamba clean --all --yes \ + && rm /tmp/environment-dev.yml \ +; + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +COPY --chown=${MAMBA_USER}:${MAMBA_USER} .pre-commit-config.yaml /fake-repo/.pre-commit-config.yaml +RUN : \ + && cd /fake-repo \ + && git init \ + && pre-commit install-hooks \ + && rm -rf /fake-repo \ + && mv ~/.cache/pre-commit /tmp/.pre-commit-cache-prebuilt \ +; From fc7634a8b61c53251a7c866a9a7ace04528b6708 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 00:01:13 +0200 Subject: [PATCH 18/36] Add workflow to build devcontainer --- .../workflows/devcontainer-docker-image.yml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/devcontainer-docker-image.yml diff --git a/.github/workflows/devcontainer-docker-image.yml b/.github/workflows/devcontainer-docker-image.yml new file mode 100644 index 0000000000..be5f90a55e --- /dev/null +++ b/.github/workflows/devcontainer-docker-image.yml @@ -0,0 +1,57 @@ +name: devcontainer-docker-image + +on: + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} # user/reponame + +jobs: + build-container: + runs-on: ubuntu-latest + + # Set permissions for GitHub token + # + permissions: + contents: read + packages: write + + steps: + - name: Checkout source + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # v2.0.0 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v2.0.0 + + - name: Prepare metadata + id: meta + uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a # v4.0.1 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=sha,enable=true,prefix=git- + type=raw,value=latest + + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v2.0.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + id: docker_build + uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 # v3.0.0 + with: + context: . + file: scripts/dev.Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + cache-to: type=inline From adc08725428aa198bc52c68525114628d67282ba Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 00:14:08 +0200 Subject: [PATCH 19/36] Disable arm64 devcontainer builds --- .github/workflows/devcontainer-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/devcontainer-docker-image.yml b/.github/workflows/devcontainer-docker-image.yml index be5f90a55e..33ee0e5e60 100644 --- a/.github/workflows/devcontainer-docker-image.yml +++ b/.github/workflows/devcontainer-docker-image.yml @@ -49,7 +49,7 @@ jobs: with: context: . file: scripts/dev.Dockerfile - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 # ,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 0cc59091a1fa5e2e9f54cfc72bd18d6da324f437 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 00:24:54 +0200 Subject: [PATCH 20/36] Sudo --- scripts/dev.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dev.Dockerfile b/scripts/dev.Dockerfile index 91c8ca7662..fdd85dc927 100644 --- a/scripts/dev.Dockerfile +++ b/scripts/dev.Dockerfile @@ -14,6 +14,6 @@ RUN : \ && cd /fake-repo \ && git init \ && pre-commit install-hooks \ - && rm -rf /fake-repo \ + && sudo rm -rf /fake-repo \ && mv ~/.cache/pre-commit /tmp/.pre-commit-cache-prebuilt \ ; From 5b8bcc388e38ca8640aa293d4477eff99d1a2e7e Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 00:40:51 +0200 Subject: [PATCH 21/36] Use prebuilt PyMC devcontainer --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index f0f94bcdff..2605767338 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: ghcr.io/mamba-org/micromamba-devcontainer:git-a49ee3e +image: ghcr.io/maresb/pymc:git-324ef13 tasks: - name: initialize init: | From a9ca5ffa9b79afd4dd687836f8ec7ca3eafdc88b Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 01:03:42 +0200 Subject: [PATCH 22/36] Make all files writeable --- scripts/dev.Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/dev.Dockerfile b/scripts/dev.Dockerfile index fdd85dc927..8ec81d5236 100644 --- a/scripts/dev.Dockerfile +++ b/scripts/dev.Dockerfile @@ -5,6 +5,7 @@ RUN : \ && micromamba install --yes --name base --file /tmp/environment-dev.yml \ && micromamba clean --all --yes \ && rm /tmp/environment-dev.yml \ + && sudo chmod a+rwx /opt/conda \ ; ARG MAMBA_DOCKERFILE_ACTIVATE=1 @@ -15,5 +16,7 @@ RUN : \ && git init \ && pre-commit install-hooks \ && sudo rm -rf /fake-repo \ - && mv ~/.cache/pre-commit /tmp/.pre-commit-cache-prebuilt \ + && sudo mkdir --mode=777 /opt/.pre-commit-cache-prebuilt \ + && mv ~/.cache/pre-commit/* /opt/.pre-commit-cache-prebuilt \ + && chmod a+rwx /opt/.pre-commit-cache-prebuilt \ ; From 57c3fef94e3dfba8f2501647c99a6c0f8a4ac5a2 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 01:05:24 +0200 Subject: [PATCH 23/36] Copy pre-built pre-commit cache if it doesn't exist yet --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 2605767338..8e96c807b3 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -25,7 +25,7 @@ tasks: _dev-init.sh # Install the hooks in the background if not already installed - pre-commit install --install-hooks + [ -f ~/.cache/pre-commit/README ] || cp -R /opt/.pre-commit-cache-prebuilt/* ~/.cache/pre-commit/ vscode: extensions: From 11e5106f85ad31a6bcbb41afba575230f8798ea4 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 01:06:30 +0200 Subject: [PATCH 24/36] Run chmod with sudo --- scripts/dev.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dev.Dockerfile b/scripts/dev.Dockerfile index 8ec81d5236..ff1a5cc582 100644 --- a/scripts/dev.Dockerfile +++ b/scripts/dev.Dockerfile @@ -18,5 +18,5 @@ RUN : \ && sudo rm -rf /fake-repo \ && sudo mkdir --mode=777 /opt/.pre-commit-cache-prebuilt \ && mv ~/.cache/pre-commit/* /opt/.pre-commit-cache-prebuilt \ - && chmod a+rwx /opt/.pre-commit-cache-prebuilt \ + && sudo chmod a+rwx /opt/.pre-commit-cache-prebuilt \ ; From 5a560a03fc2829effabba353214ca06d853828a4 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 01:20:39 +0200 Subject: [PATCH 25/36] Use updated devcontainer --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 8e96c807b3..ca1b1ffaef 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: ghcr.io/maresb/pymc:git-324ef13 +image: ghcr.io/maresb/pymc:git-3866b0e tasks: - name: initialize init: | From e75670300d9d3caccdc8e31ea689da15c0565f81 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 01:30:44 +0200 Subject: [PATCH 26/36] Make chmod recursive --- scripts/dev.Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/dev.Dockerfile b/scripts/dev.Dockerfile index ff1a5cc582..e3cbaafaa1 100644 --- a/scripts/dev.Dockerfile +++ b/scripts/dev.Dockerfile @@ -5,7 +5,7 @@ RUN : \ && micromamba install --yes --name base --file /tmp/environment-dev.yml \ && micromamba clean --all --yes \ && rm /tmp/environment-dev.yml \ - && sudo chmod a+rwx /opt/conda \ + && sudo chmod -R a+rwx /opt/conda \ ; ARG MAMBA_DOCKERFILE_ACTIVATE=1 @@ -18,5 +18,5 @@ RUN : \ && sudo rm -rf /fake-repo \ && sudo mkdir --mode=777 /opt/.pre-commit-cache-prebuilt \ && mv ~/.cache/pre-commit/* /opt/.pre-commit-cache-prebuilt \ - && sudo chmod a+rwx /opt/.pre-commit-cache-prebuilt \ + && sudo chmod -R a+rwx /opt/.pre-commit-cache-prebuilt \ ; From 180857f32fae56c6e90a1aa45877412047f73144 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 01:56:45 +0200 Subject: [PATCH 27/36] Update devcontainer base --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index ca1b1ffaef..06c88769fc 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: ghcr.io/maresb/pymc:git-3866b0e +image: ghcr.io/maresb/pymc:git-c2dfc4f tasks: - name: initialize init: | From e25f8419649a59763a21274d71c8d4955e269fba Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 13:23:33 +0200 Subject: [PATCH 28/36] Set PRE_COMMIT_HOME to save precomputed cache --- scripts/dev.Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/dev.Dockerfile b/scripts/dev.Dockerfile index e3cbaafaa1..2f31718970 100644 --- a/scripts/dev.Dockerfile +++ b/scripts/dev.Dockerfile @@ -12,11 +12,10 @@ ARG MAMBA_DOCKERFILE_ACTIVATE=1 COPY --chown=${MAMBA_USER}:${MAMBA_USER} .pre-commit-config.yaml /fake-repo/.pre-commit-config.yaml RUN : \ + && sudo mkdir --mode=777 /opt/.pre-commit-cache-prebuilt \ && cd /fake-repo \ && git init \ - && pre-commit install-hooks \ + && PRE_COMMIT_HOME=/opt/.pre-commit-cache-prebuilt pre-commit install-hooks \ && sudo rm -rf /fake-repo \ - && sudo mkdir --mode=777 /opt/.pre-commit-cache-prebuilt \ - && mv ~/.cache/pre-commit/* /opt/.pre-commit-cache-prebuilt \ && sudo chmod -R a+rwx /opt/.pre-commit-cache-prebuilt \ ; From cab57ea46e23b9dc7b2285f92b177140113f5053 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 13:26:30 +0200 Subject: [PATCH 29/36] Chown conda-meta/history Not sure why this is necessary. Otherwise I get: critical libmamba Operation not permitted: '/opt/conda/conda-meta/history' --- .gitpod.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitpod.yml b/.gitpod.yml index 06c88769fc..a3cede0e7b 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -15,6 +15,7 @@ tasks: ' .vscode/settings.json | sponge .vscode/settings.json # Install dependencies + sudo chown "$(id -u):$(id -g)" /opt/conda/conda-meta/history micromamba install --yes --name base --file conda-envs/environment-dev.yml # Install PyMC From 008d78cc54625dca218f340ffd2201a6d01a1ebd Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Sun, 18 Sep 2022 13:28:00 +0200 Subject: [PATCH 30/36] Update devcontainer base image --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index a3cede0e7b..3790c61d77 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: ghcr.io/maresb/pymc:git-c2dfc4f +image: ghcr.io/maresb/pymc:git-ebd893b tasks: - name: initialize init: | From 8a5a1271712af1245a46874aff0724b0c92cf571 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Thu, 26 Jan 2023 03:17:06 +0100 Subject: [PATCH 31/36] Remove GHA version comments Bumping version numbers should work via dependabot. --- .github/workflows/devcontainer-docker-image.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/devcontainer-docker-image.yml b/.github/workflows/devcontainer-docker-image.yml index 33ee0e5e60..b68229b8a2 100644 --- a/.github/workflows/devcontainer-docker-image.yml +++ b/.github/workflows/devcontainer-docker-image.yml @@ -19,17 +19,14 @@ jobs: steps: - name: Checkout source - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 - - - name: Set up QEMU - uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # v2.0.0 + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b - name: Setup Docker buildx - uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v2.0.0 + uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 - name: Prepare metadata id: meta - uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a # v4.0.1 + uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | @@ -37,7 +34,7 @@ jobs: type=raw,value=latest - name: Log into registry ${{ env.REGISTRY }} - uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v2.0.0 + uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -45,7 +42,7 @@ jobs: - name: Build and push Docker image id: docker_build - uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 # v3.0.0 + uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 with: context: . file: scripts/dev.Dockerfile From 3581165f165bd9dced936a638c294e39cd0d4eb6 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Thu, 26 Jan 2023 03:17:33 +0100 Subject: [PATCH 32/36] Name image as pymc-devcontainer --- .github/workflows/devcontainer-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/devcontainer-docker-image.yml b/.github/workflows/devcontainer-docker-image.yml index b68229b8a2..d3826efed8 100644 --- a/.github/workflows/devcontainer-docker-image.yml +++ b/.github/workflows/devcontainer-docker-image.yml @@ -5,7 +5,7 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} # user/reponame + IMAGE_NAME: ${{ github.repository }}-devcontainer # pymc-devs/pymc-devcontainer jobs: build-container: From 91ea267807c16dfd5480d35801e4ea8e067865e3 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Thu, 26 Jan 2023 04:38:18 +0100 Subject: [PATCH 33/36] Use latest available pymc-devcontainer --- .gitpod.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 3790c61d77..6e1db48c3d 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: ghcr.io/maresb/pymc:git-ebd893b +image: ghcr.io/maresb/pymc-devcontainer:latest tasks: - name: initialize init: | @@ -25,7 +25,7 @@ tasks: # Reinitialize devcontainer for good measure _dev-init.sh - # Install the hooks in the background if not already installed + # Install the pre-commit hooks in the background if not already installed [ -f ~/.cache/pre-commit/README ] || cp -R /opt/.pre-commit-cache-prebuilt/* ~/.cache/pre-commit/ vscode: From 1e2f19366c4c7dd8eb70238a6a682d35cfd07cf8 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Thu, 26 Jan 2023 04:38:37 +0100 Subject: [PATCH 34/36] Bump devcontainer base version --- scripts/dev.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dev.Dockerfile b/scripts/dev.Dockerfile index 2f31718970..624149455d 100644 --- a/scripts/dev.Dockerfile +++ b/scripts/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/mamba-org/micromamba-devcontainer:git-a49ee3e +FROM ghcr.io/mamba-org/micromamba-devcontainer:git-5185ae9 COPY --chown=${MAMBA_USER}:${MAMBA_USER} conda-envs/environment-dev.yml /tmp/environment-dev.yml RUN : \ From c506caa5a3cffb93b4b4f88196311887e2021d14 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Thu, 26 Jan 2023 04:05:42 +0000 Subject: [PATCH 35/36] Ensure pre-commit hooks are installed --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 6e1db48c3d..94d2712d0f 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -26,7 +26,7 @@ tasks: _dev-init.sh # Install the pre-commit hooks in the background if not already installed - [ -f ~/.cache/pre-commit/README ] || cp -R /opt/.pre-commit-cache-prebuilt/* ~/.cache/pre-commit/ + pre-commit install --install-hooks vscode: extensions: From 1af8658d16badf4f3e5aab890fd6f0dd1a73134f Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Thu, 26 Jan 2023 04:30:25 +0000 Subject: [PATCH 36/36] Add some vscode settings --- .gitpod.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 94d2712d0f..a09276d016 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -9,10 +9,16 @@ tasks: mkdir -p .vscode [ -f .vscode/settings.json ] || echo "{}" > .vscode/settings.json - # Set the default interpreter path + # Add vscode settings jq ' .["python.defaultInterpreterPath"] = "/opt/conda/bin/python" ' .vscode/settings.json | sponge .vscode/settings.json + jq ' + .["terminal.integrated.defaultProfile.linux"] = "bash" + ' .vscode/settings.json | sponge .vscode/settings.json + jq ' + .["git.autofetch"] = true + ' .vscode/settings.json | sponge .vscode/settings.json # Install dependencies sudo chown "$(id -u):$(id -g)" /opt/conda/conda-meta/history