From 0f8f0643a8b8eafd91e641b6a47c33d7c04f424d Mon Sep 17 00:00:00 2001 From: Afonso Oliveira Date: Mon, 9 Dec 2024 15:24:02 +0000 Subject: [PATCH 1/9] Add dockerFile support Signed-off-by: Afonso Oliveira --- .devcontainer/Dockerfile | 54 ++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index dc8c8f2e1..ce84962b9 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,16 +1,38 @@ -FROM ubuntu:24.04 AS spython-base -RUN export DEBIAN_FRONTEND=noninteractive -RUN apt-get update -RUN apt-get install -y --no-install-recommends git gh -RUN apt-get install -y --no-install-recommends less -RUN apt-get install -y --no-install-recommends python3 -RUN apt-get install -y --no-install-recommends python3.12-venv python3-pip -RUN apt-get install -y --no-install-recommends build-essential -RUN apt-get install -y --no-install-recommends ruby ruby-dev -RUN apt-get install -y --no-install-recommends bundler -RUN apt-get install -y --no-install-recommends nodejs -RUN apt-get install -y --no-install-recommends npm -RUN apt-get install -y --no-install-recommends ditaa -RUN apt-get clean autoclean -RUN apt-get autoremove -y -RUN rm -rf /var/lib/{apt, dpkg, cache, log} +# Use Ubuntu 24.04 as base image +FROM ubuntu:24.04 + +ENV DEBIAN_FRONTEND=noninteractive +ENV DEVCONTAINER_ENV=1 +ENV BUNDLE_PATH=/usr/local/bundle +ENV BUNDLE_APP_CONFIG=/usr/local/bundle + +# Set working directory +WORKDIR /workspace + +COPY Gemfile Gemfile.lock ./ + +# Install dependencies +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + git \ + gh \ + less \ + python3 \ + python3.12-venv \ + python3-pip \ + build-essential \ + ruby \ + ruby-dev \ + bundler \ + nodejs \ + npm \ + ditaa && \ + bundle install && \ + apt-get clean autoclean && \ + apt-get autoremove -y && \ + rm -rf /var/lib/{apt,dpkg,cache,log}/* + +COPY package.json package-lock.json ./ + +# Stay in workspace directory +WORKDIR /workspace \ No newline at end of file From 4bb859cbd669b1d3aa203c87d838813d7275e5d2 Mon Sep 17 00:00:00 2001 From: Afonso Oliveira Date: Tue, 10 Dec 2024 21:41:59 +0000 Subject: [PATCH 2/9] Best pratices Dockerfile Signed-off-by: Afonso Oliveira --- .devcontainer/Dockerfile | 47 +++++++++++++++------------------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ce84962b9..5c26c114d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,38 +1,25 @@ -# Use Ubuntu 24.04 as base image FROM ubuntu:24.04 ENV DEBIAN_FRONTEND=noninteractive -ENV DEVCONTAINER_ENV=1 -ENV BUNDLE_PATH=/usr/local/bundle -ENV BUNDLE_APP_CONFIG=/usr/local/bundle -# Set working directory WORKDIR /workspace -COPY Gemfile Gemfile.lock ./ +RUN export DEBIAN_FRONTEND=noninteractive +RUN apt-get update +RUN apt-get install -y --no-install-recommends git gh +RUN apt-get install -y --no-install-recommends less +RUN apt-get install -y --no-install-recommends python3 +RUN apt-get install -y --no-install-recommends python3.12-venv +RUN apt-get install -y --no-install-recommends python3-pip +RUN apt-get install -y --no-install-recommends build-essential +RUN apt-get install -y --no-install-recommends ruby +RUN apt-get install -y --no-install-recommends ruby-dev +RUN apt-get install -y --no-install-recommends bundler +RUN apt-get install -y --no-install-recommends nodejs +RUN apt-get install -y --no-install-recommends npm +RUN apt-get install -y --no-install-recommends ditaa +RUN apt-get clean autoclean +RUN apt-get autoremove -y +RUN rm -rf /var/lib/{apt,dpkg,cache,log}/* -# Install dependencies -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - git \ - gh \ - less \ - python3 \ - python3.12-venv \ - python3-pip \ - build-essential \ - ruby \ - ruby-dev \ - bundler \ - nodejs \ - npm \ - ditaa && \ - bundle install && \ - apt-get clean autoclean && \ - apt-get autoremove -y && \ - rm -rf /var/lib/{apt,dpkg,cache,log}/* - -COPY package.json package-lock.json ./ - -# Stay in workspace directory WORKDIR /workspace \ No newline at end of file From b0b0dfb80a5e3ce03f135bf86cc877341b6f1217 Mon Sep 17 00:00:00 2001 From: Afonso Oliveira Date: Tue, 10 Dec 2024 21:45:08 +0000 Subject: [PATCH 3/9] Add simple Docker environment variable Signed-off-by: Afonso Oliveira --- bin/setup | 152 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 95 insertions(+), 57 deletions(-) diff --git a/bin/setup b/bin/setup index 2ec418816..537266e3c 100755 --- a/bin/setup +++ b/bin/setup @@ -6,66 +6,94 @@ cd $ROOT CONTAINER_TAG=`cat ${ROOT}/bin/.container-tag` +print_env() { + if [ -v DOCKER ]; then + echo "Using Docker environment" + else + echo "Using Singularity environment" + fi +} + if [ -v GITHUB_ACTIONS ]; then - echo "ACTIONS" - CONTAINER_PATH=${ROOT}/.singularity/image.sif - HOME_PATH=${GITHUB_WORKSPACE} - HOME_OPT="--home ${ROOT}/.home" - SINGULARITY_CACHE=--disable-cache + echo "ACTIONS" + CONTAINER_PATH=${ROOT}/.singularity/image.sif + HOME_PATH=${GITHUB_WORKSPACE} + HOME_OPT="--home ${ROOT}/.home" + SINGULARITY_CACHE=--disable-cache +elif [ -v DOCKER ]; then + print_env + if ! docker images udb | grep -q udb ; then + echo "Building Docker image..." + docker build -t udb -f .devcontainer/Dockerfile . + fi + DOCKER_BASE="docker run -it -v $(pwd):$(pwd) -w $(pwd) udb" + RUN="${DOCKER_BASE}" else - CONTAINER_PATH=${ROOT}/.singularity/image-$CONTAINER_TAG.sif - HOME_PATH=${HOME} - HOME_OPT="--bind ${ROOT}/.home:${HOME_PATH}" - SINGULARITY_CACHE= + print_env + CONTAINER_PATH=${ROOT}/.singularity/image-$CONTAINER_TAG.sif + HOME_PATH=${HOME} + HOME_OPT="--bind ${ROOT}/.home:${HOME_PATH}" + SINGULARITY_CACHE= fi if [ -f $ROOT/.git ]; then - # if this is a worktree, need to add the parent git repo in, too - GIT_PATH=`git rev-parse --git-common-dir | tr -d '\n' | xargs dirname` - HOME_OPT="${HOME_OPT} --bind ${GIT_PATH}:${GIT_PATH}" + # if this is a worktree, need to add the parent git repo in, too + GIT_PATH=`git rev-parse --git-common-dir | tr -d '\n' | xargs dirname` + HOME_OPT="${HOME_OPT} --bind ${GIT_PATH}:${GIT_PATH}" fi if [ -v DEVCONTAINER_ENV ]; then - RUN="" + RUN="" +elif [ -v DOCKER ]; then + RUN="${DOCKER_BASE}" else - RUN="singularity run ${HOME_OPT} ${CONTAINER_PATH} " + RUN="singularity run ${HOME_OPT} ${CONTAINER_PATH}" fi if [ ! -d $ROOT/.home ]; then - mkdir $ROOT/.home + mkdir $ROOT/.home fi if [ ! -v DEVCONTAINER_ENV ]; then - if [ ! -f ${CONTAINER_PATH} ]; then - echo "Fetching container..." - if [ ! -d "${ROOT}/.singularity" ]; then - mkdir -p ${ROOT}/.singularity + if [ -v DOCKER ]; then + if ! docker images udb | grep -q udb ; then + echo "Building Docker image..." + docker build -t udb -f .devcontainer/Dockerfile . + fi + else + if [ ! -f ${CONTAINER_PATH} ]; then + echo "Fetching container..." + if [ ! -d "${ROOT}/.singularity" ]; then + mkdir -p ${ROOT}/.singularity + fi + singularity pull ${SINGULARITY_CACHE} ${CONTAINER_PATH} oras://docker.io/riscvintl/spec-generator:$CONTAINER_TAG + fi fi - singularity pull ${SINGULARITY_CACHE} ${CONTAINER_PATH} oras://docker.io/riscvintl/spec-generator:$CONTAINER_TAG - fi fi if [ ! -f $ROOT/.bundle/config ]; then - OLDDIR=$PWD - cd $ROOT - ${RUN} bundle config set --local path ${ROOT}/.home/.gems - ${RUN} bundle config set --local cache_path ${ROOT}/.home/.cache - cd $OLDDIR + OLDDIR=$PWD + cd $ROOT + ${RUN} bundle config set --local path ${ROOT}/.home/.gems + ${RUN} bundle config set --local cache_path ${ROOT}/.home/.cache + cd $OLDDIR fi if [ ! -d $ROOT/.home/.gems ]; then - OLDDIR=$PWD - cd $ROOT - ${RUN} bundle install - cd $OLDDIR + OLDDIR=$PWD + cd $ROOT + ${RUN} bundle install + cd $OLDDIR fi if [ ! -d $ROOT/.home/.venv ]; then - ${RUN} /usr/bin/python3 -m venv ${ROOT}/.home/.venv + ${RUN} /usr/bin/python3 -m venv ${ROOT}/.home/.venv fi + source ${ROOT}/.home/.venv/bin/activate + if [ ! -f ${ROOT}/.home/.venv/bin/pre-commit ]; then - ${RUN} ${ROOT}/.home/.venv/bin/pip install -r requirements.txt + ${RUN} ${ROOT}/.home/.venv/bin/pip install -r requirements.txt fi # if [ ! -f $ROOT/ext/riscv-opcodes/README.md ]; then @@ -73,35 +101,45 @@ fi # fi if [[ ! -z "$DEVELOPMENT" && $DEVELOPMENT -eq 1 ]]; then - if [ ! -d "${ROOT}/.home/.yard/gem_index"]; then - ${RUN} bundle exec --gemfile ${ROOT}/Gemfile yard config --gem-install-yri - ${RUN} bundle exec --gemfile ${ROOT}/Gemfile yard gems - touch ${ROOT}/.stamps/dev_gems - fi + if [ ! -d "${ROOT}/.home/.yard/gem_index"]; then + ${RUN} bundle exec --gemfile ${ROOT}/Gemfile yard config --gem-install-yri + ${RUN} bundle exec --gemfile ${ROOT}/Gemfile yard gems + touch ${ROOT}/.stamps/dev_gems + fi fi if [ ! -d ${ROOT}/node_modules ]; then - ${RUN} npm i + ${RUN} npm i fi if [ -v DEVCONTAINER_ENV ]; then - BUNDLE="bundle" - RUBY="bundle exec ruby" - RAKE="bundle exec rake" - NPM="npm" - NPX="npx" - NODE="node" - PYTHON="python3" - PIP="${ROOT}/.home/.venv/bin/pip" - BASH="bash" + BUNDLE="bundle" + RUBY="bundle exec ruby" + RAKE="bundle exec rake" + NPM="npm" + NPX="npx" + NODE="node" + PYTHON="python3" + PIP="${ROOT}/.home/.venv/bin/pip" + BASH="bash" +elif [ -v DOCKER ]; then + BUNDLE="${DOCKER_BASE} bundle" + RUBY="${DOCKER_BASE} bundle exec ruby" + RAKE="${DOCKER_BASE} bundle exec rake" + NPM="${DOCKER_BASE} npm" + NPX="${DOCKER_BASE} npx" + NODE="${DOCKER_BASE} node" + PYTHON="${DOCKER_BASE} python3" + PIP="${DOCKER_BASE} pip" + BASH="${DOCKER_BASE} bash" else - BUNDLE="singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle" - RUBY="singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec ruby" - RAKE="singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec rake" - NPM="singularity run ${HOME_OPT} ${CONTAINER_PATH} npm" - NPX="singularity run ${HOME_OPT} ${CONTAINER_PATH} npx" - NODE="singularity run ${HOME_OPT} ${CONTAINER_PATH} node" - PYTHON="singularity run ${HOME_OPT} ${CONTAINER_PATH} python3" - PIP="singularity run ${HOME_OPT} ${CONTAINER_PATH} ${ROOT}/.home/.venv/bin/pip" - BASH="singularity run ${HOME_OPT} ${CONTAINER_PATH} bash" -fi + BUNDLE="singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle" + RUBY="singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec ruby" + RAKE="singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec rake" + NPM="singularity run ${HOME_OPT} ${CONTAINER_PATH} npm" + NPX="singularity run ${HOME_OPT} ${CONTAINER_PATH} npx" + NODE="singularity run ${HOME_OPT} ${CONTAINER_PATH} node" + PYTHON="singularity run ${HOME_OPT} ${CONTAINER_PATH} python3" + PIP="singularity run ${HOME_OPT} ${CONTAINER_PATH} ${ROOT}/.home/.venv/bin/pip" + BASH="singularity run ${HOME_OPT} ${CONTAINER_PATH} bash" +fi \ No newline at end of file From ba894a6600de055c616f31a7ab82f197c5623866 Mon Sep 17 00:00:00 2001 From: Derek Hower <134728312+dhower-qc@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:18:11 -0500 Subject: [PATCH 4/9] Add missing newline in Dockerfile Signed-off-by: Derek Hower <134728312+dhower-qc@users.noreply.github.com> --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6ee9e7fac..4a5d9f57a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -23,4 +23,4 @@ RUN apt-get clean autoclean RUN apt-get autoremove -y RUN rm -rf /var/lib/{apt,dpkg,cache,log}/* -WORKDIR /workspace \ No newline at end of file +WORKDIR /workspace From cfffd2f591d0b7e2e89d6afb9184477f2dcc65a5 Mon Sep 17 00:00:00 2001 From: Derek Hower <134728312+dhower-qc@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:44:29 -0500 Subject: [PATCH 5/9] Remove extra newline in bin/setup Signed-off-by: Derek Hower <134728312+dhower-qc@users.noreply.github.com> --- bin/setup | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/setup b/bin/setup index db43e786f..6ce4453e7 100755 --- a/bin/setup +++ b/bin/setup @@ -169,4 +169,3 @@ fi HOOK chmod +x $ROOT/.git/hooks/pre-commit fi - From fe55b83244db16e46b9b43313d1c88dc3c63a8c5 Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Tue, 17 Dec 2024 15:01:11 -0800 Subject: [PATCH 6/9] Add prompt to choose container --- .gitignore | 1 + bin/setup | 103 +++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 77 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index e82076dd8..ddd1aa6a7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ .stamps .venv .asciidoctor +.container-type diag-ditaa-* arch/manual/isa/**/riscv-isa-manual gen diff --git a/bin/setup b/bin/setup index 6ce4453e7..7b0e2f93b 100755 --- a/bin/setup +++ b/bin/setup @@ -6,8 +6,62 @@ cd $ROOT CONTAINER_TAG=`cat ${ROOT}/bin/.container-tag` +# Supported container types: +# +# = devcontainer +# +# When devcontainer is used, all commands run "natively" (no container prefix), because it's assumed +# that the command itself is already in the container context +# +# = docker +# +# A docker container. All commands on the host (using ./do or ./bin/*) are run in the context of a Docker image. +# +# = singularity +# +# An apptainer/singularity container. All commands on the host (using ./do or ./bin/*) are run in the context of an Apptainer/Singularity image. +# +# +# ALL THREE CONTAINERS ARE IDENTICAL. Which one you use is a preference of your setup and installed +# software. + + +# get the container type +# +# use, in priority order: +# 1. devcontainer, if DEVCONTAINER_ENV is set in the enviornment +# 2. the type stored in .container-type +# 3. Docker, if DOCKER is set in the enviornment +# 4. The choice made by the user, which will be cached in .container-type +if [ -v DEVCONTAINER_ENV ]; then +CONTAINER_TYPE=devcontainer +elif [ -f ${ROOT}/.container-type ]; then +CONTAINER_TYPE=`cat ${ROOT}/.container-type` +elif [ -v DOCKER ]; then +CONTAINER_TYPE=docker +else + echo -e "UDB tools run in a container. Both Docker and Singularity/Apptainer are supported.\\n\\n1. Docker\\n2. Singularity\\n" + while true; do + echo "Which would you like to use? (1/2) " + read ans + case $ans in + [1]* ) CONTAINER_TYPE=docker; break;; + [2]* ) CONTAINER_TYPE=singularity; break;; + * ) echo -e "\\nPlease answer 1 or 2.";; + esac + done +fi + +if [ "${CONTAINER_TYPE}" != "docker" -a "${CONTAINER_TYPE}" != "singularity" ]; then + echo "BAD CONTAINER TYPE: ${CONTAINER_TYPE}" +fi + +if [ ! -f ${ROOT}/.container-type ]; then + echo ${CONTAINER_TYPE} > ${ROOT}/.container-type +fi + print_env() { - if [ -v DOCKER ]; then + if [ "${CONTAINER_TYPE}" == "docker" ]; then echo "Using Docker environment" else echo "Using Singularity environment" @@ -20,13 +74,18 @@ if [ -v GITHUB_ACTIONS ]; then HOME_PATH=${GITHUB_WORKSPACE} HOME_OPT="--home ${ROOT}/.home" SINGULARITY_CACHE=--disable-cache -elif [ -v DOCKER ]; then +elif [ "${CONTAINER_TYPE}" == "docker" ]; then print_env - if ! docker images udb | grep -q udb ; then + if ! docker images riscvintl/udb:${CONTAINER_TAG} | grep -q udb ; then + # TODO: pull the image if it can be found echo "Building Docker image..." - docker build -t udb -f .devcontainer/Dockerfile . + docker build -t riscvintl/udb:${CONTAINER_TAG} -f .devcontainer/Dockerfile . + fi + if [ -t 1 -a -t 0 ]; then + DOCKER_BASE="docker run -it -v $(pwd):$(pwd) -w $(pwd) riscvintl/udb:${CONTAINER_TAG}" + else + DOCKER_BASE="docker run -v $(pwd):$(pwd) -w $(pwd) riscvintl/udb:${CONTAINER_TAG}" fi - DOCKER_BASE="docker run -it -v $(pwd):$(pwd) -w $(pwd) udb" RUN="${DOCKER_BASE}" else print_env @@ -34,6 +93,13 @@ else HOME_PATH=${HOME} HOME_OPT="--bind ${ROOT}/.home:${HOME_PATH}" SINGULARITY_CACHE= + if [ ! -f ${CONTAINER_PATH} ]; then + echo "Fetching container..." + if [ ! -d "${ROOT}/.singularity" ]; then + mkdir -p ${ROOT}/.singularity + fi + singularity pull ${SINGULARITY_CACHE} ${CONTAINER_PATH} oras://docker.io/riscvintl/spec-generator:$CONTAINER_TAG + fi fi if [ -f $ROOT/.git ]; then @@ -44,7 +110,7 @@ fi if [ -v DEVCONTAINER_ENV ]; then RUN="" -elif [ -v DOCKER ]; then +elif [ "${CONTAINER_TYPE}" == "docker" ]; then RUN="${DOCKER_BASE}" else RUN="singularity run ${HOME_OPT} ${CONTAINER_PATH}" @@ -54,23 +120,6 @@ if [ ! -d $ROOT/.home ]; then mkdir $ROOT/.home fi -if [ ! -v DEVCONTAINER_ENV ]; then - if [ -v DOCKER ]; then - if ! docker images udb | grep -q udb ; then - echo "Building Docker image..." - docker build -t udb -f .devcontainer/Dockerfile . - fi - else - if [ ! -f ${CONTAINER_PATH} ]; then - echo "Fetching container..." - if [ ! -d "${ROOT}/.singularity" ]; then - mkdir -p ${ROOT}/.singularity - fi - singularity pull ${SINGULARITY_CACHE} ${CONTAINER_PATH} oras://docker.io/riscvintl/spec-generator:$CONTAINER_TAG - fi - fi -fi - if [ ! -f $ROOT/.bundle/config ]; then OLDDIR=$PWD cd $ROOT @@ -122,15 +171,15 @@ if [ -v DEVCONTAINER_ENV ]; then PYTHON="${ROOT}/.home/.venv/bin/python3" PIP="${ROOT}/.home/.venv/bin/pip" BASH="bash" -elif [ -v DOCKER ]; then +elif [ "${CONTAINER_TYPE}" == "docker" ]; then BUNDLE="${DOCKER_BASE} bundle" RUBY="${DOCKER_BASE} bundle exec ruby" RAKE="${DOCKER_BASE} bundle exec rake" NPM="${DOCKER_BASE} npm" NPX="${DOCKER_BASE} npx" NODE="${DOCKER_BASE} node" - PYTHON="${DOCKER_BASE} python3" - PIP="${DOCKER_BASE} pip" + PYTHON="${DOCKER_BASE} ${ROOT}/.home/.venv/bin/python3" + PIP="${DOCKER_BASE} ${ROOT}/.home/.venv/bin/pip" BASH="${DOCKER_BASE} bash" else BUNDLE="singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle" @@ -163,7 +212,7 @@ if [ -x "\$INSTALL_PYTHON" ]; then elif command -v pre-commit > /dev/null; then exec pre-commit "\${ARGS[@]}" else - echo '`pre-commit` not found. Did you forget to activate your virtualenv?' 1>&2 + echo '\`pre-commit\` not found. Did you forget to activate your virtualenv?' 1>&2 exit 1 fi HOOK From 5a22dc66c76361ba1ddf0a0db028cdbc8ade7c2a Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Wed, 18 Dec 2024 05:32:00 -0800 Subject: [PATCH 7/9] Make sure Docker maps ROOT Signed-off-by: Derek Hower --- bin/setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/setup b/bin/setup index 7b0e2f93b..0ee86b825 100755 --- a/bin/setup +++ b/bin/setup @@ -82,9 +82,9 @@ elif [ "${CONTAINER_TYPE}" == "docker" ]; then docker build -t riscvintl/udb:${CONTAINER_TAG} -f .devcontainer/Dockerfile . fi if [ -t 1 -a -t 0 ]; then - DOCKER_BASE="docker run -it -v $(pwd):$(pwd) -w $(pwd) riscvintl/udb:${CONTAINER_TAG}" + DOCKER_BASE="docker run -it -v $(ROOT):$(ROOT) -w $(ROOT) riscvintl/udb:${CONTAINER_TAG}" else - DOCKER_BASE="docker run -v $(pwd):$(pwd) -w $(pwd) riscvintl/udb:${CONTAINER_TAG}" + DOCKER_BASE="docker run -v $(ROOT):$(ROOT) -w $(ROOT) riscvintl/udb:${CONTAINER_TAG}" fi RUN="${DOCKER_BASE}" else From cce52ad58e0ff422443218fcc901a7d923bb6ac4 Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Wed, 18 Dec 2024 06:02:53 -0800 Subject: [PATCH 8/9] Add SINGULARITY env and make regression use it Signed-off-by: Derek Hower --- .github/workflows/regress.yml | 8 ++++++++ bin/setup | 5 ++++- ext/docs-resources | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regress.yml b/.github/workflows/regress.yml index da6f5b15e..5d7b86a93 100644 --- a/.github/workflows/regress.yml +++ b/.github/workflows/regress.yml @@ -13,6 +13,8 @@ jobs: - uses: pre-commit/action@v3.0.1 regress-smoke: runs-on: ubuntu-latest + env: + SINGULARITY: 1 steps: - name: Clone Github Repo Action uses: actions/checkout@v4 @@ -45,6 +47,7 @@ jobs: env: MANUAL_NAME: isa VERSIONS: all + SINGULARITY: 1 steps: - name: Clone Github Repo Action uses: actions/checkout@v4 @@ -75,6 +78,7 @@ jobs: env: EXT: B VERSION: latest + SINGULARITY: 1 steps: - name: Clone Github Repo Action uses: actions/checkout@v4 @@ -102,6 +106,8 @@ jobs: regress-gen-certificate: runs-on: ubuntu-latest needs: regress-smoke + env: + SINGULARITY: 1 steps: - name: Clone Github Repo Action uses: actions/checkout@v4 @@ -129,6 +135,8 @@ jobs: regress-gen-profile: runs-on: ubuntu-latest needs: regress-smoke + env: + SINGULARITY: 1 steps: - name: Clone Github Repo Action uses: actions/checkout@v4 diff --git a/bin/setup b/bin/setup index 0ee86b825..934c8033a 100755 --- a/bin/setup +++ b/bin/setup @@ -32,13 +32,16 @@ CONTAINER_TAG=`cat ${ROOT}/bin/.container-tag` # 1. devcontainer, if DEVCONTAINER_ENV is set in the enviornment # 2. the type stored in .container-type # 3. Docker, if DOCKER is set in the enviornment -# 4. The choice made by the user, which will be cached in .container-type +# 4. Singularity, if SINGULARITY is set in the enviornment +# 5. The choice made by the user, which will be cached in .container-type if [ -v DEVCONTAINER_ENV ]; then CONTAINER_TYPE=devcontainer elif [ -f ${ROOT}/.container-type ]; then CONTAINER_TYPE=`cat ${ROOT}/.container-type` elif [ -v DOCKER ]; then CONTAINER_TYPE=docker +elif [ -v SINGULARITY ]; then +CONTAINER_TYPE=singularity else echo -e "UDB tools run in a container. Both Docker and Singularity/Apptainer are supported.\\n\\n1. Docker\\n2. Singularity\\n" while true; do diff --git a/ext/docs-resources b/ext/docs-resources index 35203a4f1..a76dd1d39 160000 --- a/ext/docs-resources +++ b/ext/docs-resources @@ -1 +1 @@ -Subproject commit 35203a4f123d0be162b6b5ea213a657b594f8c36 +Subproject commit a76dd1d390cba28e3b1ce86313af03ce9b69399d From 4b5a4c5a353d3f600081b147181dc53af6cd8c20 Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Wed, 18 Dec 2024 06:11:31 -0800 Subject: [PATCH 9/9] Add SINGULARITY env var to nightly --- .github/workflows/nightly.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 73c2dfd92..c79c6e138 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -26,6 +26,8 @@ jobs: needs: check_date if: ${{ needs.check_date.outputs.should_run != 'false' }} runs-on: ubuntu-latest + env: + SINGULARITY: 1 steps: - name: Clone Github Repo Action uses: actions/checkout@v4