Add some worker code
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
7174e030e2
commit
6a5c309399
15 changed files with 1132 additions and 2 deletions
|
|
@ -15,6 +15,8 @@
|
|||
package params
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
|
|
@ -420,6 +422,21 @@ type RunnerScaleSetJitRunnerConfig struct {
|
|||
EncodedJITConfig string `json:"encodedJITConfig"`
|
||||
}
|
||||
|
||||
func (r RunnerScaleSetJitRunnerConfig) DecodedJITConfig() (map[string]string, error) {
|
||||
if r.EncodedJITConfig == "" {
|
||||
return nil, fmt.Errorf("no encoded JIT config specified")
|
||||
}
|
||||
decoded, err := base64.StdEncoding.DecodeString(r.EncodedJITConfig)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode JIT config: %w", err)
|
||||
}
|
||||
jitConfig := make(map[string]string)
|
||||
if err := json.Unmarshal(decoded, &jitConfig); err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal JIT config: %w", err)
|
||||
}
|
||||
return jitConfig, nil
|
||||
}
|
||||
|
||||
type RunnerReferenceList struct {
|
||||
Count int `json:"count"`
|
||||
RunnerReferences []RunnerReference `json:"value"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue