Skip to content

Commit

Permalink
GA workflows are updated to use go v1.20 or higher and K8s v1.27.x
Browse files Browse the repository at this point in the history
This commit will:
- update all actions and tool versions
- updating Kind version and image for E2E tests
- install golang-ci lint as recommended by provider
- specify major and minor version of go in setup-go action as recommended in
the action's docs
- fix linting issues spotted by ner version of golangci-lint
- update regression workflow to use K8s v20 to 27

Signed-off-by: Madalina Lazar <madalina.lazar@intel.com>
  • Loading branch information
madalazar authored and uniemimu committed Jul 31, 2023
1 parent fda8e05 commit dde1fc9
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 34 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/end-to-end-test.yaml
Expand Up @@ -6,15 +6,15 @@ on:
goVersion:
required: false
type: string
default: 1.19
default: 1.20.5
kindversion:
required: false
type: string
default: v0.17.0
default: v0.19.0
imagehash:
required: false
type: string
default: kindest/node:v1.26.0@sha256:691e24bd2417609db7e589e1a479b902d2e209892a10ce375fab60a8407c7352
default: kindest/node:v1.27.1@sha256:b7d12ed662b873bd8510879c1846e87c7e676a79fefc93e17b2a52989d3ff42b
runson:
required: false
type: string
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Set up Go version
uses: actions/setup-go@v3
with:
go-version: ${{ inputs.goVersion}}
go-version: "${{ inputs.goVersion}}"
- name: Get tools for cluster installation
run: ./.github/scripts/e2e_get_tools.sh ${{ inputs.kindversion }} ${{ inputs.isLocal }}
- name: Set up cluster with TAS and custom metrics
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/go-build-and-test.yml
Expand Up @@ -10,7 +10,7 @@ on:
goVersion:
required: false
type: string
default: 1.19
default: 1.20.5

jobs:
build-test:
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ inputs.goVersion }}
go-version: "${{ inputs.goVersion }}"
- name: Build
run: make build
- name: Image
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/regression-workflow.yaml
Expand Up @@ -37,23 +37,13 @@ jobs:
echo "BRANCH=INVALID_EVENT_BRANCH_UNKNOWN" >> $GITHUB_OUTPUT
fi
end-to-end-test-local-K8s-v19:
uses: ./.github/workflows/end-to-end-test.yaml
needs: [ current_branch ]
with:
runson: self-hosted-kind
cleanup: true
isLocal: "true"
codeBranch: ${{ needs.current_branch.outputs.extract_branch }}
imageHash: "kindest/node:v1.19.16@sha256:476cb3269232888437b61deca013832fee41f9f074f9bed79f57e4280f7c48b7"

end-to-end-test-local-K8s-v20:
uses: ./.github/workflows/end-to-end-test.yaml
needs: [ end-to-end-test-local-K8s-v19 ]
needs: [ current_branch ]
with:
runson: self-hosted-kind
cleanup: false
cleanup: true
isLocal: "true"
codeBranch: ${{ needs.current_branch.outputs.extract_branch }}
imageHash: "kindest/node:v1.20.15@sha256:a32bf55309294120616886b5338f95dd98a2f7231519c7dedcec32ba29699394"
Expand Down Expand Up @@ -118,3 +108,15 @@ jobs:
isLocal: "true"
codeBranch: ${{ needs.current_branch.outputs.extract_branch }}
imageHash: "kindest/node:v1.26.0@sha256:691e24bd2417609db7e589e1a479b902d2e209892a10ce375fab60a8407c7352"


end-to-end-test-local-K8s-v27:
uses: ./.github/workflows/end-to-end-test.yaml
needs: [ end-to-end-test-local-K8s-v26 ]
with:
runson: self-hosted-kind
cleanup: false
isLocal: "true"
codeBranch: ${{ needs.current_branch.outputs.extract_branch }}
imageHash: "kindest/node:v1.27.1@sha256:b7d12ed662b873bd8510879c1846e87c7e676a79fefc93e17b2a52989d3ff42b"

14 changes: 7 additions & 7 deletions .github/workflows/static-analysis.yaml
Expand Up @@ -22,19 +22,19 @@ on:
goVersion:
required: false
type: string
default: 1.19
default: 1.20.5
hadolintVersion:
required: false
type: string
default: v2.12.0
goLangCIVersion:
required: false
type: string
default: v1.50.1
default: v1.53.1
goImportsVersion:
required: false
type: string
default: v0.3.0
default: v0.9.3
jobs:
shellcheck:
name: Shellcheck
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ inputs.goVersion }}
go-version: "${{ inputs.goVersion }}"
- run: go install golang.org/x/tools/cmd/goimports@${{ inputs.goImportsVersion }}; test -z $(goimports -l ${{ matrix.modulename }}) && test -z $(gofmt -l ${{ matrix.modulename }})

golangci-run:
Expand All @@ -88,7 +88,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ inputs.goVersion }}
- name: Running golang CI for ${{matrix.workingdir}}
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@${{ inputs.goLangCIVersion }} && cd ./${{ matrix.workingdir }} && golangci-lint run --timeout=5m -v --color='always' && cd ..
go-version: "${{ inputs.goVersion }}"
- name: Running golang CI for ${{matrix.workingdir}}
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${{ inputs.goLangCIVersion }} && golangci-lint --version && cd ./${{ matrix.workingdir }} && golangci-lint run --timeout=5m -v --color='always' && cd ..

16 changes: 14 additions & 2 deletions .golangci.yml
Expand Up @@ -33,7 +33,7 @@ linters-settings:
gofmt:
simplify: true
gofumpt:
lang-version: "1.19"
lang-version: "1.20"
golint:
min-confidence: 0.9
govet:
Expand All @@ -52,6 +52,19 @@ linters-settings:
line-length: 160
nestif:
min-complexity: 7
depguard:
rules:
Main:
files:
- $all
allow:
- $gostd
- k8s.io/klog
- k8s.io/client-go
- k8s.io/api
- k8s.io/apimachinery
- k8s.io/metrics
- github.com/intel/platform-aware-scheduling

issues:
exclude-rules:
Expand All @@ -64,4 +77,3 @@ issues:
- goimports
- gofmt
- dupword

6 changes: 3 additions & 3 deletions telemetry-aware-scheduling/pkg/strategies/core/mocks.go
Expand Up @@ -24,12 +24,12 @@ type MockStrategy struct {
}

// Violated gets the cache values from MockStrategy and returns the map interface.
func (v *MockStrategy) Violated(cache cache.Reader) map[string]interface{} {
func (v *MockStrategy) Violated(_ cache.Reader) map[string]interface{} {
return map[string]interface{}{}
}

// Enforce returns 0 value and nil error.
func (v *MockStrategy) Enforce(enforcer *MetricEnforcer, cache cache.Reader) (int, error) {
func (v *MockStrategy) Enforce(_ *MetricEnforcer, _ cache.Reader) (int, error) {
return 0, nil
}

Expand Down Expand Up @@ -79,7 +79,7 @@ func (v *MockStrategy) AddStrategy(i Interface, s string) {
}

// RemoveStrategy is a method in Mock strategy.
func (v *MockStrategy) RemoveStrategy(i Interface, s string) {
func (v *MockStrategy) RemoveStrategy(_ Interface, _ string) {
v.RemovedStrategies = nil
}

Expand Down
Expand Up @@ -66,7 +66,7 @@ func (d *Strategy) Violated(cache cache.Reader) map[string]interface{} {
}

// Enforce unimplemented for dontschedule.
func (d *Strategy) Enforce(enforcer *core.MetricEnforcer, cache cache.Reader) (int, error) {
func (d *Strategy) Enforce(_ *core.MetricEnforcer, _ cache.Reader) (int, error) {
return 0, nil
}

Expand Down
Expand Up @@ -20,14 +20,14 @@ const (
)

// Violated is unimplemented for this strategy.
func (d *Strategy) Violated(cache cache.Reader) map[string]interface{} {
func (d *Strategy) Violated(_ cache.Reader) map[string]interface{} {
violatingNodes := map[string]interface{}{}

return violatingNodes
}

// Enforce is unimplemented.
func (d *Strategy) Enforce(enforcer *core.MetricEnforcer, cache cache.Reader) (int, error) {
func (d *Strategy) Enforce(_ *core.MetricEnforcer, _ cache.Reader) (int, error) {
return 0, nil
}

Expand Down
Expand Up @@ -30,6 +30,7 @@ func (in *TASPolicy) DeepCopy() *TASPolicy {

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *TASPolicy) DeepCopyObject() runtime.Object {
//nolint:revive
if c := in.DeepCopy(); c != nil {
return c
}
Expand Down Expand Up @@ -67,6 +68,7 @@ func (in *TASPolicyList) DeepCopy() *TASPolicyList {

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *TASPolicyList) DeepCopyObject() runtime.Object {
//nolint:revive
if c := in.DeepCopy(); c != nil {
return c
}
Expand Down
Expand Up @@ -228,7 +228,7 @@ func (m MetricsExtender) Filter(w http.ResponseWriter, r *http.Request) {
}

// Bind binds the pod to the node. Not implemented by TAS, hence response with StatusNotFound.
func (m MetricsExtender) Bind(w http.ResponseWriter, r *http.Request) {
func (m MetricsExtender) Bind(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusNotFound)
}

Expand Down

0 comments on commit dde1fc9

Please sign in to comment.