Repository: helm/helm
Pull request #8787 (2020-09-22 03:00:12)

Update go version to 1.14 in go.mod
Signed-off-by: lemonli <liwenjun0323@gmail.com>

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. Make sure to read the Contributing Guide before submitting your PR: https://github.com/helm/helm/blob/master/CONTRIBUTING.md
2. If this PR closes another issue, add 'closes #<issue number>' somewhere in the PR summary. GitHub will automatically close that issue when this PR gets merged. Alternatively, adding 'refs #<issue number>' will not close the issue, but help provide the reviewer more context.-->

**What this PR does / why we need it**:
Issue #8774 

**Special notes for your reviewer**:

**If applicable**:
- [ ] this PR contains documentation
- [ ] this PR contains unit tests
- [ ] this PR has been tested for backwards compatibility



Patch:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ac88d13f2..a8028dd01 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -232,9 +232,8 @@ Like any good open source project, we use Pull Requests (PRs) to track code chan
 3. Assigning reviews
     - Once a review has the `awaiting review` label, maintainers will review them as schedule
       permits. The maintainer who takes the issue should self-request a review.
-    - PRs from a community member with the label `size/S` or larger requires 2 review approvals from
-      maintainers before it can be merged. Those with `size/XS` are per the judgement of the
-      maintainers.
+    - Any PR with the `size/large` label requires 2 review approvals from maintainers before it can
+      be merged. Those with `size/medium` or `size/small` are per the judgement of the maintainers.
 4. Reviewing/Discussion
     - All reviews will be completed using Github review tool.
     - A "Comment" review should be used when there are questions about the code that should be
@@ -314,16 +313,15 @@ makes 30 lines of changes in 1 file, but it changes key functionality, it will l
 feature, but requires another 150 lines of tests to cover all cases, could be labeled as `size/S`
 even though the number of lines is greater than defined below.
 
-Any changes from the community labeled as `size/S` or larger should be thoroughly tested before
-merging and always requires approval from 2 core maintainers. PRs submitted by a core maintainer,
-regardless of size, only requires approval from one additional maintainer. This ensures there are at
-least two maintainers who are aware of any significant PRs introduced to the codebase.
+PRs submitted by a core maintainer, regardless of size, only requires approval from one additional
+maintainer. This ensures there are at least two maintainers who are aware of any significant PRs
+introduced to the codebase.
 
 | Label | Description |
 | ----- | ----------- |
 | `size/XS` | Denotes a PR that changes 0-9 lines, ignoring generated files. Very little testing may be required depending on the change. |
 | `size/S` | Denotes a PR that changes 10-29 lines, ignoring generated files. Only small amounts of manual testing may be required. |
 | `size/M` | Denotes a PR that changes 30-99 lines, ignoring generated files. Manual validation should be required. |
-| `size/L` | Denotes a PR that changes 100-499 lines, ignoring generated files. |
-| `size/XL` | Denotes a PR that changes 500-999 lines, ignoring generated files. |
-| `size/XXL` | Denotes a PR that changes 1000+ lines, ignoring generated files. |
+| `size/L` | Denotes a PR that changes 100-499 lines, ignoring generated files. This should be thoroughly tested before merging and always requires 2 approvals. |
+| `size/XL` | Denotes a PR that changes 500-999 lines, ignoring generated files. This should be thoroughly tested before merging and always requires 2 approvals. |
+| `size/XXL` | Denotes a PR that changes 1000+ lines, ignoring generated files. This should be thoroughly tested before merging and always requires 2 approvals. |
diff --git a/cmd/helm/repo_add.go b/cmd/helm/repo_add.go
index f79c213c0..1c2162bfa 100644
--- a/cmd/helm/repo_add.go
+++ b/cmd/helm/repo_add.go
@@ -116,6 +116,11 @@ func (o *repoAddOptions) run(out io.Writer) error {
 		return err
 	}
 
