Skip to content

Commit 83956f7

Browse files
author
JulesFaucherre
authored
Merge pull request #986 from CircleCI-Public/develop
Release
2 parents 5523658 + 4afe3de commit 83956f7

File tree

8 files changed

+77
-35
lines changed

8 files changed

+77
-35
lines changed

.circleci/config.yml

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ version: 2.1
22

33
orbs:
44
shellcheck: circleci/shellcheck@1.2.0
5+
snyk: snyk/snyk@1.7.0
56
windows: circleci/windows@5.0.0
67

78
executors:
89
go:
910
docker:
1011
- image: cimg/go:1.20
12+
resource_class: large
1113
environment:
1214
CGO_ENABLED: 0
1315
mac:
@@ -25,7 +27,7 @@ commands:
2527
# https://app.circleci.com/jobs/github/CircleCI-Public/circleci-cli/6480
2628
# curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
2729
# The issue seems to be on the server-side, so force HTTP 1.1
28-
name: 'cURL: Force HTTP 1.1'
30+
name: "cURL: Force HTTP 1.1"
2931
command: echo '--http1.1' >> ~/.curlrc
3032
build-docker-image:
3133
steps:
@@ -41,36 +43,31 @@ commands:
4143
command: |
4244
docker build -t circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine --file Dockerfile.alpine .
4345
docker run --rm circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine update check
44-
deploy-save-cache-workspace-and-artifacts:
46+
deploy-save-workspace-and-artifacts:
4547
steps:
46-
- save_cache:
47-
key: v4-goreleaser-{{ checksum "~/goreleaser_amd64.deb" }}
48-
paths: [~/goreleaser_amd64.deb]
4948
- persist_to_workspace:
5049
root: .
5150
paths:
52-
- 'dist'
51+
- "dist"
5352
- store_artifacts:
5453
path: ./dist
5554
destination: dist
5655
install-goreleaser:
5756
parameters:
58-
GORELEASER_URL:
57+
version:
5958
type: string
60-
default: https://github.com/goreleaser/goreleaser/releases/download/v0.184.0/goreleaser_amd64.deb
59+
default: "1.19.1"
6160
steps:
62-
- restore_cache:
63-
keys: [v5-goreleaser-]
6461
- run:
6562
name: Install GoReleaser
6663
command: |
67-
[ -f ~/goreleaser_amd64.deb ] || curl --silent --location --fail --retry 3 << parameters.GORELEASER_URL >> > ~/goreleaser_amd64.deb
68-
sudo apt-get update -y
69-
sudo apt install ~/goreleaser_amd64.deb
64+
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
65+
sudo apt -q update -y
66+
sudo apt -q install -y --no-install-recommends goreleaser=<< parameters.version >>
7067
gomod:
7168
steps:
7269
- restore_cache:
73-
keys: ['v3-gomod-{{ arch }}-']
70+
keys: ["v3-gomod-{{ arch }}-"]
7471
- run:
7572
name: Download go module dependencies
7673
command: go mod download
@@ -121,7 +118,7 @@ jobs:
121118
- persist_to_workspace:
122119
root: .
123120
paths:
124-
- 'build'
121+
- "build"
125122
cucumber:
126123
docker:
127124
- image: cimg/ruby:2.7
@@ -130,7 +127,7 @@ jobs:
130127
- attach_workspace:
131128
at: .
132129
- run:
133-
name: 'Install CLI tool from workspace'
130+
name: "Install CLI tool from workspace"
134131
command: sudo cp ~/project/build/linux/amd64/circleci /usr/local/bin/
135132
- run:
136133
command: bundle install
@@ -209,7 +206,7 @@ jobs:
209206
docker_layer_caching: true
210207
- build-docker-image
211208
- build-alpine-image
212-
- deploy-save-cache-workspace-and-artifacts
209+
- deploy-save-workspace-and-artifacts
213210

214211
deploy:
215212
executor: go
@@ -246,7 +243,7 @@ jobs:
246243
docker push circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine
247244
docker tag circleci/circleci-cli:0.1.$CIRCLE_BUILD_NUM-alpine circleci/circleci-cli:alpine
248245
docker push circleci/circleci-cli:alpine
249-
- deploy-save-cache-workspace-and-artifacts
246+
- deploy-save-workspace-and-artifacts
250247

251248
snap:
252249
docker:
@@ -304,6 +301,46 @@ jobs:
304301
command: choco push circleci-cli.nupkg --source https://chocolatey.org/ --apikey $env:CHOCO_API_KEY
305302
working_directory: chocolatey
306303

304+
vulnerability-scan:
305+
executor: go
306+
steps:
307+
- checkout
308+
- run:
309+
name: Setup Scanning
310+
command: |
311+
git config --global url."https://$GITHUB_USER:$GITHUB_TOKEN@github.com/circleci/".insteadOf "https://github.com/circleci/"
312+
- when:
313+
condition:
314+
or:
315+
- equal: [ main, << pipeline.git.branch >> ]
316+
steps:
317+
- run:
318+
name: Launching Snyk Orb Scanning
319+
command: echo "Running snyk/scan on main; uploading the results"
320+
- run:
321+
name: Cleanup RemoteRepoURL
322+
command: echo 'export REMOTE_REPO_URL="${CIRCLE_REPOSITORY_URL%".git"}"' >> "$BASH_ENV"
323+
- snyk/scan:
324+
organization: "circleci-public"
325+
fail-on-issues: true
326+
severity-threshold: high
327+
monitor-on-build: true
328+
additional-arguments: "--all-projects --remote-repo-url=${REMOTE_REPO_URL} -d"
329+
- unless:
330+
condition:
331+
or:
332+
- equal: [ main, << pipeline.git.branch >> ]
333+
steps:
334+
- run:
335+
name: Launching Snyk Orb Scanning
336+
command: echo "Running snyk/scan on branch; not uploading the results"
337+
- snyk/scan:
338+
organization: "circleci-public"
339+
fail-on-issues: true
340+
severity-threshold: high
341+
monitor-on-build: false
342+
additional-arguments: "--all-projects -d"
343+
307344
workflows:
308345
ci:
309346
jobs:
@@ -317,6 +354,8 @@ workflows:
317354
- test_windows
318355
- coverage
319356
- lint
357+
- vulnerability-scan:
358+
context: org-global-employees
320359
- deploy-test
321360
- docs:
322361
requires:

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
* @CircleCI-Public/developer-experience
22
*orb*.go @CircleCI-Public/orb-publishers @CircleCI-Public/developer-experience
33

4-
/api/runner @CircleCI-Public/runner
5-
/cmd/runner @CircleCI-Public/runner
4+
/api/runner @CircleCI-Public/on-prem
5+
/cmd/runner @CircleCI-Public/on-prem

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ LABEL maintainer="Developer Experience Team <developer_experience@circleci.com>"
44

55
ENV CIRCLECI_CLI_SKIP_UPDATE_CHECK true
66

7-
COPY ./dist/circleci-cli_linux_amd64/circleci /usr/local/bin
7+
COPY ./dist/circleci-cli_linux_amd64_v1/circleci /usr/local/bin

Dockerfile.alpine

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM alpine:3.8
22

33
ENV CIRCLECI_CLI_SKIP_UPDATE_CHECK true
44

5-
COPY ./dist/circleci-cli_linux_amd64/circleci /usr/local/bin
5+
COPY ./dist/circleci-cli_linux_amd64_v1/circleci /usr/local/bin
66

77
RUN apk add --no-cache --upgrade git openssh ca-certificates
88

cmd/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ var _ = Describe("Config", func() {
257257
session.Wait()
258258

259259
Eventually(session.Err.Contents()).Should(BeEmpty())
260-
Eventually(session.Out.Contents()).Should(MatchRegexp("npm run test"))
260+
Eventually(session.Out.Contents()).Should(MatchRegexp("npm test"))
261261
Eventually(session).Should(gexec.Exit(0))
262262
})
263263

@@ -273,7 +273,7 @@ var _ = Describe("Config", func() {
273273
session.Wait()
274274

275275
Eventually(session.Err.Contents()).Should(BeEmpty())
276-
Eventually(session.Out.Contents()).Should(MatchRegexp("npm run test"))
276+
Eventually(session.Out.Contents()).Should(MatchRegexp("npm test"))
277277
Eventually(session).Should(gexec.Exit(0))
278278
})
279279
})

