-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: aavarghese <[email protected]>
- Loading branch information
1 parent
84fdc30
commit 0d4aa5f
Showing
9 changed files
with
169 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: CI Tests for IBM Cloud backend | ||
|
||
# cancel any prior runs for this workflow and this PR (or branch) | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
ci: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
SCRIPT: | ||
- ./tests/bin/ci.sh -i 'test7f.*' | ||
- ./tests/bin/go.sh | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Check Docker | ||
run: docker version && podman version | ||
|
||
- name: Run Test with args ${{ matrix.ARGS }} | ||
env: | ||
TERM: xterm-256color | ||
IC_API_KEY: ${{ secrets.IC_API_KEY }} | ||
RESOURCE_GROUP_ID: ${{ secrets.RESOURCE_GROUP_ID }} | ||
SSH_KEY_PUB: ${{ secrets.SSH_KEY_PUB }} | ||
run: bash -c "${{matrix.SCRIPT}} ${{matrix.ARGS }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package compilation | ||
|
||
import ( | ||
_ "embed" | ||
"encoding/json" | ||
"os" | ||
"path/filepath" | ||
|
||
"lunchpail.io/pkg/be/target" | ||
) | ||
|
||
type TargetOptions struct { | ||
Namespace string | ||
target.Platform | ||
} | ||
|
||
type Options struct { | ||
Target *TargetOptions | ||
|
||
ImagePullSecret string `yaml:"imagePullSecret,omitempty"` | ||
OverrideValues []string `yaml:"overrideValues,omitempty"` | ||
OverrideFileValues []string `yaml:"overrideFileValues,omitempty"` | ||
Queue string `yaml:",omitempty"` | ||
HasGpuSupport bool `yaml:"hasGpuSupport,omitempty"` | ||
ApiKey string `yaml:"apiKey,omitempty"` | ||
ResourceGroupID string `yaml:"resourceGroupID,omitempty"` | ||
SSHKeyType string `yaml:"SSHKeyType,omitempty"` | ||
PublicSSHKey []string `yaml:"publicSSHKey,omitempty"` | ||
Zone string `yaml:"zone,omitempty"` | ||
Profile string `yaml:"profile,omitempty"` | ||
ImageID string `yaml:"imageID,omitempty"` | ||
CreateNamespace bool `yaml:"createNamespace,omitempty"` | ||
} | ||
|
||
//go:embed compilationOptions.json | ||
Check failure on line 35 in pkg/compilation/options.go GitHub Actions / ci (kubernetes, ./tests/bin/pipelines.sh, ubuntu-latest)
Check failure on line 35 in pkg/compilation/options.go GitHub Actions / ci (local, ./tests/bin/ci.sh -e 'test(7.*|8.*)|python.*', ubuntu-latest)
Check failure on line 35 in pkg/compilation/options.go GitHub Actions / ci (local, ./tests/bin/ci.sh -i 'test7.*' -e 'test7(b.*|c.*|d.*|e.*|f.*|g.*|h.*)', ubuntu-latest)
Check failure on line 35 in pkg/compilation/options.go GitHub Actions / ci (local, ./tests/bin/ci.sh -i 'test7f.*', ubuntu-latest)
|
||
var valuesJson []byte | ||
|
||
func saveOptions(stagedir string, opts Options) error { | ||
if serialized, err := json.Marshal(opts); err != nil { | ||
return err | ||
} else { | ||
return os.WriteFile(filepath.Join(stagedir, "pkg/compilation/compilationOptions.json"), serialized, 0644) | ||
} | ||
} | ||
|
||
func RestoreOptions() (Options, error) { | ||
var compilationOptions Options | ||
|
||
if err := json.Unmarshal(valuesJson, &compilationOptions); err != nil { | ||
return compilationOptions, err | ||
} | ||
|
||
return compilationOptions, nil | ||
} | ||
|
||
// Overlay command line args with options from shrinkwrap (i.e. RestoreOptions) | ||
func RestoreOptionsWithCliOverlay(cliOpts Options) (Options, error) { | ||
compiledOpts, err := RestoreOptions() | ||
if err != nil { | ||
return cliOpts, err | ||
} else { | ||
return cliOpts.overlay(compiledOpts), nil | ||
} | ||
} | ||
|
||
func either(a string, b string) string { | ||
if b == "" { | ||
return a | ||
} | ||
return b | ||
} | ||
|
||
func eitherPlatform(a target.Platform, b target.Platform) target.Platform { | ||
if b == "" { | ||
return a | ||
} | ||
return b | ||
} | ||
|
||
func eitherB(a bool, b bool) bool { | ||
return b || a | ||
} | ||
|
||
func (cliOpts Options) overlay(compiledOpts Options) Options { | ||
cliOpts.Queue = either(compiledOpts.Queue, cliOpts.Queue) | ||
cliOpts.ImagePullSecret = either(compiledOpts.ImagePullSecret, cliOpts.ImagePullSecret) | ||
cliOpts.Target = &TargetOptions{ | ||
Platform: eitherPlatform(compiledOpts.Target.Platform, cliOpts.Target.Platform), | ||
Namespace: either(compiledOpts.Target.Namespace, cliOpts.Target.Namespace), | ||
} | ||
|
||
// TODO here... how do we determine that boolean values were unset? | ||
cliOpts.HasGpuSupport = eitherB(compiledOpts.HasGpuSupport, cliOpts.HasGpuSupport) | ||
cliOpts.CreateNamespace = eitherB(compiledOpts.CreateNamespace, cliOpts.CreateNamespace) | ||
|
||
// careful: `--set x=3 --set x=4` results in x having | ||
// value 4, so we need to place the compiled | ||
// options first in the list | ||
cliOpts.OverrideValues = append(compiledOpts.OverrideValues, cliOpts.OverrideValues...) | ||
cliOpts.OverrideFileValues = append(compiledOpts.OverrideFileValues, cliOpts.OverrideFileValues...) | ||
|
||
return cliOpts | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters