InseeFrLab / InseeFrLab/onyxia-api

Pre and post regional script: feature proposal

Open
#508 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
34
Forks
34
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.