Skip to content

Commit

Permalink
Merge branch 'main' into demo
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanchen8911 authored May 8, 2024
2 parents 452aa5f + 5aefacc commit e4d4065
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 4 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
push:
branches:
- main

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Lint
uses: golangci/golangci-lint-action@v5
with:
version: 'v1.58.0'
args: -v --timeout 5m
skip-cache: true

- name: vet
run:
make vet

- name: fmt
run:
test -z "$(go fmt ./...)"

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Test
run: go test -v ./...

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Build
run: make build
5 changes: 4 additions & 1 deletion pkg/engine/check_object_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (task *CheckObjTask) Exec(ctx context.Context) error {
done := make(chan struct{})
defer close(done)

informer.AddEventHandler(cache.ResourceEventHandlerFuncs{
_, err = informer.AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
resource := obj.(*unstructured.Unstructured)
task.log.V(4).Info("Informer added", "resource", info.GVR.Resource, "name", resource.GetName())
Expand All @@ -101,6 +101,9 @@ func (task *CheckObjTask) Exec(ctx context.Context) error {
task.checkStateAsync(ctx, resource.GetName(), info, nameMap, done)
},
})
if err != nil {
return err
}

stopCh := make(chan struct{})
go informer.Run(stopCh)
Expand Down
4 changes: 1 addition & 3 deletions pkg/engine/submit_object_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,8 @@ func (task *SubmitObjTask) Exec(ctx context.Context) error {
}
}

task.setter.SetObjInfo(task.taskID,
return task.setter.SetObjInfo(task.taskID,
NewObjInfo([]string{task.obj[0].Metadata.Name}, task.obj[0].Metadata.Namespace, gvr, task.Pods.Names()...))

return nil
}

func (obj *GenericObject) UnmarshalYAML(unmarshal func(interface{}) error) error {
Expand Down

0 comments on commit e4d4065

Please sign in to comment.