+	// If the repo exists and --force-update was not specified, error out.
+	if !o.forceUpdate && f.Has(o.name) {
+		return errors.Errorf("repository name (%s) already exists, please specify a different name", o.name)
+	}
+
 	if o.username != "" && o.password == "" {
 		fd := int(os.Stdin.Fd())
 		fmt.Fprint(out, "Password: ")
@@ -138,23 +143,6 @@ func (o *repoAddOptions) run(out io.Writer) error {
 		InsecureSkipTLSverify: o.insecureSkipTLSverify,
 	}
 
-	// If the repo exists do one of two things:
-	// 1. If the configuration for the name is the same continue without error
-	// 2. When the config is different require --force-update
-	if !o.forceUpdate && f.Has(o.name) {
-		existing := f.Get(o.name)
-		if c != *existing {
-
-			// The input coming in for the name is different from what is already
-			// configured. Return an error.
-			return errors.Errorf("repository name (%s) already exists, please specify a different name", o.name)
-		}
-
-		// The add is idempotent so do nothing
-		fmt.Fprintf(out, "%q already exists with the same configuration, skipping\n", o.name)
-		return nil
-	}
-
 	r, err := repo.NewChartRepository(&c, getter.All(settings))
 	if err != nil {
 		return err
diff --git a/go.mod b/go.mod
index 4b7c90f9d..0ebb377b0 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
 module helm.sh/helm/v3
 
-go 1.13
+go 1.14
 
 require (
 	github.com/BurntSushi/toml v0.3.1


Test patch:
diff --git a/cmd/helm/repo_add_test.go b/cmd/helm/repo_add_test.go
index f3bc54985..d358ad970 100644
--- a/cmd/helm/repo_add_test.go
+++ b/cmd/helm/repo_add_test.go
@@ -40,38 +40,14 @@ func TestRepoAddCmd(t *testing.T) {
 	}
 	defer srv.Stop()
 
-	// A second test server is setup to verify URL changing
-	srv2, err := repotest.NewTempServerWithCleanup(t, "testdata/testserver/*.*")
-	if err != nil {
-		t.Fatal(err)
-	}
-	defer srv2.Stop()
-
 	tmpdir := ensure.TempDir(t)
 	repoFile := filepath.Join(tmpdir, "repositories.yaml")
 
-	tests := []cmdTestCase{
-		{
-			name:   "add a repository",
-			cmd:    fmt.Sprintf("repo add test-name %s --repository-config %s --repository-cache %s", srv.URL(), repoFile, tmpdir),
-			golden: "output/repo-add.txt",
-		},
-		{
-			name:   "add repository second time",
-			cmd:    fmt.Sprintf("repo add test-name %s --repository-config %s --repository-cache %s", srv.URL(), repoFile, tmpdir),
-			golden: "output/repo-add2.txt",
-		},
-		{
-			name:      "add repository different url",
-			cmd:       fmt.Sprintf("repo add test-name %s --repository-config %s --repository-cache %s", srv2.URL(), repoFile, tmpdir),
-			wantError: true,
-		},
-		{
-			name:   "add repository second time",
-			cmd:    fmt.Sprintf("repo add test-name %s --repository-config %s --repository-cache %s --force-update", srv2.URL(), repoFile, tmpdir),
-			golden: "output/repo-add.txt",
-		},
-	}
+	tests := []cmdTestCase{{
+		name:   "add a repository",
+		cmd:    fmt.Sprintf("repo add test-name %s --repository-config %s --repository-cache %s", srv.URL(), repoFile, tmpdir),
+		golden: "output/repo-add.txt",
+	}}
 
 	runTestCmd(t, tests)
 }
diff --git a/cmd/helm/testdata/output/repo-add2.txt b/cmd/helm/testdata/output/repo-add2.txt
deleted file mode 100644
index 263ffa9e4..000000000
--- a/cmd/helm/testdata/output/repo-add2.txt
+++ /dev/null
@@ -1,1 +0,0 @@
-"test-name" already exists with the same configuration, skipping