Compare commits

..
Author SHA1 Message Date
github-actions[bot] 3b8da1ccce Updates: container-hooks to v0.8.1 2026-02-05 09:20:02 +00:00
dhawalsethandDhawal Seth 9de09f56eb Include the HTTP status code in jit error (#4361)
Co-authored-by: Dhawal Seth <[email protected]>
2026-01-29 16:40:17 +01:00
Caius Durling 02aa70a64a Fix AcivityId typo in error strings (#4359) 2026-01-21 01:14:26 +01:00
Jiaren WuandCopilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> d3ca9de3ca Potential fix for code scanning alert no. 7: Use of a broken or weak cryptographic hashing algorithm on sensitive data (#4353)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-01-14 21:04:02 -08:00
github-actions[bot]andgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> a868229fe0 Updates: runner to v2.331.0 (#4351)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-14 13:32:39 -05:00
9 changed files with 53 additions and 14 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ endif
DOCKER_USER ?= $(shell echo ${DOCKER_IMAGE_NAME} | cut -d / -f1)
VERSION ?= dev
COMMIT_SHA = $(shell git rev-parse HEAD)
RUNNER_VERSION ?= 2.330.0
RUNNER_VERSION ?= 2.331.0
TARGETPLATFORM ?= $(shell arch)
RUNNER_NAME ?= ${DOCKER_USER}/actions-runner
RUNNER_TAG ?= ${VERSION}
@@ -309,7 +309,7 @@ github-release: release
# Otherwise we get errors like the below:
# Error: failed to install CRD crds/actions.summerwind.dev_runnersets.yaml: CustomResourceDefinition.apiextensions.k8s.io "runnersets.actions.summerwind.dev" is invalid: [spec.validation.openAPIV3Schema.properties[spec].properties[template].properties[spec].properties[containers].items.properties[ports].items.properties[protocol].default: Required value: this property is in x-kubernetes-list-map-keys, so it must have a default or be a required property, spec.validation.openAPIV3Schema.properties[spec].properties[template].properties[spec].properties[initContainers].items.properties[ports].items.properties[protocol].default: Required value: this property is in x-kubernetes-list-map-keys, so it must have a default or be a required property]
#
# Note that controller-gen newer than 0.8.0 is needed due to https://github.com/kubernetes-sigs/controller-tools/issues/448
# Note that controller-gen newer than 0.8.1 is needed due to https://github.com/kubernetes-sigs/controller-tools/issues/448
# Otherwise ObjectMeta embedded in Spec results in empty on the storage.
controller-gen:
ifeq (, $(shell which controller-gen))
@@ -2,7 +2,7 @@ package actionssummerwindnet
import (
"context"
"crypto/sha1"
"crypto/sha256"
"encoding/hex"
"fmt"
"sort"
@@ -176,7 +176,7 @@ func (c *MultiGitHubClient) initClientForSecret(secret *corev1.Secret, dependent
sort.SliceStable(ks, func(i, j int) bool { return ks[i] < ks[j] })
hash := sha1.New()
hash := sha256.New()
for _, k := range ks {
hash.Write(secret.Data[k])
}
+6 -1
View File
@@ -274,6 +274,10 @@ func (c *Client) Identifier() string {
func (c *Client) Do(req *http.Request) (*http.Response, error) {
resp, err := c.Client.Do(req)
if err != nil {
// If we have a response even with an error, include the status code
if resp != nil {
return nil, fmt.Errorf("client request failed with status code %d: %w", resp.StatusCode, err)
}
return nil, fmt.Errorf("client request failed: %w", err)
}
@@ -856,7 +860,8 @@ func (c *Client) GenerateJitRunnerConfig(ctx context.Context, jitRunnerSetting *
resp, err := c.Do(req)
if err != nil {
return nil, fmt.Errorf("failed to issue the request: %w", err)
// Include the URL and method in the error for better debugging
return nil, fmt.Errorf("failed to issue the request %s %s: %w", req.Method, req.URL.String(), err)
}
if resp.StatusCode != http.StatusOK {
@@ -2,6 +2,7 @@ package actions_test
import (
"context"
"errors"
"net/http"
"testing"
"time"
@@ -58,4 +59,37 @@ func TestGenerateJitRunnerConfig(t *testing.T) {
assert.NotNil(t, err)
assert.Equalf(t, actualRetry, expectedRetry, "A retry was expected after the first request but got: %v", actualRetry)
})
t.Run("Error includes HTTP method and URL when request fails", func(t *testing.T) {
runnerSettings := &actions.RunnerScaleSetJitRunnerSetting{}
server := newActionsServer(t, http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
}))
client, err := actions.NewClient(
server.configURLForOrg("my-org"),
auth,
actions.WithRetryMax(0), // No retries to get immediate error
actions.WithRetryWaitMax(1*time.Millisecond),
)
require.NoError(t, err)
_, err = client.GenerateJitRunnerConfig(ctx, runnerSettings, 1)
require.NotNil(t, err)
// Verify error message includes HTTP method and URL for better debugging
errMsg := err.Error()
assert.Contains(t, errMsg, "POST", "Error message should include HTTP method")
assert.Contains(t, errMsg, "generatejitconfig", "Error message should include URL path")
// The error might be an ActionsError (if response was received) or a wrapped error (if Do() failed)
// In either case, the error message should include request details
var actionsErr *actions.ActionsError
if errors.As(err, &actionsErr) {
// If we got an ActionsError, verify the status code is included
assert.Equal(t, http.StatusInternalServerError, actionsErr.StatusCode)
}
// If it's a wrapped error from Do(), the error message already includes the method and URL
// which is what we're testing for
})
}
+2 -2
View File
@@ -36,7 +36,7 @@ type ActionsError struct {
}
func (e *ActionsError) Error() string {
return fmt.Sprintf("actions error: StatusCode %d, AcivityId %q: %v", e.StatusCode, e.ActivityID, e.Err)
return fmt.Sprintf("actions error: StatusCode %d, ActivityId %q: %v", e.StatusCode, e.ActivityID, e.Err)
}
func (e *ActionsError) Unwrap() error {
@@ -112,7 +112,7 @@ type MessageQueueTokenExpiredError struct {
}
func (e *MessageQueueTokenExpiredError) Error() string {
return fmt.Sprintf("MessageQueueTokenExpiredError: AcivityId %q, StatusCode %d: %s", e.activityID, e.statusCode, e.msg)
return fmt.Sprintf("MessageQueueTokenExpiredError: ActivityId %q, StatusCode %d: %s", e.activityID, e.statusCode, e.msg)
}
type HttpClientSideError struct {
+1 -1
View File
@@ -22,7 +22,7 @@ func TestActionsError(t *testing.T) {
s := err.Error()
assert.Contains(t, s, "StatusCode 404")
assert.Contains(t, s, "AcivityId \"activity-id\"")
assert.Contains(t, s, "ActivityId \"activity-id\"")
assert.Contains(t, s, "example error description")
})
+2 -2
View File
@@ -6,8 +6,8 @@ DIND_ROOTLESS_RUNNER_NAME ?= ${DOCKER_USER}/actions-runner-dind-rootless
OS_IMAGE ?= ubuntu-22.04
TARGETPLATFORM ?= $(shell arch)
RUNNER_VERSION ?= 2.330.0
RUNNER_CONTAINER_HOOKS_VERSION ?= 0.8.0
RUNNER_VERSION ?= 2.331.0
RUNNER_CONTAINER_HOOKS_VERSION ?= 0.8.1
DOCKER_VERSION ?= 28.0.4
# default list of platforms for which multiarch image is built
+2 -2
View File
@@ -1,2 +1,2 @@
RUNNER_VERSION=2.330.0
RUNNER_CONTAINER_HOOKS_VERSION=0.8.0
RUNNER_VERSION=2.331.0
RUNNER_CONTAINER_HOOKS_VERSION=0.8.1
+2 -2
View File
@@ -36,8 +36,8 @@ var (
testResultCMNamePrefix = "test-result-"
RunnerVersion = "2.330.0"
RunnerContainerHooksVersion = "0.8.0"
RunnerVersion = "2.331.0"
RunnerContainerHooksVersion = "0.8.1"
)
// If you're willing to run this test via VS Code "run test" or "debug test",