Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release target for workbench-session-init image #863

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 2 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ alias build := bake
bake target="default":
just -f {{justfile()}} create-builder || true
GIT_SHA=$(git rev-parse --short HEAD) \
WORKBENCH_SESSION_INIT_VERSION=$(just -f ci.Justfile get-version workbench --type=daily --local) \
docker buildx bake --builder=posit-builder -f docker-bake.hcl {{target}}

# just preview-bake workbench-images dev
Expand Down Expand Up @@ -90,6 +91,7 @@ preview-plan branch="$(git branch --show-current)":
# just test workbench
test target="default" file="docker-bake.hcl":
GIT_SHA=$(git rev-parse --short HEAD) \
WORKBENCH_SESSION_INIT_VERSION=$(just -f ci.Justfile get-version workbench --type=daily --local) \
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.0+375.pro3"
}

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
Loading