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

Pre and post regional script: feature proposal #508

Open
mickaelbaron opened this issue Oct 4, 2024 · 0 comments
Open

Pre and post regional script: feature proposal #508

mickaelbaron opened this issue Oct 4, 2024 · 0 comments

Comments

@mickaelbaron
Copy link
Contributor

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?

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

No branches or pull requests

1 participant