rstudio / rstudio-docker-products

Docker images for RStudio Professional Products
https://hub.docker.com/u/rstudio
MIT License
66 stars 56 forks source link

Workbench session init go cp #871

Closed skyeturriff closed 1 week ago

skyeturriff commented 1 week ago

Addresses https://github.com/rstudio/rstudio-pro/issues/7006

This pull request introduces changes to the workbench-session-init image, including the addition of a Go-based entrypoint, updates to the Dockerfile, and new tests for the Go code. The main changes are grouped into Dockerfile updates, Go code additions, and test additions.

Dockerfile Updates:

Go Code Additions:

Test Additions:

Removal of Old Shell Script:

Test Configuration Update:

Testing

just preview-bake workbench-session-init-daily
mkdir init
docker run -v $(pwd)/init:/mnt/init rstudio/workbench-session-init-preview:workbench-session-init-go-cp-jammy-daily
skyeturriff commented 1 week ago

The Release - Build, Test, and Push / Workbench Session Init (pull_request) check is failing as the Get Version step is returning the version as 2024.12.0+439.pro1, which doesn't exist:

Fetch Workbench session init container version

Run WORKBENCH_SESSION_INIT_VERSION=$(just -f ci.Justfile get-version workbench --type=daily --local)
  WORKBENCH_SESSION_INIT_VERSION=$(just -f ci.Justfile get-version workbench --type=daily --local)
  echo "WORKBENCH_SESSION_INIT_VERSION=$WORKBENCH_SESSION_INIT_VERSION" >> $GITHUB_OUTPUT
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.12.7/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.7/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.7/x64/lib
./tools/get-version.py workbench --type=daily --local
Swapping product 'workbench' for 'workbench'
Providing version for product: 'workbench' and version type: 'daily'
Got daily version: '2024.12.0+439.pro1'

It should be 2024.12.0+439.pro2. And so the constructed URL is invalid:

Workbench Session Init

#9 [builder 3/8] RUN mkdir -p /pwb-staging &&     RSW_VERSION_URL=$(echo -n "2024.12.0+439.pro1" | sed 's/+/-/g') &&     curl -fsSL -o /pwb-staging/rsp-session-multi-linux.tar.gz "https://s3.amazonaws.com/rstudio-ide-build/session/multi/x86_64/rsp-session-multi-linux-${RSW_VERSION_URL}-x86_64.tar.gz" &&     mkdir -p /opt/session-components &&     tar -C /opt/session-components -xpf /pwb-staging/rsp-session-multi-linux.tar.gz &&     chmod 755 /opt/session-components &&     curl -fsSL -o /pwb-staging/go.tar.gz "https://go.dev/dl/go1.22.2.linux-amd64.tar.gz" &&     tar -C /usr/local -xf /pwb-staging/go.tar.gz &&     rm -rf /pwb-staging
#9 0.150 curl: (22) The requested URL returned error: 404

When I run Get Version step locally, I get the correct version:

❯ just -f ci.Justfile get-version workbench --type=daily --local
./tools/get-version.py workbench --type=daily --local
Swapping product 'workbench' for 'workbench'
Providing version for product: 'workbench' and version type: 'daily'
Got daily version: '2024.12.0+439.pro2'
2024.12.0+439.pro2
ianpittwood commented 1 week ago

The Release - Build, Test, and Push / Workbench Session Init (pull_request) check is failing as the Get Version step is returning the version as 2024.12.0+439.pro1, which doesn't exist:

Fetch Workbench session init container version

Run WORKBENCH_SESSION_INIT_VERSION=$(just -f ci.Justfile get-version workbench --type=daily --local)
  WORKBENCH_SESSION_INIT_VERSION=$(just -f ci.Justfile get-version workbench --type=daily --local)
  echo "WORKBENCH_SESSION_INIT_VERSION=$WORKBENCH_SESSION_INIT_VERSION" >> $GITHUB_OUTPUT
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.12.7/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.7/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.7/x64/lib
./tools/get-version.py workbench --type=daily --local
Swapping product 'workbench' for 'workbench'
Providing version for product: 'workbench' and version type: 'daily'
Got daily version: '2024.12.0+439.pro1'

It should be 2024.12.0+439.pro2. And so the constructed URL is invalid:

Workbench Session Init

#9 [builder 3/8] RUN mkdir -p /pwb-staging &&     RSW_VERSION_URL=$(echo -n "2024.12.0+439.pro1" | sed 's/+/-/g') &&     curl -fsSL -o /pwb-staging/rsp-session-multi-linux.tar.gz "https://s3.amazonaws.com/rstudio-ide-build/session/multi/x86_64/rsp-session-multi-linux-${RSW_VERSION_URL}-x86_64.tar.gz" &&     mkdir -p /opt/session-components &&     tar -C /opt/session-components -xpf /pwb-staging/rsp-session-multi-linux.tar.gz &&     chmod 755 /opt/session-components &&     curl -fsSL -o /pwb-staging/go.tar.gz "https://go.dev/dl/go1.22.2.linux-amd64.tar.gz" &&     tar -C /usr/local -xf /pwb-staging/go.tar.gz &&     rm -rf /pwb-staging
#9 0.150 curl: (22) The requested URL returned error: 404

When I run Get Version step locally, I get the correct version:

❯ just -f ci.Justfile get-version workbench --type=daily --local
./tools/get-version.py workbench --type=daily --local
Swapping product 'workbench' for 'workbench'
Providing version for product: 'workbench' and version type: 'daily'
Got daily version: '2024.12.0+439.pro2'
2024.12.0+439.pro2

@skyeturriff I suggest we merge versions into workbench-session-init to help make reruns easier in the future: https://github.com/rstudio/rstudio-docker-products/pull/875