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 #928

Merged
merged 26 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3150324
Fix punctuation
adamdmharvey Oct 25, 2021
079896e
Fix id est to exempli gratia
adamdmharvey Oct 25, 2021
c9cb0d8
Fix broken links
adamdmharvey Oct 25, 2021
7ddda80
Fix typo in UK English
adamdmharvey Oct 25, 2021
eb9f60f
Add pre-commit hook for validating configuration
peterb-oanda Dec 6, 2021
bf399b8
Merge branch 'master' into doco-tweaks
adamdmharvey May 19, 2022
7613496
Merge branch 'master' into doco-tweaks
adamdmharvey Sep 13, 2022
fdb0614
Add setup key to packed orb examples
adamdmharvey Oct 7, 2022
1b145f5
Merge branch 'master' into adamdmharvey/enable-setup-in-examples
adamdmharvey Oct 17, 2022
8d77691
Merge branch 'master' into adamdmharvey/enable-setup-in-examples
adamdmharvey Oct 27, 2022
8722150
Merge branch 'main' into adamdmharvey/enable-setup-in-examples
adamdmharvey Mar 10, 2023
6776657
Add --docker-socket-path flag
chiting Mar 13, 2023
d03951c
Add warning on some CLI commands that orbs cannot be deleted once the…
rlegan Apr 14, 2023
8a362b1
Merge pull request #921 from CircleCI-Public/main
JulesFaucherre Apr 24, 2023
2c60dac
Merge branch 'main' into pre-commit
rlegan Apr 24, 2023
a588835
Merge pull request #909 from CircleCI-Public/DEVEX-893-add-warning-on…
rlegan Apr 24, 2023
548482d
Merge branch 'develop' into doco-tweaks
adamdmharvey Apr 24, 2023
d710994
Add org-slug and org-id flags to orb validate & process commands (#922)
zbenhadi Apr 28, 2023
419c088
fix: Dockerfile maintainer is now Developer Experience
JulesFaucherre May 3, 2023
e255781
Return correct error in ConfigQuery
professor-l May 3, 2023
7afdc21
Merge pull request #927 from professor-l/API-677/fix-error-logging-bug
JulesFaucherre May 4, 2023
aaa8190
Merge pull request #925 from CircleCI-Public/fix/DEVEX-961/change-doc…
JulesFaucherre May 4, 2023
bfe5c99
Merge pull request #868 from chiting/add-docker-socket-config
JulesFaucherre May 4, 2023
9e589f2
Merge pull request #794 from adamdmharvey/adamdmharvey/enable-setup-i…
JulesFaucherre May 4, 2023
7264b15
Merge pull request #634 from adamdmharvey/doco-tweaks
JulesFaucherre May 4, 2023
d97db20
Merge pull request #655 from peterb-oanda/pre-commit
JulesFaucherre May 4, 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
6 changes: 6 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- id: config-validate
name: Validate CircleCI config
entry: circleci config validate --skip-update-check
language: golang
files: .circleci/config.yml
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM cimg/go:1.20

LABEL maintainer="Developer Experience Team <[email protected]>"

ENV CIRCLECI_CLI_SKIP_UPDATE_CHECK true

COPY ./dist/circleci-cli_linux_amd64/circleci /usr/local/bin
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ CircleCI host has been set.
Setup complete. Your configuration has been saved.
```

If you are using this tool on `circleci.com`, accept the provided default `CircleCI Host`.

If you are using this tool on `circleci.com`. accept the provided default `CircleCI Host`.

Server users will have to change the default value to your custom address (i.e. `circleci.my-org.com`).
Server users will have to change the default value to your custom address (e.g., `circleci.my-org.com`).

**Note**: Server does not yet support config processing and orbs, you will only be able to use `circleci local execute` (previously `circleci build`) for now.

Expand Down Expand Up @@ -153,7 +152,7 @@ The following commands are affected:

## Platforms, Deployment and Package Managers

The tool is deployed through a number of channels. The primary release channel is through [GitHub Releases](https://github.com/CircleCI-Public/circleci-cli/releases). Green builds on the `main` branch will publish a new GitHub release. These releases contain binaries for macOS, Linux and Windows. These releases are published from (CircleCI)[https://app.circleci.com/pipelines/github/CircleCI-Public/circleci-cli] using (GoReleaser)[https://goreleaser.com/].
The tool is deployed through a number of channels. The primary release channel is through [GitHub Releases](https://github.com/CircleCI-Public/circleci-cli/releases). Green builds on the `main` branch will publish a new GitHub release. These releases contain binaries for macOS, Linux and Windows. These releases are published from (CircleCI)[https://app.circleci.com/pipelines/github/CircleCI-Public/circleci-cli] using [GoReleaser](https://goreleaser.com/).

### Homebrew

Expand Down
1 change: 1 addition & 0 deletions cmd/orb.go
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ type OrbSchema struct {

type ExampleUsageSchema struct {
Version string `yaml:"version,omitempty"`
Setup bool `yaml:"setup,omitempty"`
Orbs interface{} `yaml:"orbs,omitempty"`
Jobs interface{} `yaml:"jobs,omitempty"`
Workflows interface{} `yaml:"workflows"`
Expand Down
31 changes: 27 additions & 4 deletions cmd/orb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3311,6 +3311,20 @@ Windows Server 2010
- run:
name: Say hello
command: <<include(scripts/script.sh)>>

examples:
example:
description: |
An example of how to use the orb.
usage:
version: 2.1
orbs:
orb-name: company/[email protected]
setup: true
workflows:
create-pipeline:
jobs:
orb-name: create-pipeline-x
`))
script = clitest.OpenTmpFile(tempSettings.Home, filepath.Join("scripts", "script.sh"))
script.Write([]byte(`echo Hello, world!`))
Expand All @@ -3330,17 +3344,26 @@ Windows Server 2010
It("Includes a script in the packed Orb file", func() {
session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)
Expect(err).ShouldNot(HaveOccurred())

Eventually(session.Out).Should(gbytes.Say(`commands:
orb:
steps:
Eventually(session.Out).Should(gbytes.Say(`steps:
- run:
command: echo Hello, world!
name: Say hello
`))
Eventually(session).Should(gexec.Exit(0))
})

It("Includes the setup key when an orb example uses a dynamic pipeline", func() {
session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)
Expect(err).ShouldNot(HaveOccurred())
Eventually(session.Out).Should(gbytes.Say(`orbs:
orb-name: company/[email protected]
setup: true
version: 2.1
workflows:
`))
Eventually(session).Should(gexec.Exit(0))
})

})

Describe("Orb diff", func() {
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (c *ConfigCompiler) ConfigQuery(
return legacyResponse, nil
}
if originalErr != nil {
return nil, fmt.Errorf("config compilation request returned an error: %w", err)
return nil, fmt.Errorf("config compilation request returned an error: %w", originalErr)
}

if statusCode != 200 {
Expand Down
11 changes: 7 additions & 4 deletions local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
var picardRepo = "circleci/picard"

const DefaultConfigPath = ".circleci/config.yml"
const DefaultDockerSocketPath = "/var/run/docker.sock"

func Execute(flags *pflag.FlagSet, cfg *settings.Config, args []string) error {
var err error
Expand Down Expand Up @@ -80,7 +81,8 @@ func Execute(flags *pflag.FlagSet, cfg *settings.Config, args []string) error {
}

job := args[0]
arguments := generateDockerCommand(processedConfigPath, image, pwd, job, processedArgs...)
dockerSocketPath, _ := flags.GetString("docker-socket-path")
arguments := generateDockerCommand(processedConfigPath, image, pwd, job, dockerSocketPath, processedArgs...)

if cfg.Debug {
_, err = fmt.Fprintf(os.Stderr, "Starting docker with args: %s", arguments)
Expand Down Expand Up @@ -114,6 +116,7 @@ func AddFlagsForDocumentation(flags *pflag.FlagSet) {
flags.String("branch", "", "Git branch")
flags.String("repo-url", "", "Git Url")
flags.StringArrayP("env", "e", nil, "Set environment variables, e.g. `-e VAR=VAL`")
flags.String("docker-socket-path", DefaultDockerSocketPath, "Path to the host's docker socket")
}

// Given the full set of flags that were passed to this command, return the path
Expand All @@ -131,7 +134,7 @@ func buildAgentArguments(flags *pflag.FlagSet) ([]string, string) {

// build a list of all supplied flags, that we will pass on to build-agent
flags.Visit(func(flag *pflag.Flag) {
if flag.Name != "build-agent-version" && flag.Name != "org-slug" && flag.Name != "config" && flag.Name != "debug" && flag.Name != "org-id" {
if flag.Name != "build-agent-version" && flag.Name != "org-slug" && flag.Name != "config" && flag.Name != "debug" && flag.Name != "org-id" && flag.Name != "docker-socket-path" {
result = append(result, unparseFlag(flags, flag)...)
}
})
Expand Down Expand Up @@ -272,10 +275,10 @@ func writeStringToTempFile(data string) (string, error) {
return f.Name(), nil
}

func generateDockerCommand(configPath, image, pwd string, job string, arguments ...string) []string {
func generateDockerCommand(configPath, image, pwd string, job string, dockerSocketPath string, arguments ...string) []string {
const configPathInsideContainer = "/tmp/local_build_config.yml"
core := []string{"docker", "run", "--interactive", "--tty", "--rm",
"--volume", "/var/run/docker.sock:/var/run/docker.sock",
"--volume", fmt.Sprintf("%s:/var/run/docker.sock", dockerSocketPath),
"--volume", fmt.Sprintf("%s:%s", configPath, configPathInsideContainer),
"--volume", fmt.Sprintf("%s:%s", pwd, pwd),
"--volume", fmt.Sprintf("%s:/root/.circleci", settings.SettingsPath()),
Expand Down
2 changes: 1 addition & 1 deletion local/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var _ = Describe("build", func() {
It("can generate a command line", func() {
home, err := os.UserHomeDir()
Expect(err).NotTo(HaveOccurred())
Expect(generateDockerCommand("/config/path", "docker-image-name", "/current/directory", "build", "extra-1", "extra-2")).To(ConsistOf(
Expect(generateDockerCommand("/config/path", "docker-image-name", "/current/directory", "build", "/var/run/docker.sock", "extra-1", "extra-2")).To(ConsistOf(
"docker",
"run",
"--interactive",
Expand Down