Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .buildkite/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ services:
- BUILDKITE_AGENT_JOB_API_SOCKET
- BUILDKITE_AGENT_JOB_API_TOKEN
- POSTHOG_API_KEY
- DOCKERHUB_USER
- DOCKERHUB_PASSWORD
working_dir: /go/src/github.com/buildkite/cli
volumes:
- ..:/go/src/github.com/buildkite/cli
- ${BUILDKITE_AGENT_JOB_API_SOCKET}:${BUILDKITE_AGENT_JOB_API_SOCKET}
- /var/run/docker.sock:/var/run/docker.sock
4 changes: 4 additions & 0 deletions .buildkite/pipeline.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ steps:
- aws-ssm#v1.0.0:
parameters:
GITHUB_TOKEN: /pipelines/buildkite/buildkite-cli-release/github-token
DOCKERHUB_USER: /pipelines/buildkite/buildkite-cli-release/dockerhub-user
DOCKERHUB_PASSWORD: /pipelines/buildkite/buildkite-cli-release/dockerhub-password
- artifacts#v1.9.3:
download:
- dist/**/*
Expand All @@ -78,6 +80,8 @@ steps:
entrypoint: /bin/sh
env:
- GITHUB_TOKEN
- DOCKERHUB_USER
- DOCKERHUB_PASSWORD
mount-buildkite-agent: true
run: goreleaser
shell: false
Expand Down
12 changes: 12 additions & 0 deletions .buildkite/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ if [[ $? -ne 0 ]]; then
exit 1
fi

# check if DOCKERHUB_USER and DOCKERHUB_PASSWORD are set if not skip docker login
if [[ -z "${DOCKERHUB_USER:-}" || -z "${DOCKERHUB_PASSWORD:-}" ]]; then
echo "Skipping Docker login as DOCKERHUB_USER or DOCKERHUB_PASSWORD is not set"
else
echo "--- :key: :docker: Login to Docker Hub using ko"
echo "${DOCKERHUB_PASSWORD}" | ko login index.docker.io --username "${DOCKERHUB_USER}" --password-stdin
if [[ $? -ne 0 ]]; then
echo "Docker login failed"
exit 1
fi
fi

if ! goreleaser "$@"; then
echo "Failed to build a release"
exit 1
Expand Down
28 changes: 26 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ builds:

- id: linux
goos: [linux]
goarch: ["386", arm, amd64, arm64]
goarch: [amd64, arm64]
env:
- CGO_ENABLED=0
binary: bk
Expand All @@ -49,12 +49,36 @@ builds:

- id: windows
goos: [windows]
goarch: ["386", amd64, arm64]
goarch: [amd64, arm64]
binary: bk
main: .
ldflags:
- -s -w -X github.com/buildkite/cli/v3/cmd/version.Version={{.Version}} -X github.com/buildkite/cli/v3/pkg/cmd/pipeline.MigrationEndpoint=https://m4vrh5pvtd.execute-api.us-east-1.amazonaws.com/production/migrate -X github.com/buildkite/cli/v3/pkg/analytics.apiKey={{.Env.POSTHOG_API_KEY}} -X github.com/buildkite/cli/v3/pkg/oauth.DefaultClientID={{.Env.OAUTH_CLIENT_ID}}

kos:
- repositories:
- docker.io/buildkite/cli
build: linux
main: .
creation_time: "{{.CommitTimestamp}}"
base_image: 'cgr.dev/chainguard/static:latest'
tags:
- '{{.Version}}'
- latest
labels:
org.opencontainers.image.authors: Buildkite Inc. https://buildkite.com
org.opencontainers.image.source: https://github.com/buildkite/cli
org.opencontainers.image.created: "{{.Date}}"
org.opencontainers.image.title: "{{.ProjectName}}"
org.opencontainers.image.revision: "{{.FullCommit}}"
org.opencontainers.image.version: "{{.Version}}"
bare: true
preserve_import_paths: false
disable: '{{ and (isEnvSet "GOOS") (ne .Env.GOOS "linux") }}'
platforms:
- linux/amd64
- linux/arm64

archives:
- id: macos-archive
builds: [macos]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be
github.com/buildkite/go-buildkite/v4 v4.14.1
github.com/buildkite/roko v1.4.0
github.com/go-git/go-git/v5 v5.16.4
github.com/go-git/go-git/v5 v5.16.5
github.com/goccy/go-yaml v1.19.2
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/posthog/posthog-go v1.9.1
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwN
github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/bradleyjkemp/cupaloy/v2 v2.6.0 h1:knToPYa2xtfg42U3I6punFEjaGFKWQRXJwj0JTv4mTs=
github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0=
github.com/buildkite/go-buildkite/v4 v4.14.0 h1:DzGB4lhHhXpd3IU+Y/t6vs/z9wVGBL2Y17dSKHrbats=
github.com/buildkite/go-buildkite/v4 v4.14.0/go.mod h1:VutoY8MvXYKNLzbobBouiBGHx/UdhBr9K2sWBWNGK+Q=
github.com/buildkite/go-buildkite/v4 v4.14.1 h1:qAnVhGZWbSxP6JGoysG6Iv0wdVC/0DkpS85wpqcJ080=
github.com/buildkite/go-buildkite/v4 v4.14.1/go.mod h1:VutoY8MvXYKNLzbobBouiBGHx/UdhBr9K2sWBWNGK+Q=
github.com/buildkite/roko v1.4.0 h1:DxixoCdpNqxu4/1lXrXbfsKbJSd7r1qoxtef/TT2J80=
Expand Down Expand Up @@ -66,8 +64,8 @@ github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UN
github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
github.com/go-git/go-git/v5 v5.16.4 h1:7ajIEZHZJULcyJebDLo99bGgS0jRrOxzZG4uCk2Yb2Y=
github.com/go-git/go-git/v5 v5.16.4/go.mod h1:4Ge4alE/5gPs30F2H1esi2gPd69R0C39lolkucHBOp8=
github.com/go-git/go-git/v5 v5.16.5 h1:mdkuqblwr57kVfXri5TTH+nMFLNUxIj9Z7F5ykFbw5s=
github.com/go-git/go-git/v5 v5.16.5/go.mod h1:QOMLpNf1qxuSY4StA/ArOdfFR2TrKEjJiye2kel2m+M=
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
Expand Down