Skip to content

Commit 636da77

Browse files
authored
Merge pull request #1002 from CircleCI-Public/develop
Release
2 parents 663eda4 + a516872 commit 636da77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+90
-2346
lines changed

.circleci/config.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ jobs:
137137
working_directory: integration_tests
138138
environment:
139139
TESTING: "true"
140-
- run:
141-
name: "Make sure simple command do not cause any timeout"
142-
command: circleci version
143-
144140
test:
145141
executor: go
146142
steps:
@@ -382,14 +378,12 @@ workflows:
382378
- devex-release
383379
- deploy:
384380
requires:
385-
- cucumber
386381
- test
387382
- test_mac
388383
- coverage
389384
- lint
390385
- deploy-test
391386
- shellcheck/check
392-
- vulnerability-scan
393387
filters:
394388
branches:
395389
only: main

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ GOOS=$(shell go env GOOS)
44
GOARCH=$(shell go env GOARCH)
55

66
build: always
7-
go build -o build/$(GOOS)/$(GOARCH)/circleci -ldflags='-X github.com/CircleCI-Public/circleci-cli/telemetry.SegmentEndpoint=https://api.segment.io'
7+
go build -o build/$(GOOS)/$(GOARCH)/circleci
88

99
build-all: build/linux/amd64/circleci build/darwin/amd64/circleci
1010

README.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,6 @@ Please see the [documentation](https://circleci-public.github.io/circleci-cli) o
180180

181181
## Server compatibility
182182

183-
| Functionality | Impacted commands | Change description | Compatibility with Server |
184-
| --- | --- | --- | --- |
185-
| Config compilation and validation | <ul><li>`circleci config validate`</li><li>`circleci config process`</li><li>`circleci local execute`</li> | The config validation has been moved from the GraphQL API to a specific API endpoint | <ul><li>**Server v4.0.5, v4.1.3, v4.2.0 and above**: Commands use the new specific endpoint</li><li>**Previous version**: Commands use the GraphQL API</li></ul> |
186-
| Orb compilation and validation of orb using private orbs | <ul><li>`circleci orb process`</li><li>`circleci orb validate`</li></ul> | To support the validation of orbs requesting private orbs (see [issue](https://github.com/CircleCI-Public/circleci-cli/issues/751)). A field `ownerId` has been added to the GraphQL orb validation endpoint. Thus allowing the `Impacted commands` to use the `--org-id` parameter to enable the orb compilation / validation | <ul><li>**Server v4.2.0 and above**: The field is accessible so you can use the parameter</li><li>**Previous versions**: The field does not exist making the functionality unavailable</li></ul> |
187-
188-
## Telemetry
189-
190-
The CircleCI CLI includes a telemetry feature that collects basic errors and feature usage data in order to help us improve the experience for everyone.
191-
192-
Telemetry works on an opt-in basis: when running a command for the first time, you will be asked for consent to enable telemetry. For non-TTY STDIN, telemetry is disabled by default, ensuring that scripts that use the CLI run smoothly.
193-
194-
You can disable or enable telemetry anytime in one of the following ways:
195-
196-
* Run the commands `circleci telemetry enable` or `circleci telemetry disable`
197-
198-
* Set the `CIRCLECI_CLI_TELEMETRY_OPTOUT` environment variable to `1` or `true` to disable it
199-
183+
There are some difference of behavior depending on the version you use:
184+
- config validation will use the GraphQL API until **Server v4.0.5, v4.1.3, v4.2.0**. The above versions will use the new route `compile-config-with-defaults`
185+
- `circleci orb validate` will only allow you to validate orbs using other private orbs with the option `--org-slug` from version **Server v4.2.0**

Taskfile.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,14 @@ tasks:
4747
build:
4848
desc: Build main
4949
cmds:
50-
# LDFlags sets the segment endpoint to an empty string thus letting the analytics library set the default endpoint on its own
51-
# Not setting the `SegmentEndpoint` variable would let the value in the code ie "http://localhost"
52-
- go build -v -o build/$(go env GOOS)/$(go env GOARCH)/circleci -ldflags='-X github.com/CircleCI-Public/circleci-cli/telemetry.SegmentEndpoint=https://api.segment.io' .
53-
50+
- go build -v -o build/darwin/amd64/circleci .
51+
5452
build-linux:
5553
desc: Build main
5654
cmds:
5755
- go build -v -o build/linux/amd64/circleci .
58-
56+
5957
cover:
6058
desc: tests and generates a cover profile
6159
cmds:
62-
- TESTING=true go test -race -coverprofile=coverage.txt ./...
60+
- TESTING=true go test -race -coverprofile=coverage.txt ./...

api/api.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ import (
66
"io"
77
"log"
88
"net/http"
9-
"net/url"
109
"os"
1110
"sort"
1211
"strings"
1312

1413
"github.com/CircleCI-Public/circleci-cli/api/graphql"
15-
"github.com/CircleCI-Public/circleci-cli/api/rest"
1614
"github.com/CircleCI-Public/circleci-cli/references"
1715
"github.com/CircleCI-Public/circleci-cli/settings"
1816
"github.com/Masterminds/semver"
@@ -1820,20 +1818,3 @@ func FollowProject(config settings.Config, vcs string, owner string, projectName
18201818

18211819
return fr, nil
18221820
}
1823-
1824-
type Me struct {
1825-
ID string `json:"id"`
1826-
Login string `json:"login"`
1827-
Name string `json:"name"`
1828-
}
1829-
1830-
func GetMe(client *rest.Client) (Me, error) {
1831-
req, err := client.NewRequest("GET", &url.URL{Path: "me"}, nil)
1832-
if err != nil {
1833-
return Me{}, errors.Wrap(err, "Unable to get user info")
1834-
}
1835-
1836-
var me Me
1837-
_, err = client.DoRequest(req, &me)
1838-
return me, err
1839-
}

clitest/clitest.go

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ import (
1111
"runtime"
1212

1313
"github.com/CircleCI-Public/circleci-cli/api/graphql"
14-
"github.com/CircleCI-Public/circleci-cli/settings"
1514
"github.com/onsi/gomega/gexec"
1615
"github.com/onsi/gomega/ghttp"
1716
"github.com/onsi/gomega/types"
18-
"gopkg.in/yaml.v3"
1917

2018
"github.com/onsi/gomega"
2119
)
@@ -32,12 +30,10 @@ func ShouldFail() types.GomegaMatcher {
3230

3331
// TempSettings contains useful settings for testing the CLI
3432
type TempSettings struct {
35-
Home string
36-
TestServer *ghttp.Server
37-
Config *TmpFile
38-
Update *TmpFile
39-
Telemetry *TmpFile
40-
TelemetryDestPath string
33+
Home string
34+
TestServer *ghttp.Server
35+
Config *TmpFile
36+
Update *TmpFile
4137
}
4238

4339
// Close should be called in an AfterEach and cleans up the temp directory and server process
@@ -72,16 +68,6 @@ func WithTempSettings() *TempSettings {
7268
gomega.Expect(os.Mkdir(settingsPath, 0700)).To(gomega.Succeed())
7369

7470
tempSettings.Config = OpenTmpFile(settingsPath, "cli.yml")
75-
tempSettings.Telemetry = OpenTmpFile(settingsPath, "telemetry.yml")
76-
content, err := yaml.Marshal(settings.TelemetrySettings{
77-
IsEnabled: false,
78-
HasAnsweredPrompt: true,
79-
})
80-
gomega.Expect(err).ToNot(gomega.HaveOccurred())
81-
_, err = tempSettings.Telemetry.File.Write(content)
82-
gomega.Expect(err).ToNot(gomega.HaveOccurred())
83-
tempSettings.TelemetryDestPath = filepath.Join(tempSettings.Home, "telemetry-content")
84-
8571
tempSettings.Update = OpenTmpFile(settingsPath, "update_check.yml")
8672

8773
tempSettings.TestServer = ghttp.NewServer()

clitest/telemetry.go

Lines changed: 0 additions & 19 deletions
This file was deleted.

cmd/build.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package cmd
33
import (
44
"github.com/CircleCI-Public/circleci-cli/local"
55
"github.com/CircleCI-Public/circleci-cli/settings"
6-
"github.com/CircleCI-Public/circleci-cli/telemetry"
76
"github.com/spf13/cobra"
87
)
98

@@ -17,14 +16,7 @@ func newLocalExecuteCommand(config *settings.Config) *cobra.Command {
1716
return nil
1817
},
1918
RunE: func(cmd *cobra.Command, _ []string) error {
20-
err := local.Execute(cmd.Flags(), config, args)
21-
22-
telemetryClient, ok := telemetry.FromContext(cmd.Context())
23-
if ok {
24-
_ = telemetryClient.Track(telemetry.CreateLocalExecuteEvent(telemetry.GetCommandInformation(cmd, true)))
25-
}
26-
27-
return err
19+
return local.Execute(cmd.Flags(), config, args)
2820
},
2921
Args: cobra.MinimumNArgs(1),
3022
}

cmd/cmd_suite_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"os"
66
"os/exec"
77
"testing"
8-
"time"
98

109
. "github.com/onsi/ginkgo"
1110
. "github.com/onsi/gomega"
@@ -15,8 +14,6 @@ import (
1514
var pathCLI string
1615

1716
var _ = BeforeSuite(func() {
18-
SetDefaultEventuallyTimeout(time.Second * 30)
19-
2017
var err error
2118
pathCLI, err = gexec.Build("github.com/CircleCI-Public/circleci-cli")
2219
Ω(err).ShouldNot(HaveOccurred())

cmd/completion.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,13 @@ package cmd
33
import (
44
"os"
55

6-
"github.com/CircleCI-Public/circleci-cli/settings"
7-
"github.com/CircleCI-Public/circleci-cli/telemetry"
86
"github.com/spf13/cobra"
97
)
108

11-
func newCompletionCommand(config *settings.Config) *cobra.Command {
9+
func newCompletionCommand() *cobra.Command {
1210
completionCmd := &cobra.Command{
1311
Use: "completion",
1412
Short: "Generate shell completion scripts",
15-
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
16-
telemetryClient, ok := telemetry.FromContext(cmd.Context())
17-
if ok {
18-
_ = telemetryClient.Track(telemetry.CreateCompletionCommand(telemetry.GetCommandInformation(cmd, true)))
19-
}
20-
},
2113
Run: func(cmd *cobra.Command, _ []string) {
2214
err := cmd.Help()
2315
if err != nil {

0 commit comments

Comments
 (0)