Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Dockerfile.ubuntu2204
to include a multi-stage build process, adding Go installation and setting up the Go workspace. The final image now includes the compiled Go binary and session components. [1] [2]builder
, sets up the environment to compile the Go application and download necessary components.build
, starts with another Ubuntu 22.04 base image. I was originally using the basescratch
image here, but this wouldn't work with the goss tests and there is not much difference in final image size. This stage just copies the compiled Go binary and session components from the builder stage.Go Code Additions:
main.go
file that contains the logic for copying session components based on the session type, validating the target directory, and ensuring the copy operation preserves permissions, times, and owner.go.mod
file to manage Go module dependencies for the project.otiai10/copy
package to handle the copying process, preserving important file attributes and optimizing performance with parallel execution. (I believe hosted used this at one point, or still does).Test Additions:
main_test.go
with tests for thegetFilesToCopy
function and thecopyFiles
function, ensuring correct behaviour for various session types and verifying file copying operations.Removal of Old Shell Script:
run.sh
shell script that previously handled the copying of session components.Test Configuration Update:
goss.yaml
test configuration to reflect the new entrypoint binary instead of the old shell script.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