From 878d849fb7dd2f83db05380035c7bcb431c1b8a3 Mon Sep 17 00:00:00 2001 From: Cole Arendt Date: Mon, 14 Jun 2021 15:19:44 -0400 Subject: [PATCH 1/5] add debug image for bionic --- r-session-debug/bionic/Dockerfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 r-session-debug/bionic/Dockerfile diff --git a/r-session-debug/bionic/Dockerfile b/r-session-debug/bionic/Dockerfile new file mode 100644 index 00000000..67facb35 --- /dev/null +++ b/r-session-debug/bionic/Dockerfile @@ -0,0 +1,15 @@ +ARG RSP_VERSION +FROM ghcr.io/rstudio/r-session-complete:bionic-${RSP_VERSION} + +RUN apt-get update -qq \ + && apt-get install -y \ + dnsutils \ + tcpdump \ + netcat \ + net-tools \ + psutils \ + vim \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# TODO: update the entrypoint... From 6da4eb76f53581d374500d10ea5258c4b5c26c90 Mon Sep 17 00:00:00 2001 From: Cole Arendt Date: Mon, 14 Jun 2021 15:19:56 -0400 Subject: [PATCH 2/5] add debug action --- .github/workflows/build-debug.yaml | 157 +++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 .github/workflows/build-debug.yaml diff --git a/.github/workflows/build-debug.yaml b/.github/workflows/build-debug.yaml new file mode 100644 index 00000000..596b2f65 --- /dev/null +++ b/.github/workflows/build-debug.yaml @@ -0,0 +1,157 @@ +on: + workflow_run: + workflows: + - "Build and Test (latest)" + types: + - completed + +name: Build and Test (debug) +jobs: + + build: + runs-on: ubuntu-latest + name: build-${{ matrix.config.tag_prefix}}${{ matrix.config.product}} + + # beware - several copies of matrix below + strategy: + fail-fast: false + matrix: + config: + - {product: 'r-session-debug', tag_prefix: 'bionic-', dir: 'r-session-debug/bionic', prefix: RSP, version: 1.4.1717-3} + - {product: 'r-session-debug', tag_prefix: 'centos7-', dir: 'r-session-debug/centos7', prefix: RSP, version: 1.4.1717-3} + + steps: + - name: Check Out Repo + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build + id: docker_build + uses: docker/build-push-action@v2 + with: + context: ./${{ matrix.config.dir }} + file: ./${{ matrix.config.dir }}/Dockerfile + builder: ${{ steps.buildx.outputs.name }} + tags: | + rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}latest + rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ matrix.config.version }} + ghcr.io/rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}latest + ghcr.io/rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ matrix.config.version }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + outputs: type=docker,dest=/tmp/${{ matrix.config.tag_prefix }}${{ matrix.config.product }}-image.tar + push: false + build-args: | + RSP_VERSION=${{ matrix.config.version }} + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.config.tag_prefix }}${{ matrix.config.product }}-image + path: /tmp/${{ matrix.config.tag_prefix }}${{ matrix.config.product }}-image.tar + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} + + test: + runs-on: ubuntu-latest + name: test-${{ matrix.config.tag_prefix }}${{ matrix.config.product}} + needs: build + + strategy: + fail-fast: false + matrix: + config: + - {product: 'r-session-debug', tag_prefix: 'bionic-', dir: 'r-session-debug/bionic', prefix: RSP, version: 1.4.1717-3} + - {product: 'r-session-debug', tag_prefix: 'centos7-', dir: 'r-session-debug/centos7', prefix: RSP, version: 1.4.1717-3} + + steps: + - name: Check Out Repo + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: ${{ matrix.config.tag_prefix }}${{ matrix.config.product}}-image + path: /tmp + + - name: Load image + run: | + docker load --input /tmp/${{ matrix.config.tag_prefix }}${{ matrix.config.product }}-image.tar + docker image ls -a + + - name: Test image + env: + IMAGE_NAME: rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ matrix.config.version }} + # because we cannot dynamically set env var names... set them all... + RSP_VERSION: ${{ matrix.config.version }} + RSC_VERSION: ${{ matrix.config.version }} + RSPM_VERSION: ${{ matrix.config.version }} + run: | + docker-compose -f ./${{ matrix.config.dir }}/docker-compose.test.yml run sut + + push: + runs-on: ubuntu-latest + needs: test + if: ${{ github.ref == 'refs/heads/main' }} + name: push-${{ matrix.config.tag_prefix }}${{ matrix.config.product}} + environment: build-and-push + + strategy: + fail-fast: false + matrix: + config: + - {product: 'r-session-debug', tag_prefix: 'bionic-', dir: 'r-session-debug/bionic', prefix: RSP, version: 1.4.1717-3} + - {product: 'r-session-debug', tag_prefix: 'centos7-', dir: 'r-session-debug/centos7', prefix: RSP, version: 1.4.1717-3} + + steps: + - name: Check Out Repo + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: ${{ matrix.config.tag_prefix }}${{ matrix.config.product}}-image + path: /tmp + + - name: Load image + run: | + docker load --input /tmp/${{ matrix.config.tag_prefix }}${{ matrix.config.product }}-image.tar + docker image ls -a + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Login to ghcr.io + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.BUILD_PAT }} + + - name: Push image(s) to Docker Hub + run: | + docker push rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ matrix.config.version }} + docker push rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}latest + docker push ghcr.io/rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ matrix.config.version }} + docker push ghcr.io/rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}latest From 91548a4910c87ba7f88f710643b94097d8ed784f Mon Sep 17 00:00:00 2001 From: Cole Arendt Date: Mon, 14 Jun 2021 20:39:11 -0400 Subject: [PATCH 3/5] add startup.sh script --- r-session-debug/bionic/startup.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 r-session-debug/bionic/startup.sh diff --git a/r-session-debug/bionic/startup.sh b/r-session-debug/bionic/startup.sh new file mode 100755 index 00000000..4246d569 --- /dev/null +++ b/r-session-debug/bionic/startup.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +TCPDUMP_OUTPUT=${TCPDUMP_OUTPUT:-/tmp/tcpdump.pcap} +TCPDUMP_MAX_PACKETS=${TCPDUMP_MAX_PACKETS:-10000} + +tcpdump -i any -w ${TCPDUMP_OUTPUT} -c ${TCPDUMP_MAX_PACKETS} & + +# Launch the session based on RSTUDIO_TYPE +if [ -z "$RSTUDIO_TYPE" -o "$RSTUDIO_TYPE" == "session" ]; then + echo "Starting RStudio session..." + exec "/usr/lib/rstudio-server/bin/rserver-launcher" "$@" +elif [ "$RSTUDIO_TYPE" == "adhoc" ]; then + echo "Starting RStudio adhoc job..." + exec "/bin/bash" "$@" +else + echo "ERROR: Unknown RSTUDIO_TYPE: ${RSTUDIO_TYPE}" + exit 1 +fi From 04155928fd7bbeee1dbb8547b5fd38532dc9e217 Mon Sep 17 00:00:00 2001 From: Cole Arendt Date: Mon, 14 Jun 2021 20:42:55 -0400 Subject: [PATCH 4/5] add startup.sh script to image --- r-session-debug/bionic/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-session-debug/bionic/Dockerfile b/r-session-debug/bionic/Dockerfile index 67facb35..550a137c 100644 --- a/r-session-debug/bionic/Dockerfile +++ b/r-session-debug/bionic/Dockerfile @@ -12,4 +12,4 @@ RUN apt-get update -qq \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -# TODO: update the entrypoint... +COPY startup.sh /usr/local/bin/startup.sh From f12a62f84fbded563a2aec51eac09984bdee71db Mon Sep 17 00:00:00 2001 From: Cole Arendt Date: Mon, 14 Jun 2021 20:44:38 -0400 Subject: [PATCH 5/5] switch to using docker hub for now --- r-session-debug/bionic/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r-session-debug/bionic/Dockerfile b/r-session-debug/bionic/Dockerfile index 550a137c..d949403c 100644 --- a/r-session-debug/bionic/Dockerfile +++ b/r-session-debug/bionic/Dockerfile @@ -1,5 +1,5 @@ ARG RSP_VERSION -FROM ghcr.io/rstudio/r-session-complete:bionic-${RSP_VERSION} +FROM rstudio/r-session-complete:bionic-${RSP_VERSION} RUN apt-get update -qq \ && apt-get install -y \