Skip to content

Commit

Permalink
Relocate agent (#726)
Browse files Browse the repository at this point in the history
* Relocate agent (automated changes)

* Relocate agent (manual changes)
  • Loading branch information
edigaryev committed Apr 23, 2024
1 parent 1f12770 commit 989bbbe
Show file tree
Hide file tree
Showing 176 changed files with 21,507 additions and 87 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,6 @@ issues:
# Don't hide multiple issues that belong to one class since GitHub annotations can handle them all nicely.
max-issues-per-linter: 0
max-same-issues: 0

exclude-dirs:
- internal/agent
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ builds:
-X github.com/cirruslabs/cirrus-cli/internal/version.Version={{.Version}}
-X github.com/cirruslabs/cirrus-cli/internal/version.Commit={{.ShortCommit}}
env:
- CGO_ENABLED=0
- CGO_ENABLED={{if eq .Runtime.Goos "darwin"}}1{{else}}0{{end}}
goos:
- linux
- darwin
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ RUN goreleaser build --timeout 60m --single-target

FROM alpine:latest
LABEL org.opencontainers.image.source=https://github.com/cirruslabs/cirrus-cli/

RUN apk add --no-cache rsync
COPY --from=builder /build/dist/linux_*/cirrus_linux_*/cirrus /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/cirrus"]
8 changes: 8 additions & 0 deletions cmd/cirrus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/x509"
"fmt"
"github.com/breml/rootcerts/embedded"
"github.com/cirruslabs/cirrus-cli/internal/agent"
"github.com/cirruslabs/cirrus-cli/internal/commands"
"github.com/cirruslabs/cirrus-cli/internal/opentelemetry"
"github.com/cirruslabs/cirrus-cli/internal/version"
Expand Down Expand Up @@ -39,6 +40,13 @@ func main() {
defer sentry.Flush(5 * time.Second)
defer sentry.Recover()

// Run the Cirrus CI Agent if requested
if len(os.Args) >= 2 && os.Args[1] == "agent" {
agent.Run()

return
}

// Enrich future events with Cirrus CI-specific tags
if tags, ok := os.LookupEnv("CIRRUS_SENTRY_TAGS"); ok {
sentry.ConfigureScope(func(scope *sentry.Scope) {
Expand Down
43 changes: 37 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/antihax/optional v1.0.0
github.com/avast/retry-go/v4 v4.5.1
github.com/breml/rootcerts v0.2.16
github.com/cirruslabs/cirrus-ci-agent v1.134.1
github.com/cirruslabs/cirrus-ci-agent v1.134.1 // indirect
github.com/cirruslabs/echelon v1.9.0
github.com/cirruslabs/go-java-glob v0.1.0
github.com/cirruslabs/podmanapi v0.3.1
Expand Down Expand Up @@ -69,10 +69,21 @@ require (

require (
github.com/IGLOU-EU/go-wildcard v1.0.3
github.com/bmatcuk/doublestar v1.3.4
github.com/cirruslabs/cirrus-ci-annotations v0.10.0
github.com/cirruslabs/terminal v0.16.0
github.com/go-chi/render v1.0.3
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/go-github/v59 v59.0.0
github.com/hashicorp/vault/api v1.12.2
github.com/klauspost/pgzip v1.2.6
github.com/pkg/errors v0.9.1
github.com/prometheus/procfs v0.13.0
github.com/puzpuzpuz/xsync/v3 v3.1.0
github.com/samber/lo v1.39.0
github.com/shirou/gopsutil/v3 v3.24.2
github.com/testcontainers/testcontainers-go v0.30.0
github.com/tonistiigi/go-actions-cache v0.0.0-20240227172821-a0b64f338598
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0
go.opentelemetry.io/otel v1.24.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.24.0
Expand All @@ -81,6 +92,9 @@ require (
go.opentelemetry.io/otel/sdk v1.24.0
go.opentelemetry.io/otel/sdk/metric v1.24.0
go.opentelemetry.io/otel/trace v1.24.0
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8
golang.org/x/sync v0.6.0
golang.org/x/time v0.5.0
)

require (
Expand All @@ -93,7 +107,9 @@ require (
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/ajg/form v1.5.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
Expand All @@ -102,7 +118,10 @@ require (
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/ttrpc v1.2.3 // indirect
github.com/containerd/typeurl/v2 v2.1.1 // indirect
github.com/cpuguy83/dockercfg v0.3.1 // indirect
github.com/creack/pty v1.1.21 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.1 // indirect
Expand All @@ -113,43 +132,55 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.5 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.6 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/in-toto/in-toto-golang v0.9.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/joshdk/go-junit v1.0.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/miekg/pkcs11 v1.1.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/mountinfo v0.7.1 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/signal v0.7.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/runtime-spec v1.2.0 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.51.1 // indirect
github.com/prometheus/procfs v0.13.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.8.0 // indirect
github.com/shibumi/go-pathspec v1.3.0 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
Expand All @@ -168,10 +199,10 @@ require (
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240325203815-454cdb8f5daa // indirect
Expand Down
Loading

0 comments on commit 989bbbe

Please sign in to comment.