From 9e48c681371ae7a2d05b1fa956a8bee5594f2abc Mon Sep 17 00:00:00 2001 From: Maria Semple Date: Mon, 14 Aug 2023 16:48:16 -0700 Subject: [PATCH 1/4] add a script that removes unused workbench components --- shared/remove-workbench-extras.sh | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 shared/remove-workbench-extras.sh diff --git a/shared/remove-workbench-extras.sh b/shared/remove-workbench-extras.sh new file mode 100755 index 00000000..4795e6bb --- /dev/null +++ b/shared/remove-workbench-extras.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +rm -rf /var/lib/rstudio-server/r-versions +rm /usr/lib/rstudio-server/bin/rserver-saml +rm /usr/lib/rstudio-server/bin/rserver-openid +rm /usr/lib/rstudio-server/bin/librclient.so +rm /usr/lib/rstudio-server/bin/librserver.so +rm /usr/lib/rstudio-server/bin/license-manager +rm /usr/lib/rstudio-server/bin/license-manager.conf +rm /usr/lib/rstudio-server/bin/locktester +rm /usr/lib/rstudio-server/bin/migrate.sh +rm /usr/lib/rstudio-server/bin/pamtester +rm /usr/lib/rstudio-server/bin/rpcsend +rm /usr/lib/rstudio-server/bin/rserver +rm /usr/lib/rstudio-server/bin/rserver-acls +rm /usr/lib/rstudio-server/bin/rserver-admin +rm /usr/lib/rstudio-server/bin/rserver-db +rm /usr/lib/rstudio-server/bin/rserver-encrypt +rm /usr/lib/rstudio-server/bin/rserver-http +rm /usr/lib/rstudio-server/bin/rserver-monitor +rm /usr/lib/rstudio-server/bin/rserver-pam +rm /usr/lib/rstudio-server/bin/rserver-session-reaper +rm /usr/lib/rstudio-server/bin/rstudio-kubernetes-launcher +rm /usr/lib/rstudio-server/bin/rstudio-launcher +rm /usr/lib/rstudio-server/bin/rstudio-launcher.sh +rm /usr/lib/rstudio-server/bin/rstudio-local-launcher +rm /usr/lib/rstudio-server/bin/rstudio-server +rm /usr/lib/rstudio-server/bin/rstudio-slurm-launcher +rm /usr/lib/rstudio-server/bin/run-diagnostics +rm -rf /usr/lib/rstudio-server/www-admin +rm -rf /usr/lib/rstudio-server/www-launcher +rm -rf /usr/lib/rstudio-server/www-workspaces +rm -rf /usr/lib/rstudio-server/db +rm -rf /usr/lib/rstudio-server/conf +rm -rf /usr/lib/rstudio-server/extras \ No newline at end of file From 3860c046b3d4395deafe063a93120a55fa4a9c78 Mon Sep 17 00:00:00 2001 From: Maria Semple Date: Tue, 15 Aug 2023 12:36:48 -0700 Subject: [PATCH 2/4] remove unused files from r-session-complete --- r-session-complete/Dockerfile.centos7 | 6 ++++-- r-session-complete/Dockerfile.ubuntu2204 | 4 +++- r-session-complete/Justfile | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/r-session-complete/Dockerfile.centos7 b/r-session-complete/Dockerfile.centos7 index 45c544d4..9b3538c5 100644 --- a/r-session-complete/Dockerfile.centos7 +++ b/r-session-complete/Dockerfile.centos7 @@ -5,7 +5,7 @@ ARG PYTHON_VERSION_ALT=3.8.15 ARG SRC_IMAGE_NAME=product-base-pro ARG REGISTRY=ghcr.io FROM ${REGISTRY}/rstudio/${SRC_IMAGE_NAME}:centos7-r${R_VERSION}_${R_VERSION_ALT}-py${PYTHON_VERSION}_${PYTHON_VERSION_ALT} -LABEL maintainer="RStudio Docker "` +LABEL maintainer="RStudio Docker " ARG R_VERSION=4.2.3 ARG R_VERSION_ALT=4.1.3 @@ -15,6 +15,8 @@ ARG RSW_VERSION=2023.06.1+524.pro1 ARG RSW_NAME=rstudio-workbench-rhel ARG RSW_DOWNLOAD_URL=https://s3.amazonaws.com/rstudio-ide-build/server/centos7/x86_64 +COPY ./remove-workbench-extras.sh /tmp/remove-workbench-extras.sh + SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN yum install -y subversion \ && RSW_VERSION_URL=$(echo -n "${RSW_VERSION}" | sed 's/+/-/g') \ @@ -31,7 +33,7 @@ RUN yum install -y subversion \ && yum install -y rstudio-workbench.rpm \ && rm rstudio-workbench.rpm \ && yum clean all \ - && rm -rf /var/lib/rstudio-server/r-versions + && /tmp/remove-workbench-extras.sh RUN /opt/python/"${PYTHON_VERSION}"/bin/pip3 install \ jupyter \ diff --git a/r-session-complete/Dockerfile.ubuntu2204 b/r-session-complete/Dockerfile.ubuntu2204 index d6e09fdc..787edc65 100644 --- a/r-session-complete/Dockerfile.ubuntu2204 +++ b/r-session-complete/Dockerfile.ubuntu2204 @@ -18,6 +18,8 @@ ARG RSW_DOWNLOAD_URL=https://download2.rstudio.org/server/jammy/amd64 ENV WORKBENCH_JUPYTER_PATH=/usr/local/bin/jupyter +COPY ./remove-workbench-extras.sh /tmp/remove-workbench-extras.sh + SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN apt-get update \ && apt-get install --no-install-recommends -y \ @@ -40,7 +42,7 @@ RUN apt-get update \ && apt-get autoremove -y \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ - && rm -rf /var/lib/rstudio-server/r-versions + && /tmp/remove-workbench-extras.sh RUN /opt/python/"${PYTHON_VERSION}"/bin/pip install \ jupyter \ diff --git a/r-session-complete/Justfile b/r-session-complete/Justfile index 2a7bc6db..d5594863 100755 --- a/r-session-complete/Justfile +++ b/r-session-complete/Justfile @@ -47,6 +47,8 @@ build OS=IMAGE_OS VERSION=RSW_VERSION *TAGS="": tag_array+=("-t" $tag) done + cp ../shared/remove-workbench-extras.sh ./ + docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \ ${tag_array[@]} \ --build-arg RSW_VERSION="{{ VERSION }}" \ @@ -57,6 +59,8 @@ build OS=IMAGE_OS VERSION=RSW_VERSION *TAGS="": --build-arg PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \ --file=./Dockerfile.$(just -f ../Justfile _parse-os {{OS}}) . + rm remove-workbench-extras.sh + # Test r-session-complete image - just test rstudio/r-session-complete:ubuntu1804-2022.07.2-576.pro12 2022.07.2+576.pro12 test TAG=`just _make-default-tag` VERSION=RSW_VERSION CMD="": #!/usr/bin/env bash From 160abd392cbefc5e02f63f219ce9b91428dca267 Mon Sep 17 00:00:00 2001 From: Maria Semple Date: Tue, 15 Aug 2023 12:54:21 -0700 Subject: [PATCH 3/4] add a -f --- shared/remove-workbench-extras.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/remove-workbench-extras.sh b/shared/remove-workbench-extras.sh index 4795e6bb..b3d804a9 100755 --- a/shared/remove-workbench-extras.sh +++ b/shared/remove-workbench-extras.sh @@ -1,6 +1,6 @@ #!/bin/bash -rm -rf /var/lib/rstudio-server/r-versions +rm -f /var/lib/rstudio-server/r-versions rm /usr/lib/rstudio-server/bin/rserver-saml rm /usr/lib/rstudio-server/bin/rserver-openid rm /usr/lib/rstudio-server/bin/librclient.so From 52108c13aff3fd75f61f916747d9111dcc4307ac Mon Sep 17 00:00:00 2001 From: Maria Semple Date: Tue, 15 Aug 2023 12:55:02 -0700 Subject: [PATCH 4/4] add rstudio-pro only images --- .../Dockerfile.centos7 | 42 +++++++++ .../Dockerfile.ubuntu2204 | 49 ++++++++++ workbench-session-rstudio-pro/Justfile | 91 +++++++++++++++++++ workbench-session-rstudio-pro/NEWS.md | 3 + workbench-session-rstudio-pro/README.md | 78 ++++++++++++++++ .../docker-compose.test.yml | 16 ++++ .../remove-other-sessions.sh | 6 ++ workbench-session-rstudio-pro/test/goss.yaml | 38 ++++++++ .../test/run_tests.sh | 19 ++++ 9 files changed, 342 insertions(+) create mode 100644 workbench-session-rstudio-pro/Dockerfile.centos7 create mode 100644 workbench-session-rstudio-pro/Dockerfile.ubuntu2204 create mode 100755 workbench-session-rstudio-pro/Justfile create mode 100644 workbench-session-rstudio-pro/NEWS.md create mode 100644 workbench-session-rstudio-pro/README.md create mode 100644 workbench-session-rstudio-pro/docker-compose.test.yml create mode 100755 workbench-session-rstudio-pro/remove-other-sessions.sh create mode 100644 workbench-session-rstudio-pro/test/goss.yaml create mode 100755 workbench-session-rstudio-pro/test/run_tests.sh diff --git a/workbench-session-rstudio-pro/Dockerfile.centos7 b/workbench-session-rstudio-pro/Dockerfile.centos7 new file mode 100644 index 00000000..3bd3385a --- /dev/null +++ b/workbench-session-rstudio-pro/Dockerfile.centos7 @@ -0,0 +1,42 @@ +ARG R_VERSION=4.2.3 +ARG R_VERSION_ALT=4.1.3 +ARG PYTHON_VERSION=3.9.14 +ARG PYTHON_VERSION_ALT=3.8.15 +ARG SRC_IMAGE_NAME=product-base-pro +ARG REGISTRY=ghcr.io +FROM ${REGISTRY}/rstudio/${SRC_IMAGE_NAME}:centos7-r${R_VERSION}_${R_VERSION_ALT}-py${PYTHON_VERSION}_${PYTHON_VERSION_ALT} +LABEL maintainer="RStudio Docker " + +ARG R_VERSION=4.2.3 +ARG R_VERSION_ALT=4.1.3 +ARG PYTHON_VERSION=3.9.14 +ARG PYTHON_VERSION_ALT=3.8.15 +ARG RSW_VERSION=2023.03.2+454.pro2 +ARG RSW_NAME=rstudio-workbench-rhel +ARG RSW_DOWNLOAD_URL=https://s3.amazonaws.com/rstudio-ide-build/server/centos7/x86_64 + +COPY ./remove-workbench-extras.sh /tmp/remove-workbench-extras.sh +COPY ./remove-other-sessions.sh /tmp/remove-other-sessions.sh + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN yum install -y subversion \ + && RSW_VERSION_URL=$(echo -n "${RSW_VERSION}" | sed 's/+/-/g') \ + && curl -o rstudio-workbench.rpm "${RSW_DOWNLOAD_URL}/${RSW_NAME}-${RSW_VERSION_URL}-x86_64.rpm" \ + # Pre 7/25/23 packages + && gpg --keyserver keyserver.ubuntu.com --recv-keys 3F32EE77E331692F \ + && gpg --export --armor 3F32EE77E331692F > rstudio-signing.key \ + && rpm --import rstudio-signing.key \ + # Post 7/25 packages + && gpg --keyserver hkps://keys.openpgp.org --recv-keys 51C0B5BB19F92D60 \ + && gpg --export --armor 51C0B5BB19F92D60 > rstudio-signing.key \ + && rpm --import rstudio-signing.key \ + && rpm -K rstudio-workbench.rpm \ + && yum install -y rstudio-workbench.rpm \ + && rm rstudio-workbench.rpm \ + && yum clean all \ + && /tmp/remove-workbench-extras.sh \ + && /tmp/remove-other-sessions.sh + +ENV PATH="/opt/python/${PYTHON_VERSION}/bin:${PATH}" + +EXPOSE 8788/tcp diff --git a/workbench-session-rstudio-pro/Dockerfile.ubuntu2204 b/workbench-session-rstudio-pro/Dockerfile.ubuntu2204 new file mode 100644 index 00000000..2c2d8943 --- /dev/null +++ b/workbench-session-rstudio-pro/Dockerfile.ubuntu2204 @@ -0,0 +1,49 @@ +ARG R_VERSION=4.2.3 +ARG R_VERSION_ALT=4.1.3 +ARG PYTHON_VERSION=3.9.17 +ARG PYTHON_VERSION_ALT=3.8.17 +ARG SRC_IMAGE_NAME=product-base-pro +ARG REGISTRY=ghcr.io +FROM ${REGISTRY}/rstudio/${SRC_IMAGE_NAME}:ubuntu2204-r${R_VERSION}_${R_VERSION_ALT}-py${PYTHON_VERSION}_${PYTHON_VERSION_ALT} +LABEL maintainer="RStudio Docker " + +ARG DEBIAN_FRONTEND=noninteractive +ARG R_VERSION=4.2.3 +ARG R_VERSION_ALT=4.1.3 +ARG PYTHON_VERSION=3.9.17 +ARG PYTHON_VERSION_ALT=3.8.17 +ARG RSW_VERSION=2023.06.2+454.pro2 +ARG RSW_NAME=rstudio-workbench +ARG RSW_DOWNLOAD_URL=https://download2.rstudio.org/server/jammy/amd64 + +COPY ./remove-workbench-extras.sh /tmp/remove-workbench-extras.sh +COPY ./remove-other-sessions.sh /tmp/remove-other-sessions.sh + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +RUN apt-get update \ + && apt-get install --no-install-recommends -y \ + krb5-user \ + libcurl4-gnutls-dev \ + libuser \ + libuser1-dev \ + libpq-dev \ + rrdtool \ + subversion \ + && RSW_VERSION_URL=$(echo -n "${RSW_VERSION}" | sed 's/+/-/g') \ + && curl -o rstudio-workbench.deb "${RSW_DOWNLOAD_URL}/${RSW_NAME}-${RSW_VERSION_URL}-amd64.deb" \ + # Pre 7/25/23 packages + && gpg --keyserver keyserver.ubuntu.com --recv-keys 3F32EE77E331692F \ + # Post 7/25 packages + && gpg --keyserver keys.openpgp.org --recv-keys 51C0B5BB19F92D60 \ + && dpkg-sig --verify ./rstudio-workbench.deb \ + && apt-get install -yq --no-install-recommends ./rstudio-workbench.deb \ + && rm ./rstudio-workbench.deb \ + && apt-get autoremove -y \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && /tmp/remove-workbench-extras.sh \ + && /tmp/remove-other-sessions.sh + +ENV PATH="/opt/python/${PYTHON_VERSION}/bin:${PATH}" + +EXPOSE 8788/tcp diff --git a/workbench-session-rstudio-pro/Justfile b/workbench-session-rstudio-pro/Justfile new file mode 100755 index 00000000..fce67ea5 --- /dev/null +++ b/workbench-session-rstudio-pro/Justfile @@ -0,0 +1,91 @@ +set positional-arguments + +BUILDX_PATH := "" + +IMAGE_PREFIX := "" +PRODUCT := "workbench-session-rstudio-pro" +IMAGE_OS := "ubuntu2204" + +RSW_VERSION := "2023.03.2+454.pro2" +RSW_LICENSE := "" + +DRIVERS_VERSION := "2023.05.0" +DRIVERS_VERSION_RHEL := DRIVERS_VERSION + "-1" + +R_VERSION := "4.2.3" +R_VERSION_ALT := "4.1.3" + +PYTHON_VERSION := "3.9.14" +PYTHON_VERSION_ALT := "3.8.15" + +_make-default-tag OS=IMAGE_OS: + echo "{{IMAGE_PREFIX}}{{PRODUCT}}:{{OS}}-$(just -f ../Justfile _get-tag-safe-version {{RSW_VERSION}})" + +# Build r-session-complete image - just build ubuntu1804 2022.07.2+576.pro12 rstudio/r-session-complete:ubuntu1804-2022.07.2-576.pro12 +build OS=IMAGE_OS VERSION=RSW_VERSION *TAGS="": + #!/usr/bin/env bash + set -euxo pipefail + BUILDX_ARGS="" + if [[ "{{BUILDX_PATH}}" != "" ]]; then + BUILDX_ARGS="--cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache" + fi + if [[ "{{ OS }}" == "centos7" ]]; then + _DRIVERS_VERSION="{{ DRIVERS_VERSION_RHEL }}" + else + _DRIVERS_VERSION="{{ DRIVERS_VERSION }}" + fi + + if [[ "{{TAGS}}" == "" ]]; then + raw_tag_array=($(just _make-default-tag {{OS}})) + else + raw_tag_array=("{{TAGS}}") + fi + + tag_array=() + for tag in $raw_tag_array + do + tag_array+=("-t" $tag) + done + + cp ../shared/remove-workbench-extras.sh ./ + + docker buildx --builder="{{ BUILDX_PATH }}" build --load ${BUILDX_ARGS} \ + ${tag_array[@]} \ + --build-arg RSW_VERSION="{{ VERSION }}" \ + --build-arg DRIVERS_VERSION="${_DRIVERS_VERSION}" \ + --build-arg R_VERSION="{{ R_VERSION }}" \ + --build-arg R_VERSION_ALT="{{ R_VERSION_ALT }}" \ + --build-arg PYTHON_VERSION="{{ PYTHON_VERSION }}" \ + --build-arg PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \ + --file=./Dockerfile.$(just -f ../Justfile _parse-os {{OS}}) . + + rm remove-workbench-extras.sh + +# Test r-session-complete image - just test rstudio/r-session-complete:ubuntu1804-2022.07.2-576.pro12 2022.07.2+576.pro12 +test TAG=`just _make-default-tag` VERSION=RSW_VERSION CMD="": + #!/usr/bin/env bash + set -euxo pipefail + IMAGE_NAME="{{ TAG }}" \ + RSW_VERSION="{{ VERSION }}" \ + R_VERSION="{{ R_VERSION }}" \ + R_VERSION_ALT="{{ R_VERSION_ALT }}" \ + PYTHON_VERSION="{{ PYTHON_VERSION }}" \ + PYTHON_VERSION_ALT="{{ PYTHON_VERSION_ALT }}" \ + docker-compose -f ./docker-compose.test.yml run sut {{ CMD }} + +# Test r-session-complete image interactively - just test-i rstudio/r-session-complete:ubuntu1804-2022.07.2-576.pro12 2022.07.2+576.pro12 +test-i TAG=`just _make-default-tag` VERSION=RSW_VERSION: + just test {{ TAG }} {{ VERSION }} bash + +# Run r-session-complete - just run rstudio/r-session-complete:ubuntu1804-2022.07.2-576.pro12 +run TAG=`just _make-default-tag` CMD="": + #!/usr/bin/env bash + set -euxo pipefail + if [ -z "{{ RSW_LICENSE }}" ]; then + echo "Please set RSW_LICENSE to a valid RStudio Workbench license before running." + exit 1 + fi + docker run -it --privileged \ + -p 8788:8788 \ + -e RSW_LICENSE="{{ RSW_LICENSE }}" \ + "{{ TAG }}" {{ CMD }} diff --git a/workbench-session-rstudio-pro/NEWS.md b/workbench-session-rstudio-pro/NEWS.md new file mode 100644 index 00000000..a4197367 --- /dev/null +++ b/workbench-session-rstudio-pro/NEWS.md @@ -0,0 +1,3 @@ +# 2023.03.2 +- Initial release + diff --git a/workbench-session-rstudio-pro/README.md b/workbench-session-rstudio-pro/README.md new file mode 100644 index 00000000..17c6dc05 --- /dev/null +++ b/workbench-session-rstudio-pro/README.md @@ -0,0 +1,78 @@ +# Quick reference + +* Maintained by: [the Posit Docker team](https://github.com/rstudio/rstudio-docker-products) +* Where to get help: [our Github Issues page](https://github.com/rstudio/rstudio-docker-products/issues) +* RStudio Workbench image: [Docker Hub](https://hub.docker.com/r/rstudio/rstudio-workbench) +* RStudio r-session-complete image: [Docker Hub](https://hub.docker.com/r/rstudio/r-session-complete) + +# Supported tags and respective Dockerfile links + +* [`jammy`, `ubuntu2204`, `jammy-2023.06.1`, `ubuntu2204-2023.06.1`](https://github.com/rstudio/rstudio-docker-products/blob/main/r-session-complete/Dockerfile.ubuntu2204) + +# What are the workbench-session-rstudio-pro images? + +Images for R and Python sessions and jobs to be used RStudio Workbench, Launcher, and Kubernetes. + +# Notice for support + +1. This image may introduce **BREAKING** changes; as such we recommend: + - Avoid using the `{operating-system}` tags to avoid unexpected version changes, and + - Always read through the [NEWS](./NEWS.md) to understand the changes before updating. +1. Outdated images will be removed periodically from DockerHub as product version updates are made. Please make plans to + update at times or use your own build of the images. +1. These images are meant as a starting point for your needs. Consider creating a fork of this repo, where you can + continue to merge in changes we make while having your own security scanning, base OS in use, or other custom + changes. We + provide [instructions for how to build and use](#how-to-use-these-docker-images) + for these cases. +1. **Security Note:** These images are provided AS IS based on the build environment at the time their product version was released/updated. They should be reviewed and updated before production use. If your organization has a specific set of security requirements related to CVE/Vulnerability severity levels, you should plan to use the [instructions for building](https://github.com/rstudio/rstudio-docker-products#instructions-for-building) to clone this repository, and rebuild these images to your specific internal security standards. + +# How to use these images + +The Docker images built from these Dockerfiles are intended to be used for R and +Jupyter sessions and jobs with RStudio Workbench (RSW), Launcher, and +Kubernetes. + +Note: These Docker images are not equipped or intended to be used to run RStudio +Workbench within a Docker container. Visit the +[rstudio/rstudio-worbench Docker Hub page](https://hub.docker.com/r/rstudio/rstudio-workbench) +for images built for that purpose. + +For more information about RStudio Workbench and Launcher, refer to the +[Launcher Overview](https://solutions.rstudio.com/launcher/overview/) on the +RStudio Solutions website. + +For more information about how to use these images with RStudio Workbench and +Launcher, refer to the RStudio support article on [Using Docker images with +RStudio Workbench, Launcher, and +Kubernetes](https://support.rstudio.com/hc/en-us/articles/360019253393-Using-Docker-images-with-RStudio-Server-Pro-Launcher-and-Kubernetes). + +We provide simple ways to extend and build the Dockerfiles. After you have cloned the repo, you can create your own +containers fairly simply with the provided Justfile. + +## Overview + +Built images are available from the +[rstudio/r-session-complete](https://hub.docker.com/r/rstudio/r-session-complete) +repository on Docker Hub. + +These images include the following layers: + +* Base OS +* RSW session components +* System packages required for R, R packages, and RStudio Professional Drivers +* One version of R +* One version of Python +* Jupyter Notebooks, JupyterLab, and RSW/RSC notebook extensions +* RStudio Professional Drivers + +# Licensing + +The license associated with the RStudio Docker Products repository is located [in LICENSE.md](https://github.com/rstudio/rstudio-docker-products/blob/main/LICENSE.md). + +As is the case with all container images, the images themselves also contain other software which may be under other +licenses (i.e. bash, linux, system libraries, etc., along with any other direct or indirect dependencies of the primary +software being contained). + +It is an image user's responsibility to ensure that use of this image (and any of its dependent layers) complies with +all relevant licenses for the software contained in the image. diff --git a/workbench-session-rstudio-pro/docker-compose.test.yml b/workbench-session-rstudio-pro/docker-compose.test.yml new file mode 100644 index 00000000..80d19f5d --- /dev/null +++ b/workbench-session-rstudio-pro/docker-compose.test.yml @@ -0,0 +1,16 @@ +version: '2.3' +services: + + sut: + image: $IMAGE_NAME + command: /run_tests.sh + entrypoint: [] + environment: + # uses .env by default + - RSW_VERSION + - R_VERSION + - PYTHON_VERSION + volumes: + - "./test/run_tests.sh:/run_tests.sh" + - "./test/goss.yaml:/tmp/goss.yaml" + - "./test/goss_vars.yaml:/tmp/goss_vars.yaml" diff --git a/workbench-session-rstudio-pro/remove-other-sessions.sh b/workbench-session-rstudio-pro/remove-other-sessions.sh new file mode 100755 index 00000000..7d1324aa --- /dev/null +++ b/workbench-session-rstudio-pro/remove-other-sessions.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +rm -rf /usr/lib/rstudio-server/bin/code-server +rm -rf /usr/lib/rstudio-server/bin/vscode-workbench-ext +rm /usr/lib/rstudio-server/bin/jupyter-session-run +rm /usr/lib/rstudio-server/bin/vscode-session-run \ No newline at end of file diff --git a/workbench-session-rstudio-pro/test/goss.yaml b/workbench-session-rstudio-pro/test/goss.yaml new file mode 100644 index 00000000..d9bf50ee --- /dev/null +++ b/workbench-session-rstudio-pro/test/goss.yaml @@ -0,0 +1,38 @@ +file: + /usr/lib/rstudio-server: + exists: true + /usr/lib/rstudio-server/bin/rsession: + exists: true + /usr/local/bin/jupyter: + exists: false + /usr/lib/rstudio-server/bin/code-server: + exists: false + /opt/rstudio-drivers: + exists: true + filetype: directory + /var/lib/rstudio-server/r-versions: + exists: false + +command: +# Ensure correct R version + "/opt/R/{{.Env.R_VERSION}}/bin/R --version": + title: r_version_match + exit-status: 0 + stdout: [ + "{{.Env.R_VERSION}}" + ] + +# Ensure correct python version + "/opt/python/{{.Env.PYTHON_VERSION}}/bin/python3 --version": + title: python_version_matches + exit-status: 0 + stdout: [ + "{{ .Env.PYTHON_VERSION }}" + ] + + "python3 --version": + title: python_in_path_var + exit-status: 0 + stdout: [ + "{{ .Env.PYTHON_VERSION }}" + ] diff --git a/workbench-session-rstudio-pro/test/run_tests.sh b/workbench-session-rstudio-pro/test/run_tests.sh new file mode 100755 index 00000000..0aefb5d8 --- /dev/null +++ b/workbench-session-rstudio-pro/test/run_tests.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# install goss + +GOSS_FILE=${GOSS_FILE:-/tmp/goss.yaml} +GOSS_VERSION=${GOSS_VERSION:-0.3.8} +GOSS_MAX_CONCURRENT=${GOSS_MAX_CONCURRENT:-50} + +# default to empty var file (since vars are not necessary) +if [ ! -f "$GOSS_VARS" ]; then + touch $GOSS_VARS +fi + +# install goss to tmp location and make executable +curl -sL https://github.com/aelsabbahy/goss/releases/download/v$GOSS_VERSION/goss-linux-amd64 -o /tmp/goss \ + && chmod +x /tmp/goss \ + && GOSS=/tmp/goss + +GOSS_FILE=$GOSS_FILE GOSS_VARS=$GOSS_VARS $GOSS v --format documentation --max-concurrent $GOSS_MAX_CONCURRENT