Skip to content

Pre and post regional script: feature proposal #508

Open
@mickaelbaron

Description

@mickaelbaron

Hi,

I submit you a new feature.

We can override the ide/init.json schema to execute a regional initialization script. However, this regional script is triggered at the start of the onyxia-init.sh script. Unfortunately, some changes made by the regional script can be overwritten by subsequent instructions in the onyxia-init.sh script.

Concrete example: Git

In a region init script, I would like to change the credential.helper value: git config --global credential.helper '!f() { printf "%s\n" "username=$GIT_USER_NAME" "password=$GIT_PERSONAL_ACCESS_TOKEN"; };f'

When onyxia-init.sh script is executed credential.helper is updated by the below code:

    if [ -n "$GIT_CREDENTIALS_CACHE_DURATION" ]; then
        git config --"$git_config" credential.helper "cache --timeout=$GIT_CREDENTIALS_CACHE_DURATION"
    fi

A workaround could be a pre and post mecanism like this:

"preregionInit": {
  "type": "string",
  "description": "pre region initialization script",
  "default": "",
  "x-onyxia": {
     "hidden": true,
     "overwriteDefaultWith": "{{k8s.initScriptUrl}}"
  }
},
"postregionInit": {
  "type": "string",
  "description": "post region initialization script",
  "default": "",
  "x-onyxia": {
    "hidden": true,
    "overwriteDefaultWith": "{{k8s.initScriptUrl}}"
   }
},

How do you feel about this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions