Skip to content
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

Release #886

Merged
merged 19 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
b1392f2
fix: adjust the window size of the help output
Mar 7, 2023
1b0fd68
chore: Fix typos in code comments
adamdmharvey Mar 10, 2023
817a36e
refactor(test): Enforce camelCase to a test var
adamdmharvey Mar 10, 2023
81b4498
fix(policy): Typo in error message
adamdmharvey Mar 10, 2023
dc43137
feat: add verbose flag for pipeline values
wyardley Mar 8, 2023
651f295
Merge pull request #861 from wyardley/wyardley/860
elliotforbes Mar 23, 2023
3ef1325
Merge remote-tracking branch 'origin/main' into merge-main
JulesFaucherre Mar 23, 2023
667c7b3
Merge pull request #887 from CircleCI-Public/merge-main
abdelDriowya Mar 23, 2023
6271ba1
Merge pull request #862 from threepipes/fix-helpwidth
elliotforbes Mar 23, 2023
f9bb773
Migrates the old calls to the deprecated ioutil package to io and os …
elliotforbes Mar 24, 2023
1d4e972
Merge pull request #889 from CircleCI-Public/updating-deprecated-func…
elliotforbes Mar 24, 2023
62deb45
Merging in from develop
elliotforbes Mar 24, 2023
670cd2d
Adds an editorconfig file to the repo to ensure that all files have n…
elliotforbes Mar 24, 2023
1cbe76c
Merge pull request #867 from adamdmharvey/adamdmharvey/fix-typos
JulesFaucherre Mar 29, 2023
fa5ea62
Update README.md
elliotforbes Mar 29, 2023
6ebbb56
Updated readme
elliotforbes Mar 29, 2023
f660818
Merge pull request #884 from CircleCI-Public/PIPE-2315-code-improvements
elliotforbes Mar 30, 2023
4cfa882
Merge remote-tracking branch 'origin/main' into merge-main
JulesFaucherre Mar 30, 2023
6e5a974
Merge pull request #894 from CircleCI-Public/merge-main
JulesFaucherre Mar 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,10 @@ Development instructions for the CircleCI CLI can be found in [HACKING.md](HACKI
## More

Please see the [documentation](https://circleci-public.github.io/circleci-cli) or `circleci help` for more.


## Version Compatibility

As of version `0.1.24705` - we no longer support Server 3.x instances. In order to upgrade the CLI to the latest version, you'll need to update your instance of server to 4.x.

`0.1.23845` is the last version to support Server 3.x and 2.x.
6 changes: 3 additions & 3 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package api
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -484,9 +484,9 @@ func loadYaml(path string) (string, error) {
var err error
var config []byte
if path == "-" {
config, err = ioutil.ReadAll(os.Stdin)
config, err = io.ReadAll(os.Stdin)
} else {
config, err = ioutil.ReadFile(path)
config, err = os.ReadFile(path)
}

if err != nil {
Expand Down
17 changes: 8 additions & 9 deletions api/context_rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"

Expand Down Expand Up @@ -71,7 +70,7 @@ func (c *ContextRestClient) DeleteEnvironmentVariable(contextID, variable string
return err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return err
Expand Down Expand Up @@ -99,7 +98,7 @@ func (c *ContextRestClient) CreateContextWithOrgID(orgID *string, name string) e
return err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return err
Expand Down Expand Up @@ -131,7 +130,7 @@ func (c *ContextRestClient) CreateContext(vcs, org, name string) error {
return err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return err
Expand Down Expand Up @@ -162,7 +161,7 @@ func (c *ContextRestClient) CreateEnvironmentVariable(contextID, variable, value
return err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return err
Expand Down Expand Up @@ -190,7 +189,7 @@ func (c *ContextRestClient) DeleteContext(contextID string) error {
return err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return err
Expand Down Expand Up @@ -300,7 +299,7 @@ func (c *ContextRestClient) listEnvironmentVariables(params *listEnvironmentVari
return nil, err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
Expand Down Expand Up @@ -334,7 +333,7 @@ func (c *ContextRestClient) listContexts(params *listContextsParams) (*listConte
return nil, err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
Expand Down Expand Up @@ -580,7 +579,7 @@ func (c *ContextRestClient) EnsureExists() error {
return errors.New("API v2 test request failed.")
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions api/context_rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package api

import (
"fmt"
"io/ioutil"
"io"
"net/http"

"github.com/CircleCI-Public/circleci-cli/settings"
Expand Down Expand Up @@ -32,7 +32,7 @@ func appendRESTPostHandler(server *ghttp.Server, combineHandlers ...MockRequestR
ghttp.VerifyRequest("POST", "/api/v2/context"),
ghttp.VerifyContentType("application/json"),
func(w http.ResponseWriter, req *http.Request) {
body, err := ioutil.ReadAll(req.Body)
body, err := io.ReadAll(req.Body)
Expect(err).ShouldNot(HaveOccurred())
err = req.Body.Close()
Expect(err).ShouldNot(HaveOccurred())
Expand Down
6 changes: 3 additions & 3 deletions api/graphql/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"net/url"
Expand Down Expand Up @@ -254,15 +254,15 @@ func (cl *Client) Run(request *Request, resp interface{}) error {
if cl.Debug {
var bodyBytes []byte
if res.Body != nil {
bodyBytes, err = ioutil.ReadAll(res.Body)
bodyBytes, err = io.ReadAll(res.Body)
if err != nil {
return errors.Wrap(err, "reading response")
}

l.Printf("<< %s", string(bodyBytes))

// Restore the io.ReadCloser to its original state
res.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))
res.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
}
}

Expand Down
7 changes: 3 additions & 4 deletions api/graphql/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package graphql

import (
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"regexp"
Expand Down Expand Up @@ -53,7 +52,7 @@ func TestDoJSON(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
calls++

b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
if err != nil {
t.Errorf(err.Error())
}
Expand Down Expand Up @@ -96,7 +95,7 @@ func TestQueryJSON(t *testing.T) {
var calls int
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
calls++
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
if err != nil {
t.Errorf(err.Error())
}
Expand Down Expand Up @@ -146,7 +145,7 @@ func TestDoJSONErr(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, req *http.Request) {
calls++

body, err := ioutil.ReadAll(req.Body)
body, err := io.ReadAll(req.Body)
if err != nil {
t.Errorf(err.Error())
}
Expand Down
3 changes: 1 addition & 2 deletions api/info/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"

Expand Down Expand Up @@ -58,7 +57,7 @@ func (c *InfoRESTClient) GetInfo() (*[]Organization, error) {
return nil, err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions api/rest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import (
)

type Client struct {
baseURL *url.URL
BaseURL *url.URL
circleToken string
client *http.Client
}

func New(baseURL *url.URL, token string, httpClient *http.Client) *Client {
return &Client{
baseURL: baseURL,
BaseURL: baseURL,
circleToken: token,
client: httpClient,
}
Expand Down Expand Up @@ -60,7 +60,7 @@ func (c *Client) NewRequest(method string, u *url.URL, payload interface{}) (req
}
}

req, err = http.NewRequest(method, c.baseURL.ResolveReference(u).String(), r)
req, err = http.NewRequest(method, c.BaseURL.ResolveReference(u).String(), r)
if err != nil {
return nil, err
}
Expand Down
15 changes: 7 additions & 8 deletions api/schedule_rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"

Expand Down Expand Up @@ -49,7 +48,7 @@ func (c *ScheduleRestClient) CreateSchedule(vcs, org, project, name, description
return nil, err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
Expand Down Expand Up @@ -86,7 +85,7 @@ func (c *ScheduleRestClient) UpdateSchedule(scheduleID, name, description string
return nil, err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
Expand Down Expand Up @@ -121,7 +120,7 @@ func (c *ScheduleRestClient) DeleteSchedule(scheduleID string) error {
return err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return err
Expand Down Expand Up @@ -157,7 +156,7 @@ func (c *ScheduleRestClient) ScheduleByID(scheduleID string) (*Schedule, error)
return nil, err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
Expand Down Expand Up @@ -231,7 +230,7 @@ func (c *ScheduleRestClient) listSchedules(vcs, org, project string, params *lis
return nil, err
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
Expand Down Expand Up @@ -375,7 +374,7 @@ func (c *ScheduleRestClient) newDeleteScheduleRequest(scheduleID string) (*http.
return c.newHTTPRequest("DELETE", queryURL.String(), nil)
}

// Builds a requeest to list schedules according to params.
// Builds a request to list schedules according to params.
func (c *ScheduleRestClient) newListSchedulesRequest(vcs, org, project string, params *listSchedulesParams) (*http.Request, error) {
var err error
queryURL, err := url.Parse(c.server)
Expand Down Expand Up @@ -438,7 +437,7 @@ func (c *ScheduleRestClient) EnsureExists() error {
return errors.New("API v2 test request failed.")
}

bodyBytes, err := ioutil.ReadAll(resp.Body)
bodyBytes, err := io.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return err
Expand Down
11 changes: 5 additions & 6 deletions clitest/clitest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -50,7 +49,7 @@ func (tempSettings TempSettings) AssertConfigRereadMatches(contents string) {
file, err := os.Open(tempSettings.Config.Path)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())

reread, err := ioutil.ReadAll(file)
reread, err := io.ReadAll(file)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
gomega.Expect(string(reread)).To(gomega.ContainSubstring(contents))
}
Expand All @@ -61,7 +60,7 @@ func WithTempSettings() *TempSettings {

tempSettings := &TempSettings{}

tempSettings.Home, err = ioutil.TempDir("", "circleci-cli-test-")
tempSettings.Home, err = os.MkdirTemp("", "circleci-cli-test-")
gomega.Expect(err).ToNot(gomega.HaveOccurred())

settingsPath := filepath.Join(tempSettings.Home, ".circleci")
Expand Down Expand Up @@ -101,7 +100,7 @@ func (tempSettings *TempSettings) AppendRESTPostHandler(combineHandlers ...MockR
ghttp.VerifyRequest("POST", "/api/v2/context"),
ghttp.VerifyContentType("application/json"),
func(w http.ResponseWriter, req *http.Request) {
body, err := ioutil.ReadAll(req.Body)
body, err := io.ReadAll(req.Body)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
err = req.Body.Close()
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
Expand Down Expand Up @@ -131,7 +130,7 @@ func (tempSettings *TempSettings) AppendPostHandler(authToken string, combineHan
// VerifyContentType("application/json") check
// that fails with "application/json; charset=utf-8"
func(w http.ResponseWriter, req *http.Request) {
body, err := ioutil.ReadAll(req.Body)
body, err := io.ReadAll(req.Body)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
err = req.Body.Close()
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
Expand All @@ -152,7 +151,7 @@ func (tempSettings *TempSettings) AppendPostHandler(authToken string, combineHan
// VerifyContentType("application/json") check
// that fails with "application/json; charset=utf-8"
func(w http.ResponseWriter, req *http.Request) {
body, err := ioutil.ReadAll(req.Body)
body, err := io.ReadAll(req.Body)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
err = req.Body.Close()
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
Expand Down
Loading