Skip to content

Conversation

@callumforrester
Copy link
Contributor

@callumforrester callumforrester commented Sep 24, 2025

Introduce an editable version of debug mode modelled on fastcs: https://github.com/DiamondLightSource/fastcs

Now setting debug.enabled: true will create a new PVC with the source code in it, but setting debug.enabled: false will make that PVC go away and leave you with a stable, known container.

Thanks @gilesknap for all your help.

@codecov
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.64%. Comparing base (6536118) to head (19bef2f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1212   +/-   ##
=======================================
  Coverage   94.64%   94.64%           
=======================================
  Files          41       41           
  Lines        2595     2595           
=======================================
  Hits         2456     2456           
  Misses        139      139           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@callumforrester callumforrester marked this pull request as ready for review October 2, 2025 14:03
@callumforrester callumforrester requested a review from a team as a code owner October 2, 2025 14:03
Comment on lines +48 to +52
{{- if .Values.debug.enabled }}
- name: {{ include "blueapi.fullname" . }}-develop
persistentVolumeClaim:
claimName: {{ include "blueapi.fullname" . }}-develop
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug.enabled is doing a lot of things on a single boolean- it changes the container that is being used to one that does not start the service by default (allows debugging service startup); it starts a sidecar and mounts config (to allow VSCode to attach); and it would now mount an additional PVC and initContainer in addition to one that may already be configured for scratch purposes, overwriting code changes, so long as the container follows a convention for placement and use of submodule dependencies that is not documented.

We must better decompose those behaviours, as well as documenting the requirements.

I propose we keep the existing scratch configuration/PVC for the copying of code from the container, but make it more in line with what this change is suggesting, while documenting the requirements for mutability:

For the repository plan-bluesky

  • pyproject.toml depends on blueapi, dodal directly
  • Dockerfile places the source for plan-bluesky and dodal in a predictable location /workspaces/$REPO
  • Dockerfile may also place the source for other dependencies in /workspaces/ if they may need to be editable

For the blueapi repository:

  • Dockerfile places the source for blueapi in a predictable location /workspaces/$REPO
  • Dockerfile has a -debug image tag that does not start the service by default to allow debugging container startup by execing into the pod

For both:

  • Dockerfile runs the blueapi CLI
  • Helm chart from blueapi repository can be used, -debug image can be specified in the image: field
  • Helm chart reads scratch configuration from values.yaml and attempts to copy source from the container, falling back to fetching the latest release (later: allow configuration of specific versions), copying either to scratch on /dls_sw/ or a volume as currently configured (now: add field to switch ephemeral/persisted for version/persisted constantly)
  • When using a PVC for the scratch area, it is chmod -R o+wrX'd, and the sidecar/mounting to allow fedids to be picked up is enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting we get rid of the ability to include arbitrary external repos in the scratch area (i.e. no more git cloning at all)?

Copy link
Contributor

@DiamondJoseph DiamondJoseph Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

falling back to fetching the latest release (later: allow configuration of specific versions)

falling back to fetching from the default branch of the remote_url from the ScratchRepository config (later: allow configuration of specific refs)*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And with this current setup, the pvc is deleted when you disable debug mode, are you suggesting getting rid of that too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm suggesting in add field to switch ephemeral/persisted for version/persisted constantly that that becomes configurable behaviour.

initContainer:
  persistentVolume:
    enabled: false
    # New field, current behaviour is Version, removed when initContainer is disabled is Session?
    lifetime: Version | Persistent | Session

Comment on lines +189 to +192
- mountPath: /home
name: home
- mountPath: /var/run/nslcd
name: nslcd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these, and /venv would cause issues if debug and initContainer.persistentVolume were enabled simultaneously, as duplicating the entry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants