Skip to content

Commit

Permalink
Test devcontainers build on rootless runners
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Jacobelli <[email protected]>
  • Loading branch information
jjacobelli committed Oct 19, 2023
1 parent 6ca6919 commit 81c091a
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/cuda11.8-conda/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"overrideFeatureInstallOrder": [
"./features/rapids-build-utils"
],
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0755 -p ${localWorkspaceFolder}/../.{aws,cache,config,conda/pkgs,conda/${localWorkspaceFolderBasename}-cuda11.8-envs} ${localWorkspaceFolder}/../{rmm,kvikio,cudf,raft,cumlprims_mg,cuml,cugraph-ops,cugraph,cuspatial}"],
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0775 -p ${localWorkspaceFolder}/../.{aws,cache,config,conda/pkgs,conda/${localWorkspaceFolderBasename}-cuda11.8-envs} ${localWorkspaceFolder}/../{rmm,kvikio,cudf,raft,cumlprims_mg,cuml,cugraph-ops,cugraph,cuspatial}"],
"postAttachCommand": ["/bin/bash", "-c", "if [ ${CODESPACES:-false} = 'true' ]; then . devcontainer-utils-post-attach-command; . rapids-post-attach-command; fi"],
"workspaceFolder": "/home/coder",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/devcontainers,type=bind,consistency=consistent",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda11.8-pip/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"./features/cuda",
"./features/rapids-build-utils"
],
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0755 -p ${localWorkspaceFolder}/../.{aws,cache,config/pip,local/share/${localWorkspaceFolderBasename}-cuda11.8-venvs} ${localWorkspaceFolder}/../{rmm,kvikio,cudf,raft,cumlprims_mg,cuml,cugraph-ops,cugraph,cuspatial}"],
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0775 -p ${localWorkspaceFolder}/../.{aws,cache,config/pip,local/share/${localWorkspaceFolderBasename}-cuda11.8-venvs} ${localWorkspaceFolder}/../{rmm,kvikio,cudf,raft,cumlprims_mg,cuml,cugraph-ops,cugraph,cuspatial}"],
"postAttachCommand": ["/bin/bash", "-c", "if [ ${CODESPACES:-false} = 'true' ]; then . devcontainer-utils-post-attach-command; . rapids-post-attach-command; fi"],
"workspaceFolder": "/home/coder",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/devcontainers,type=bind,consistency=consistent",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.0-conda/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"overrideFeatureInstallOrder": [
"./features/rapids-build-utils"
],
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0755 -p ${localWorkspaceFolder}/../.{aws,cache,config,conda/pkgs,conda/${localWorkspaceFolderBasename}-cuda12.0-envs} ${localWorkspaceFolder}/../{rmm,kvikio,cudf,raft,cumlprims_mg,cuml,cugraph-ops,cugraph,cuspatial}"],
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0775 -p ${localWorkspaceFolder}/../.{aws,cache,config,conda/pkgs,conda/${localWorkspaceFolderBasename}-cuda12.0-envs} ${localWorkspaceFolder}/../{rmm,kvikio,cudf,raft,cumlprims_mg,cuml,cugraph-ops,cugraph,cuspatial}"],
"postAttachCommand": ["/bin/bash", "-c", "if [ ${CODESPACES:-false} = 'true' ]; then . devcontainer-utils-post-attach-command; . rapids-post-attach-command; fi"],
"workspaceFolder": "/home/coder",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/devcontainers,type=bind,consistency=consistent",
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/cuda12.0-pip/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"./features/cuda",
"./features/rapids-build-utils"
],
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0755 -p ${localWorkspaceFolder}/../.{aws,cache,config/pip,local/share/${localWorkspaceFolderBasename}-cuda12.0-venvs} ${localWorkspaceFolder}/../{rmm,kvikio,cudf,raft,cumlprims_mg,cuml,cugraph-ops,cugraph,cuspatial}"],
"initializeCommand": ["/bin/bash", "-c", "mkdir -m 0775 -p ${localWorkspaceFolder}/../.{aws,cache,config/pip,local/share/${localWorkspaceFolderBasename}-cuda12.0-venvs} ${localWorkspaceFolder}/../{rmm,kvikio,cudf,raft,cumlprims_mg,cuml,cugraph-ops,cugraph,cuspatial}"],
"postAttachCommand": ["/bin/bash", "-c", "if [ ${CODESPACES:-false} = 'true' ]; then . devcontainer-utils-post-attach-command; . rapids-post-attach-command; fi"],
"workspaceFolder": "/home/coder",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/coder/devcontainers,type=bind,consistency=consistent",
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/devcontainer-json/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ runs:
steps:

- name: Setup Node.js
if: contains(runner.name, 'rapidsai') == true
if: contains(runner.name, 'testing') == true
uses: actions/setup-node@v3
with:
node-version: '16'
Expand Down
26 changes: 19 additions & 7 deletions .github/actions/setup-runner-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,25 @@ runs:
using: composite
steps:

- if: contains(runner.name, 'rapidsai') != true
- if: contains(runner.name, 'testing') != true
name: Free up disk space
uses: ./.github/actions/free-disk-space
with:
tool_cache: "${{ runner.tool_cache }}"

- if: contains(runner.name, 'rapidsai') == true
- if: contains(runner.name, 'testing') == true
name: Setup self-hosted runner environment
shell: bash -eo pipefail {0}
run: |
echo "HOME=${{ runner.workspace }}" >> $GITHUB_ENV;
echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV;
- if: contains(runner.name, 'rapidsai') == true
- if: contains(runner.name, 'testing') == true
name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- if: contains(runner.name, 'rapidsai') != true
name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Create docker context
shell: bash
run: docker context create builder
Expand All @@ -38,3 +34,19 @@ runs:
with:
buildkitd-flags: --debug
endpoint: builder
config-inline: |
debug = true
[registry."docker.io"]
mirrors = ["https://dc.arc-eks.gha-runners.nvidia.com"]
- name: Create Dockerfile
shell: bash
run: |
cat > ./Dockerfile <<EOF
FROM ubuntu:22.04
EOF
- name: Build
uses: docker/build-push-action@v4
with:
context: .
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

test:
name: ${{ inputs.name }} (${{ matrix.arch }})
runs-on: ${{ fromJSON(github.repository != 'rapidsai/devcontainers' && '"ubuntu-latest"' || format('"linux-{0}-cpu4"', matrix.arch)) }}
runs-on: ${{ fromJSON(github.repository != 'rapidsai/devcontainers' && '"ubuntu-latest"' || format('"linux-{0}-cpu4-testing"', matrix.arch)) }}
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-and-push-linux-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

build-test-and-upload:
name: Build (${{ matrix.arch }})
runs-on: ${{ fromJSON(github.repository != 'rapidsai/devcontainers' && '"ubuntu-latest"' || format('"linux-{0}-cpu4"', matrix.arch)) }}
runs-on: ${{ fromJSON(github.repository != 'rapidsai/devcontainers' && '"ubuntu-latest"' || format('"linux-{0}-cpu4-testing"', matrix.arch)) }}
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion features/src/llvm/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"updateContentCommand": [
"/bin/bash",
"-c",
"mkdir -m 0755 -p ~/.config/clangd && cp -n /etc/skel/.config/clangd/config.yaml ~/.config/clangd/config.yaml"
"mkdir -m 0775 -p ~/.config/clangd && cp -n /etc/skel/.config/clangd/config.yaml ~/.config/clangd/config.yaml"
],
"customizations": {
"vscode": {
Expand Down
8 changes: 4 additions & 4 deletions features/src/utils/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ for dir in $(for_each_user_bashrc 'echo "$(dirname "$(realpath -m "$0")")"'); do
rm -f "${dir}"/.gitconfig;
cp .gitconfig "${dir}"/.gitconfig.default;
# Create ~/.cache, i.e. $XDG_CACHE_HOME
mkdir -p -m 0755 "${dir}"/.cache;
mkdir -p -m 0775 "${dir}"/.cache;
# Create ~/.cache, i.e. $XDG_CONFIG_HOME
mkdir -p -m 0755 "${dir}"/.config/{clangd,pip};
mkdir -p -m 0775 "${dir}"/.config/{clangd,pip};
# Create ~/.local/state, i.e. $XDG_STATE_HOME
mkdir -p -m 0755 "${dir}"/.local/state;
mkdir -p -m 0775 "${dir}"/.local/state;
# Create or update ~/.ssh/known_hosts
mkdir -p -m 0700 "${dir}"/.ssh;
touch "${dir}"/.ssh/known_hosts;
Expand All @@ -140,7 +140,7 @@ usermod -aG crontab "${USERNAME}";
echo "${USERNAME}" >> /etc/cron.allow;

# Create ~/.cache, i.e. $XDG_CONFIG_HOME
mkdir -p -m 0755 "${USERHOME}"/.local/bin;
mkdir -p -m 0775 "${USERHOME}"/.local/bin;

# Ensure the user owns their homedir
chown -R "${USERNAME}:${USERNAME}" "${USERHOME}";
Expand Down
2 changes: 1 addition & 1 deletion image/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"updateContentCommand": [
"/bin/bash",
"-c",
"mkdir -m 0755 -p ~/.config/clangd && cp -n /etc/skel/.config/clangd/config.yaml ~/.config/clangd/config.yaml"
"mkdir -m 0775 -p ~/.config/clangd && cp -n /etc/skel/.config/clangd/config.yaml ~/.config/clangd/config.yaml"
],
"customizations": {
"vscode": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ run_devcontainer() {
--image-name "docker.io/rapidsai/devcontainers:${tag}" \
;

mkdir -p -m 0755 .scratch/.{aws,cache,config};
mkdir -p -m 0775 .scratch/.{aws,cache,config};

local term="${TERM:-}";
local lines="$(tput lines)";
Expand Down

0 comments on commit 81c091a

Please sign in to comment.