-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(worker): add worker registration #503
Conversation
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Neal Coleman <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Kelly Merrick <[email protected]>
* revert: stream container logs * feat: add flag to enable streaming logs * feat(executor): add logic to stream logs if enabled * enhance: make log publishing method configurable * enhance: use configurable log publishing method * chore: configure time log publish method for local * chore: address linter feedback * chore: fix tests for code changes * chore: address linter feedback v2
….2 (#237) Co-authored-by: Renovate Bot <[email protected]>
* enhance(version): add fallback for empty tag * enhance(version): use go version from runtime library * chore: clean go code
* StepFromContainer -> StepFromContainerEnvironment * Use library.StepFromBuildContainer to create new Steps * update go-vela/types * go mod tidy Co-authored-by: David May <[email protected]>
Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Jordan Brockopp <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
* initial changes * add some replace logic for secret masking * bringing in new types * fix go mod validate * multi line compatibility and initial testing work * added testing for internal secret masking * add back accidental deletion of error checking Co-authored-by: Jordan Brockopp <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
* update copyright year to 2022 * fix quotes
….0 (#259) Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Renovate Bot <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #503 +/- ##
=======================================
Coverage 83.44% 83.44%
=======================================
Files 69 69
Lines 5381 5381
=======================================
Hits 4490 4490
Misses 746 746
Partials 145 145
|
} | ||
|
||
c.JSON(http.StatusOK, "successfully passed token to worker") | ||
} | ||
|
||
// validatePubKey is a helper function to validate | ||
// the provided pubkey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
Comment should end in a period (godot)
} | ||
|
||
// validateQueueAddress is a helper function to validate | ||
// the provided queue address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
Comment should end in a period (godot)
@@ -127,3 +149,44 @@ func getSubjectFromToken(token string) (string, error) { | |||
|
|||
return sub, nil | |||
} | |||
|
|||
// validatePubKey is a helper function to validate | |||
// the provided pubkey |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
Comment should end in a period (godot)
// | ||
// Use of this source code is governed by the LICENSE file in this repository. | ||
|
||
package worker | ||
|
||
import ( | ||
"encoding/base64" | ||
"fmt" | ||
"github.com/go-vela/server/util" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
File is not goimports
-ed (goimports)
@@ -5,6 +5,7 @@ | |||
package middleware | |||
|
|||
import ( | |||
"github.com/go-vela/types/library" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
File is not goimports
-ed (goimports)
"fmt" | ||
"github.com/go-vela/server/util" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
File is not goimports
-ed (goimports)
@@ -13,12 +14,13 @@ import ( | |||
"github.com/gin-gonic/gin" | |||
) | |||
|
|||
func TestMiddleware_RegisterToken(t *testing.T) { | |||
func TestMiddleware_WorkerRegistration(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
unnecessary leading newline (whitespace)
@@ -45,7 +45,6 @@ func (w *Worker) exec(index int, config *library.Worker) error { | |||
if err != nil { | |||
return err | |||
} | |||
|
|||
if item == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
if statements should only be cuddled with assignments (wsl)
// once worker created/check in, queue details are used to setup queue here. | ||
w.Config.Queue.Address = t.GetQueueAddress() | ||
w.Config.Queue.PublicKey = t.GetPublicKey() | ||
logrus.Trace("Validating queue details") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
only cuddled expressions if assigning variable or using from line above (wsl)
@@ -173,6 +191,7 @@ func (w *Worker) operate(ctx context.Context) error { | |||
// (do not pass the context to avoid errors in one | |||
// executor+build inadvertently canceling other builds) | |||
//nolint:contextcheck // ignore passing context | |||
|
|||
err = w.exec(id, registryWorker) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
Function exec->exec$1
should pass the context parameter (contextcheck)
Changes:
Depends on #498 , #307