Skip to content

Commit

Permalink
Merge pull request #863 from rstudio/workbench-session-init-release-b…
Browse files Browse the repository at this point in the history
…uild

Add release target for workbench-session-init image
  • Loading branch information
skyeturriff authored Nov 15, 2024
2 parents c9f1c14 + deb3a6e commit f2049d9
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 4 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/build-bake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,39 @@ jobs:
GIT_SHA=$(git rev-parse --short HEAD)
echo "GIT_SHA=$GIT_SHA" >> $GITHUB_OUTPUT
echo "$GIT_SHA"
versions:
name: Fetch Workbench session init container version
runs-on: ubuntu-latest

concurrency:
group: fetch-versions-${{ github.ref }}
cancel-in-progress: true

outputs:
WORKBENCH_SESSION_INIT_VERSION: ${{ steps.get-version.outputs.WORKBENCH_SESSION_INIT_VERSION }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Just
uses: extractions/setup-just@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Python dependencies
run: |
pip install requests
- name: Get Version
id: get-version
run: |
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
base:
needs: [setup]
Expand Down Expand Up @@ -290,6 +323,49 @@ jobs:
snyk-org: ${{ secrets.SNYK_ORG }}
snyk-token: '${{ secrets.SNYK_TOKEN }}'

workbench-session-init:
needs: [setup, versions]
name: Workbench Session Init
runs-on: ubuntu-latest-8x

concurrency:
group: bake-workbench-session-init-${{ github.ref }}
cancel-in-progress: true

env:
target: workbench-session-init
GIT_SHA: ${{ needs.setup.outputs.GIT_SHA }}
WORKBENCH_SESSION_INIT_VERSION: ${{ needs.versions.outputs.WORKBENCH_SESSION_INIT_VERSION }}

steps:
- name: Checkout
if: github.event_name == 'schedule'
uses: actions/checkout@v4
with:
ref: 'main'

- name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
id: setup-buildx
with:
buildkitd-config: ./share/buildkitd.toml

- name: Build, Test, and Push
uses: ./.github/actions/bake-test-push
with:
target: ${{ env.target }}
push-image: ${{ github.ref == 'refs/heads/main' || github.event_name == 'schedule' }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
gcp-json: '${{ secrets.GCP_ARTIFACT_REGISTRY_JSON }}'
snyk-org: ${{ secrets.SNYK_ORG }}
snyk-token: '${{ secrets.SNYK_TOKEN }}'

workbench:
needs: [setup]
name: Workbench
Expand Down
10 changes: 10 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ delete-builder:
alias build := bake
# just bake workbench-images
bake target="default":
#!/bin/bash
just -f {{justfile()}} create-builder || true
if [ -z "$WORKBENCH_SESSION_INIT_VERSION" ]; then
WORKBENCH_SESSION_INIT_VERSION=$(just -f ci.Justfile get-version workbench --type=daily --local)
fi
GIT_SHA=$(git rev-parse --short HEAD) \
WORKBENCH_SESSION_INIT_VERSION=${WORKBENCH_SESSION_INIT_VERSION} \
docker buildx bake --builder=posit-builder -f docker-bake.hcl {{target}}

# just preview-bake workbench-images dev
Expand Down Expand Up @@ -89,7 +94,12 @@ preview-plan branch="$(git branch --show-current)":

# just test workbench
test target="default" file="docker-bake.hcl":
#!/bin/bash
if [ -z "$WORKBENCH_SESSION_INIT_VERSION" ]; then
WORKBENCH_SESSION_INIT_VERSION=$(just -f ci.Justfile get-version workbench --type=daily --local)
fi
GIT_SHA=$(git rev-parse --short HEAD) \
WORKBENCH_SESSION_INIT_VERSION=${WORKBENCH_SESSION_INIT_VERSION} \
python3 {{justfile_directory()}}/tools/test_bake_artifacts.py --target "{{target}}" --file "{{file}}"

# just preview-test connect dev
Expand Down
30 changes: 30 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ variable WORKBENCH_VERSION {
default = "2024.09.1+394.pro7"
}

variable WORKBENCH_SESSION_INIT_VERSION {
default = ""
}

variable DRIVERS_VERSION {
default = "2024.03.0"
}
Expand Down Expand Up @@ -181,6 +185,14 @@ variable WORKBENCH_BUILD_MATRIX {
}
}

variable WORKBENCH_SESSION_INIT_BUILD_MATRIX {
default = {
builds = [
{os = "ubuntu2204"},
]
}
}

variable WORKBENCH_GOOGLE_CLOUD_WORKSTATION_BUILD_MATRIX {
default = {
builds = [
Expand Down Expand Up @@ -209,6 +221,7 @@ group "default" {
"package-manager",
"r-session-complete",
"workbench",
"workbench-session-init",
]
}

Expand Down Expand Up @@ -453,6 +466,23 @@ target "workbench" {
}
}

target "workbench-session-init" {
inherits = ["base"]
target = "build"

name = "workbench-session-init-${builds.os}-${replace(tag_safe_version(WORKBENCH_SESSION_INIT_VERSION), ".", "-")}"
tags = get_tags(builds.os, "workbench-session-init", WORKBENCH_SESSION_INIT_VERSION)

dockerfile = "Dockerfile.${builds.os}"
context = "workbench-session-init"

matrix = WORKBENCH_SESSION_INIT_BUILD_MATRIX

args = {
RSW_VERSION = WORKBENCH_SESSION_INIT_VERSION
}
}

### Workbench for Google Cloud Workstations targets ###
target "workbench-for-google-cloud-workstations" {
inherits = ["base"]
Expand Down
14 changes: 10 additions & 4 deletions workbench-session-init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ This directory contains a Dockerfile and script that will create an init contain
* Where to get help: [our Github Issues page](https://github.com/rstudio/rstudio-docker-products/issues)
* Posit 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)
* Workbench Session Init image (Daily/Preview): [Docker Hub](https://hub.docker.com/r/rstudio/rstudio-workbench-session-init-preview)
* Workbench Session Init image: [Docker Hub](https://hub.docker.com/r/rstudio/workbench-session-init)

## Supported tags and respective Dockerfile links

* [`jammy-daily`, `ubuntu2204-daily`, `jammy-2024.11.0`, `ubuntu2204-2024.11.0`](https://github.com/rstudio/rstudio-docker-products/blob/main/workbench-session-init/Dockerfile.2204)

## Building

Currently daily builds are supported. To build the image, run:
Just will build an image using a default Connect distribution.

```console
just build
```

Daily builds are also supported. To build the daily image, run:

```console
just preview-bake workbench-session-init-daily
Expand All @@ -28,14 +34,14 @@ You can observe what gets copied by the container:

```console
mkdir init
docker run --rm -v $(pwd)/init:/mnt/init rstudio/workbench-session-init-preview:workbench-session-init-jammy-2024.11.0-daily-328.pro3
docker run --rm -v $(pwd)/init:/mnt/init rstudio/workbench-session-init:jammy-2024.11.0
# The init directory has been populated with the Workbench session runtime components.
```

You can also test using GOSS:

```console
just preview-test workbench-session-init-daily
just test workbench-session-init
```

## Licensing
Expand Down

0 comments on commit f2049d9

Please sign in to comment.