Skip to content

Commit

Permalink
Merge branch 'master' into openshift_4_16_common
Browse files Browse the repository at this point in the history
  • Loading branch information
ranakan19 authored Jan 17, 2025
2 parents 9c6116d + 023bcb9 commit c911683
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.52.0
version: v1.63.1
skip-pkg-cache: true
skip-build-cache: true
args: --config=./.golangci.yml --verbose
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,14 @@ require (
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4=
golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4=
Expand Down
6 changes: 5 additions & 1 deletion make/go.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ vet:
.PHONY: verify-replace-run
## downloads all the repos that depend on toolchain-common, installs the current version of the library and runs all the verifications in order to check for compatibility and breaking changes
verify-replace-run:
./scripts/verify-replace.sh;
./scripts/verify-replace.sh;

.PHONY: pre-verify
pre-verify:
echo "No Pre-requisite needed"
2 changes: 1 addition & 1 deletion pkg/status/componentconditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func ValidateComponentConditionReady(conditions ...toolchainv1alpha1.Condition)
if !found {
return fmt.Errorf("a ready condition was not found")
} else if c.Status != corev1.ConditionTrue {
return fmt.Errorf(c.Message) // return an error with the message from the condition
return fmt.Errorf("%s", c.Message) // return an error with the message from the condition
}

return nil
Expand Down
48 changes: 41 additions & 7 deletions pkg/test/usersignup/usersignup.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,29 @@ func WithAccountID(accountID string) Modifier {
}
}

// ApprovedManually sets the UserSignup states to [`approved`]
func ApprovedManually() Modifier {
// ApprovedManuallyAgo sets the UserSignup state to `approved` and adds a status condition
func ApprovedManuallyAgo(before time.Duration) Modifier {
return func(userSignup *toolchainv1alpha1.UserSignup) {
states.SetApprovedManually(userSignup, true)
userSignup.Status.Conditions = condition.AddStatusConditions(userSignup.Status.Conditions,
toolchainv1alpha1.Condition{
Type: toolchainv1alpha1.UserSignupApproved,
Status: corev1.ConditionTrue,
Reason: toolchainv1alpha1.UserSignupApprovedByAdminReason,
LastTransitionTime: metav1.Time{Time: time.Now().Add(-before)},
})
}
}

// ApprovedManuallyAgo sets the UserSignup state to `approved` and adds a status condition
func ApprovedManuallyAgo(before time.Duration) Modifier {
// ApprovedAutomaticallyAgo sets the UserSignup state to `approved` and adds a status condition
func ApprovedAutomaticallyAgo(before time.Duration) Modifier {
return func(userSignup *toolchainv1alpha1.UserSignup) {
states.SetApprovedManually(userSignup, true)
userSignup.Status.Conditions = condition.AddStatusConditions(userSignup.Status.Conditions,
toolchainv1alpha1.Condition{
Type: toolchainv1alpha1.UserSignupApproved,
Status: corev1.ConditionTrue,
Reason: toolchainv1alpha1.UserSignupApprovedByAdminReason,
Reason: toolchainv1alpha1.UserSignupApprovedAutomaticallyReason,
LastTransitionTime: metav1.Time{Time: time.Now().Add(-before)},
})
}
Expand All @@ -66,7 +73,21 @@ func Deactivated() Modifier {
}
}

func DeactivatedWithLastTransitionTime(before time.Duration) Modifier {
func VerificationRequired() Modifier {
return func(userSignup *toolchainv1alpha1.UserSignup) {
states.SetVerificationRequired(userSignup, true)
}
}

// ApprovedManually sets the UserSignup states to [`approved`]
func ApprovedManually() Modifier {
return func(userSignup *toolchainv1alpha1.UserSignup) {
states.SetApprovedManually(userSignup, true)
}
}

// DeactivatedAgo sets the UserSignup states to [`deactivated`] and adds a status condition
func DeactivatedAgo(before time.Duration) Modifier {
return func(userSignup *toolchainv1alpha1.UserSignup) {
states.SetDeactivated(userSignup, true)

Expand All @@ -81,7 +102,20 @@ func DeactivatedWithLastTransitionTime(before time.Duration) Modifier {
}
}

func VerificationRequired(before time.Duration) Modifier {
// BannedAgo adds the banned status condition
func BannedAgo(before time.Duration) Modifier {
return func(userSignup *toolchainv1alpha1.UserSignup) {
userSignup.Status.Conditions = condition.AddStatusConditions(userSignup.Status.Conditions,
toolchainv1alpha1.Condition{
Type: toolchainv1alpha1.UserSignupComplete,
Status: corev1.ConditionTrue,
Reason: toolchainv1alpha1.UserSignupUserBannedReason,
LastTransitionTime: metav1.Time{Time: time.Now().Add(-before)},
})
}
}

func VerificationRequiredAgo(before time.Duration) Modifier {
return func(userSignup *toolchainv1alpha1.UserSignup) {
states.SetVerificationRequired(userSignup, true)

Expand Down

0 comments on commit c911683

Please sign in to comment.