Skip to content

Commit

Permalink
Merge pull request #1022 from CircleCI-Public/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
loderunner authored Dec 11, 2023
2 parents 148495a + 3b60b03 commit 25c735c
Show file tree
Hide file tree
Showing 21 changed files with 519 additions and 800 deletions.
66 changes: 32 additions & 34 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ orbs:
executors:
go:
docker:
- image: cimg/go:1.20
- image: cimg/go:1.21.5
resource_class: large
environment:
CGO_ENABLED: 0
mac:
macos:
xcode: 12.5.1
xcode: 15.1.0
resource_class: macos.m1.medium.gen1
environment:
CGO_ENABLED: 0
HOMEBREW_NO_AUTO_UPDATE: 1
Expand Down Expand Up @@ -92,7 +93,6 @@ jobs:
command: |
export GOBIN=/c/go/bin
export PATH=$GOBIN:$PATH
export TESTING="true"
go install gotest.tools/gotestsum@latest
gotestsum --junitfile test_results/windows.xml
- store_test_results:
Expand All @@ -104,9 +104,9 @@ jobs:
steps:
- checkout
- run: |
brew update
brew install go@1.20
echo 'export PATH="/usr/local/opt/go@1.20/bin:$PATH"' >> ~/.bash_profile
curl -OL https://go.dev/dl/go1.21.5.darwin-arm64.pkg
sudo installer -pkg ./go1.21.5.darwin-arm64.pkg -target /
echo 'export PATH="/usr/local/go/bin:$PATH"' >> ~/.bash_profile
- gomod
- run: make test
build:
Expand Down Expand Up @@ -135,8 +135,6 @@ jobs:
- run:
command: bundle exec cucumber
working_directory: integration_tests
environment:
TESTING: "true"
- run:
name: "Make sure simple command do not cause any timeout"
command: circleci version
Expand Down Expand Up @@ -312,38 +310,38 @@ jobs:
- run:
name: Setup Scanning
command: |
git config --global url."https://$GITHUB_USER:$GITHUB_TOKEN@github.com/circleci/".insteadOf "https://github.com/circleci/"
git config --global url."https://$GITHUB_USER:$GITHUB_TOKEN@github.com/circleci/".insteadOf "https://github.com/circleci/"
- when:
condition:
or:
- equal: [ main, << pipeline.git.branch >> ]
or:
- equal: [main, << pipeline.git.branch >>]
steps:
- run:
name: Launching Snyk Orb Scanning
command: echo "Running snyk/scan on main; uploading the results"
- run:
name: Cleanup RemoteRepoURL
command: echo 'export REMOTE_REPO_URL="${CIRCLE_REPOSITORY_URL%".git"}"' >> "$BASH_ENV"
- snyk/scan:
organization: "circleci-public"
fail-on-issues: true
severity-threshold: high
monitor-on-build: true
additional-arguments: "--all-projects --remote-repo-url=${REMOTE_REPO_URL} -d"
- run:
name: Launching Snyk Orb Scanning
command: echo "Running snyk/scan on main; uploading the results"
- run:
name: Cleanup RemoteRepoURL
command: echo 'export REMOTE_REPO_URL="${CIRCLE_REPOSITORY_URL%".git"}"' >> "$BASH_ENV"
- snyk/scan:
organization: "circleci-public"
fail-on-issues: true
severity-threshold: high
monitor-on-build: true
additional-arguments: "--all-projects --remote-repo-url=${REMOTE_REPO_URL} -d"
- unless:
condition:
or:
- equal: [ main, << pipeline.git.branch >> ]
or:
- equal: [main, << pipeline.git.branch >>]
steps:
- run:
name: Launching Snyk Orb Scanning
command: echo "Running snyk/scan on branch; not uploading the results"
- snyk/scan:
organization: "circleci-public"
fail-on-issues: true
severity-threshold: high
monitor-on-build: false
additional-arguments: "--all-projects -d"
- run:
name: Launching Snyk Orb Scanning
command: echo "Running snyk/scan on branch; not uploading the results"
- snyk/scan:
organization: "circleci-public"
fail-on-issues: true
severity-threshold: high
monitor-on-build: false
additional-arguments: "--all-projects -d"

workflows:
ci:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ clean:

.PHONY: test
test:
TESTING=true go test -v ./...
go test -v ./...

.PHONY: cover
cover:
TESTING=true go test -race -coverprofile=coverage.txt ./...
go test -race -coverprofile=coverage.txt ./...

.PHONY: lint
lint:
Expand Down
6 changes: 3 additions & 3 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3'
version: "3"

tasks:
lint:
Expand All @@ -21,7 +21,7 @@ tasks:
test:
desc: Run the tests
cmds:
- TESTING=true go test -v ./...
- go test -v ./...

tidy:
desc: Run 'go mod tidy' to clean up module files.
Expand Down Expand Up @@ -59,4 +59,4 @@ tasks:
cover:
desc: tests and generates a cover profile
cmds:
- TESTING=true go test -race -coverprofile=coverage.txt ./...
- go test -race -coverprofile=coverage.txt ./...
Empty file added cmd/.circleci/cli.yml
Empty file.
4 changes: 4 additions & 0 deletions cmd/.circleci/telemetry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
is_enabled: false
has_answered_prompt: true
unique_id: 56958553-1d1e-45e2-821e-ddcb6372f656
user_id: ""
1 change: 1 addition & 0 deletions cmd/.circleci/update_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
last_update_check: 2023-12-11T13:24:04.24843+01:00
1 change: 1 addition & 0 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func newLocalExecuteCommand(config *settings.Config) *cobra.Command {
buildCommand.Flags().String("build-agent-version", "", `The version of the build agent image you want to use. This can be configured by writing in $HOME/.circleci/build_agent_settings.json: '{"LatestSha256":"<version-of-build-agent>"}'`)
buildCommand.Flags().StringP("org-slug", "o", "", "organization slug (for example: github/example-org), used when a config depends on private orbs belonging to that org")
buildCommand.Flags().String("org-id", "", "organization id, used when a config depends on private orbs belonging to that org")
buildCommand.Flags().String("temp-dir", "", "path to local directory to store temporary config files")

return buildCommand
}
Expand Down
1 change: 0 additions & 1 deletion cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func checkForUpdates(opts *settings.Config) error {
spr.Start()

check, err := update.CheckForUpdates(opts.GitHubAPI, slug, version.Version, version.PackageManager())

if err != nil {
spr.Stop()
return err
Expand Down
20 changes: 3 additions & 17 deletions cmd/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd_test
import (
"net/http"
"os/exec"
"runtime"
"time"

"github.com/CircleCI-Public/circleci-cli/clitest"
Expand Down Expand Up @@ -70,21 +71,7 @@ var _ = Describe("Check", func() {
"assets": [
{
"id": 1,
"name": "linux_amd64.zip",
"label": "short description",
"content_type": "application/zip",
"size": 1024
},
{
"id": 1,
"name": "darwin_amd64.tar.gz",
"label": "short description",
"content_type": "application/zip",
"size": 1024
},
{
"id": 1,
"name": "windows_amd64.tar.gz",
"name": "` + runtime.GOOS + "_" + runtime.GOARCH + `.zip",
"label": "short description",
"content_type": "application/zip",
"size": 1024
Expand All @@ -96,11 +83,10 @@ var _ = Describe("Check", func() {

tempSettings.TestServer.AppendHandlers(
ghttp.CombineHandlers(
ghttp.VerifyRequest(http.MethodGet, "/repos/CircleCI-Public/circleci-cli/releases"),
ghttp.VerifyRequest(http.MethodGet, "/api/v3/repos/CircleCI-Public/circleci-cli/releases"),
ghttp.RespondWith(http.StatusOK, response),
),
)

})

Context("using a binary release", func() {
Expand Down
7 changes: 5 additions & 2 deletions cmd/orb.go
Original file line number Diff line number Diff line change
Expand Up @@ -1286,8 +1286,8 @@ func initOrb(opts orbOptions) error {
if !useDefaultVcs {
vcsSelect := "github"
prompt = &survey.Select{
Message: "Are you using GitHub or Bitbucket?",
Options: []string{"GitHub", "Bitbucket"},
Message: "Are you using GitHub or Bitbucket or GitHub app (if GH App use circleci as the entry)?",
Options: []string{"GitHub", "Bitbucket", "circleci"},
}
err = survey.AskOne(prompt, &vcsSelect)
if err != nil {
Expand Down Expand Up @@ -1522,6 +1522,9 @@ func initOrb(opts orbOptions) error {
}

r, err := git.PlainInit(orbPath, false)
if errors.Is(err, git.ErrRepositoryAlreadyExists) {
return errors.New("the folder is already a repository because it has .git folder. Try deleting it and retrying")
}
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit 25c735c

Please sign in to comment.