Skip to content

Commit

Permalink
feat(precheck): change devops check
Browse files Browse the repository at this point in the history
change devops check

Signed-off-by: ysicing <[email protected]>
  • Loading branch information
ysicing committed Sep 1, 2023
1 parent a395322 commit aa71986
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
11 changes: 11 additions & 0 deletions .github/runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: quickon-cli-runner
spec:
replicas: 1
template:
spec:
repository: easysoft/quickon_cli
labels:
- quickon-cli-runner
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ jobs:
build:
name: "build"
timeout-minutes: 20
# runs-on: ubuntu-latest
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
13 changes: 7 additions & 6 deletions internal/pkg/util/preflight/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,17 +681,18 @@ func (ncc NumCPUCheck) Check() error {
log := log.GetInstance()
log.Debug("validating number of CPUs")
numCPU := runtime.NumCPU()
if numCPU < ncc.NumCPU {
return errors.Errorf("the number of available CPUs %d is less than the required %d", numCPU, ncc.NumCPU)
}
if ncc.Devops {
if numCPU < ncc.NumCPU*2 {
return errors.Errorf("the number of available CPUs %d is less than the required %d", numCPU, ncc.NumCPU*2)
log.Warnf("the number of available CPUs %d is greater than the required %d", numCPU, ncc.NumCPU*2)
return nil
}
log.Donef("the number of available CPUs %d is greater than the required %d", numCPU, ncc.NumCPU*2)
return nil
}
if numCPU < ncc.NumCPU {
return errors.Errorf("the number of available CPUs %d is less than the required %d", numCPU, ncc.NumCPU)
} else {
log.Donef("the number of available CPUs %d is greater than the required %d", numCPU, ncc.NumCPU)
}
log.Donef("the number of available CPUs %d is greater than the required %d", numCPU, ncc.NumCPU)
return nil
}

Expand Down
13 changes: 7 additions & 6 deletions internal/pkg/util/preflight/checks_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ func (mc MemCheck) Check() error {

// Totalram holds the total usable memory. Unit holds the size of a memory unit in bytes. Multiply them and convert to MB
actual := uint64(info.Totalram) * uint64(info.Unit) / 1024 / 1024
if actual < mc.Mem {
return errors.Errorf("the system RAM (%d MB) is less than the minimum %d MB", actual, mc.Mem)
}
if mc.Devops {
if actual < mc.Mem*2 {
return errors.Errorf("the system RAM (%d MB) is less than the minimum %d MB", actual, mc.Mem*2)
log.Warnf("the system RAM (%d MB) is less than the minimum %d MB", actual, mc.Mem*2)
return nil
}
log.Donef("the system RAM (%d MB) is greater than the minimum %d MB", actual, mc.Mem*2)
return nil
}
if actual < mc.Mem {
return errors.Errorf("the system RAM (%d MB) is less than the minimum %d MB", actual, mc.Mem)
} else {
log.Donef("the system RAM (%d MB) is greater than the minimum %d MB", actual, mc.Mem)
}
log.Donef("the system RAM (%d MB) is greater than the minimum %d MB", actual, mc.Mem)
return nil
}

0 comments on commit aa71986

Please sign in to comment.