From ff6dbead37814cde967d5cbe2b45e4644ee630e6 Mon Sep 17 00:00:00 2001 From: Bruce MacDonald Date: Mon, 9 Aug 2021 16:03:17 -0700 Subject: [PATCH] Remove out of date helm version release doc --- docs/contributing.md | 15 +++------------ internal/registry/config.go | 14 +++++++------- internal/registry/config_test.go | 2 +- internal/registry/grpc_test.go | 7 ------- 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index 3a2e262bf3..390dd25f66 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -67,16 +67,7 @@ make test ## Releasing a new version of Infra -### 1. Bump Helm versions - -First, bump both the chart and app versions in `helm`: - -* https://github.com/infrahq/infra/blob/main/helm/charts/infra/Chart.yaml -* https://github.com/infrahq/infra/blob/main/helm/charts/infra/charts/engine/Chart.yaml - -Then, commit these changes and push them to the `main` branch (or create a PR). - -### 2. Create a release on GitHub, marked as pre-release +### 1. Create a release on GitHub, marked as pre-release 1. Head over to https://github.com/infrahq/infra/releases and click **Draft a new Release** 2. Fill out the form with the new version as the tag and release name as shown below: @@ -87,11 +78,11 @@ Then, commit these changes and push them to the `main` branch (or create a PR). A new version of Infra will be prepared and released via GitHub actions. -### 3. Verify release +### 2. Verify release Verify the [release job](https://github.com/infrahq/infra/actions/workflows/release.yml) succeeded. -### 4. Mark as released +### 3. Mark as released 1. Navigate back to https://github.com/infrahq/infra/releases and click on your release. 2. Uncheck **This is a pre-release** diff --git a/internal/registry/config.go b/internal/registry/config.go index 96692cd4f1..824e9834c0 100644 --- a/internal/registry/config.go +++ b/internal/registry/config.go @@ -139,14 +139,14 @@ func ApplyUserMapping(db *gorm.DB, users []ConfigUserMapping) ([]string, error) for _, u := range users { var user User - err := db.Where(&User{Email: u.Name}).First(&user).Error - if err != nil { - if errors.Is(err, gorm.ErrRecordNotFound) { + usrReadErr := db.Where(&User{Email: u.Name}).First(&user).Error + if usrReadErr != nil { + if errors.Is(usrReadErr, gorm.ErrRecordNotFound) { // skip this user, if they're created these roles will be added later logging.L.Debug("skipping user in config import that has not yet been provisioned") continue } - return nil, err + return nil, usrReadErr } // add the user to groups @@ -155,14 +155,14 @@ func ApplyUserMapping(db *gorm.DB, users []ConfigUserMapping) ([]string, error) var group Group grpReadErr := db.Where(&Group{Name: gName}).First(&group).Error if grpReadErr != nil { - if errors.Is(err, gorm.ErrRecordNotFound) { + if errors.Is(grpReadErr, gorm.ErrRecordNotFound) { logging.L.Debug("skipping unknown group \"" + gName + "\" on user") continue } return nil, grpReadErr } if db.Model(&user).Where(&Group{Id: group.Id}).Association("Groups").Count() == 0 { - if err = db.Model(&user).Where(&Group{Id: group.Id}).Association("Groups").Append(&group); err != nil { + if err := db.Model(&user).Where(&Group{Id: group.Id}).Association("Groups").Append(&group); err != nil { return nil, err } } @@ -194,7 +194,7 @@ func ImportMappings(db *gorm.DB, groups []ConfigGroupMapping, users []ConfigUser return err } // clean up existing groups which have been removed from the config - err = db.Where("1 = 1").Not(grpIdsToKeep).Delete(Group{}).Error + err = db.Not(grpIdsToKeep).Delete(Group{}).Error if err != nil { return err } diff --git a/internal/registry/config_test.go b/internal/registry/config_test.go index 31cfccda28..849a187f8a 100644 --- a/internal/registry/config_test.go +++ b/internal/registry/config_test.go @@ -60,7 +60,7 @@ func setup() error { func TestMain(m *testing.M) { err := setup() if err != nil { - fmt.Println("Could not initialize test data") + fmt.Println("Could not initialize test data: ", err) os.Exit(1) } code := m.Run() diff --git a/internal/registry/grpc_test.go b/internal/registry/grpc_test.go index 5e7a6d0821..76ca87005d 100644 --- a/internal/registry/grpc_test.go +++ b/internal/registry/grpc_test.go @@ -3,7 +3,6 @@ package registry import ( "context" "errors" - "fmt" "strings" "testing" @@ -652,12 +651,6 @@ func TestListRolesForClusterReturnsRolesFromConfig(t *testing.T) { returnedUserRoles[r.Name] = r.Users } - for k, vs := range returnedUserRoles { - fmt.Println(k + ": ") - fmt.Println(vs) - fmt.Println() - } - // check default roles granted on user create assert.Equal(t, 3, len(returnedUserRoles["view"])) assert.True(t, containsUser(returnedUserRoles["view"], iosDevUser.Email))