cmd/orb.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,8 @@ func initOrb(opts orbOptions) error {
12181218
defer resp.Body.Close()
12191219

12201220
// Create the file
1221-
out, err := os.Create(filepath.Join(os.TempDir(), "orb-template.zip"))
1221+
zipPath := filepath.Join(os.TempDir(), "orb-template.zip")
1222+
out, err := os.Create(zipPath)
12221223
if err != nil {
12231224
return err
12241225
}
@@ -1230,11 +1231,19 @@ func initOrb(opts orbOptions) error {
12301231
return err
12311232
}
12321233

1233-
err = unzipToOrbPath(filepath.Join(os.TempDir(), "orb-template.zip"), orbPath)
1234+
err = unzipToOrbPath(zipPath, orbPath)
12341235
if err != nil {
12351236
return err
12361237
}
12371238

1239+
// Remove MIT License file if orb is private
1240+
if opts.private {
1241+
err = os.Remove(filepath.Join(orbPath, "LICENSE"))
1242+
if err != nil && !errors.Is(err, os.ErrNotExist) {
1243+
return err
1244+
}
1245+
}
1246+
12381247
if fullyAutomated == 1 {
12391248
fmt.Println("Opted for manual setup, exiting")
12401249
fmt.Printf("The Orb Project Template has been extracted to %s\n", orbPath)

go.mod

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require (
3232
)
3333

3434
require (
35-
github.com/CircleCI-Public/circleci-config v0.0.0-20230609135034-182164ce950a
35+
github.com/CircleCI-Public/circleci-config v0.0.0-20230629192034-c469d9e9936b
3636
github.com/a8m/envsubst v1.4.2
3737
github.com/charmbracelet/lipgloss v0.5.0
3838
github.com/erikgeiser/promptkit v0.7.0
@@ -48,7 +48,6 @@ require (
4848
github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 // indirect
4949
github.com/acomagu/bufpipe v1.0.4 // indirect
5050
github.com/agnivade/levenshtein v1.1.1 // indirect
51-
github.com/alessio/shellescape v1.4.1 // indirect
5251
github.com/atotto/clipboard v0.1.4 // indirect
5352
github.com/beorn7/perks v1.0.1 // indirect
5453
github.com/cespare/xxhash/v2 v2.2.0 // indirect
@@ -118,7 +117,4 @@ require (
118117
gopkg.in/yaml.v2 v2.4.0 // indirect
119118
)
120119

121-
// fix vulnerability: CVE-2020-15114 in etcd v3.3.10+incompatible
122-
replace github.com/coreos/etcd => github.com/coreos/etcd v3.3.24+incompatible
123-
124120
go 1.20

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ github.com/AlecAivazis/survey/v2 v2.1.1 h1:LEMbHE0pLj75faaVEKClEX1TM4AJmmnOh9eim
22
github.com/AlecAivazis/survey/v2 v2.1.1/go.mod h1:9FJRdMdDm8rnT+zHVbvQT2RTSTLq0Ttd6q3Vl2fahjk=
33
github.com/CircleCI-Public/circle-policy-agent v0.0.683 h1:EzZaLy9mUGl4dwDNWceBHeDb3X0KAAjV4eFOk3C7lts=
44
github.com/CircleCI-Public/circle-policy-agent v0.0.683/go.mod h1:72U4Q4OtvAGRGGo/GqlCCO0tARg1cSG9xwxWyz3ktQI=
5-
github.com/CircleCI-Public/circleci-config v0.0.0-20230609135034-182164ce950a h1:RqA4H9p77FsqV++HNNDBq8dJftYuJ+r+KdD9HAX28t4=
6-
github.com/CircleCI-Public/circleci-config v0.0.0-20230609135034-182164ce950a/go.mod h1:XZaQPj2ylXZaz5vW31dRdkUY/Ey8MdpbgrUHbHyzICY=
5+
github.com/CircleCI-Public/circleci-config v0.0.0-20230629192034-c469d9e9936b h1:emg7uU3bRjVMlwSpOATBiybaBPXNWUIiFE/qbQQXZtE=
6+
github.com/CircleCI-Public/circleci-config v0.0.0-20230629192034-c469d9e9936b/go.mod h1:0iW5+XMF4XtikTlfCElaBQjT/OTMjQRHM1DgSWxcWuE=
77
github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc=
88
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
99
github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA=
@@ -20,8 +20,6 @@ github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ
2020
github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
2121
github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
2222
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
23-
github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0=
24-
github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
2523
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
2624
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhPwqqXc4/vE0f7GvRjuAsbW+HOIe8KnA=
2725
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw=

0 commit comments

Comments
 (0)