Skip to content

Commit 339ef96

Browse files
committed
fix: align CLI version with Cargo.toml and use local wheels in CI
- goreleaser now reads COG_VERSION from Cargo.toml (set by mise build:cog) instead of git describe for ldflags and snapshot version - CI integration tests set COG_WHEEL=dist to use the locally-built wheel rather than PyPI (where the version may not be published yet) - IT harness propagates SSL_CERT_FILE, REQUESTS_CA_BUNDLE, COG_CA_CERT for corporate proxy/MITM environments (e.g. Cloudflare WARP) - Include Cargo.lock update from 0.17.0-alpha3 version bump
1 parent 2228ba8 commit 339ef96

5 files changed

Lines changed: 27 additions & 8 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,8 +692,10 @@ jobs:
692692
- uses: jdx/mise-action@v3
693693
- name: Build cog binary
694694
run: mise run build:cog
695-
- name: Set runtime environment
695+
- name: Set wheel environment
696696
run: |
697+
# Use locally-built wheels, not PyPI (version may not be published yet)
698+
echo "COG_WHEEL=dist" >> $GITHUB_ENV
697699
if [ "${{ matrix.runtime }}" = "cog-rust" ]; then
698700
echo "COGLET_WHEEL=dist" >> $GITHUB_ENV
699701
fi

.goreleaser.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ before:
55
dist: ./dist/go
66
env:
77
- CGO_ENABLED=0
8+
# COG_VERSION is set by mise build:cog from Cargo.toml (single source of truth).
9+
# For tagged releases, goreleaser derives Version from the tag and COG_VERSION is unused in ldflags.
10+
# For snapshot builds, COG_VERSION overrides the git-derived version.
11+
- COG_VERSION={{ if index .Env "COG_VERSION" }}{{ .Env.COG_VERSION }}{{ else }}{{ .Version }}{{ end }}
812
builds:
913
- binary: cog
1014
id: cog
@@ -16,7 +20,7 @@ builds:
1620
- arm64
1721
main: ./cmd/cog
1822
ldflags:
19-
- "-s -w -X github.com/replicate/cog/pkg/global.Version={{.Version}} -X github.com/replicate/cog/pkg/global.Commit={{.Commit}} -X github.com/replicate/cog/pkg/global.BuildTime={{.Date}}"
23+
- "-s -w -X github.com/replicate/cog/pkg/global.Version={{ .Env.COG_VERSION }} -X github.com/replicate/cog/pkg/global.Commit={{.Commit}} -X github.com/replicate/cog/pkg/global.BuildTime={{.Date}}"
2024
- binary: base-image
2125
id: base-image
2226
goos:
@@ -27,7 +31,7 @@ builds:
2731
- arm64
2832
main: ./cmd/base-image
2933
ldflags:
30-
- "-s -w -X github.com/replicate/cog/pkg/global.Version={{.Version}} -X github.com/replicate/cog/pkg/global.Commit={{.Commit}} -X github.com/replicate/cog/pkg/global.BuildTime={{.Date}}"
34+
- "-s -w -X github.com/replicate/cog/pkg/global.Version={{ .Env.COG_VERSION }} -X github.com/replicate/cog/pkg/global.Commit={{.Commit}} -X github.com/replicate/cog/pkg/global.BuildTime={{.Date}}"
3135
archives:
3236
- formats: [binary]
3337
ids:
@@ -41,7 +45,7 @@ archives:
4145
checksum:
4246
name_template: "checksums.txt"
4347
snapshot:
44-
version_template: "{{ incpatch .Version }}-dev+g{{ .ShortCommit }}{{ if .IsGitDirty }}.d{{ .Now.Format \"20060102\" }}{{ end }}"
48+
version_template: "{{ .Env.COG_VERSION }}-dev+g{{ .ShortCommit }}{{ if .IsGitDirty }}.d{{ .Now.Format \"20060102\" }}{{ end }}"
4549
changelog:
4650
sort: asc
4751
filters:

crates/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require (
66
github.com/anaskhan96/soup v1.2.5
77
github.com/aws/aws-sdk-go-v2 v1.39.4
88
github.com/aws/aws-sdk-go-v2/service/s3 v1.88.7
9+
github.com/containerd/errdefs v1.0.0
910
github.com/docker/cli v28.5.2+incompatible
1011
github.com/docker/docker v28.5.2+incompatible
1112
github.com/docker/go-connections v0.5.0
@@ -16,6 +17,7 @@ require (
1617
github.com/mattn/go-isatty v0.0.20
1718
github.com/mitchellh/go-homedir v1.1.0
1819
github.com/moby/buildkit v0.22.0
20+
github.com/moby/docker-image-spec v1.3.1
1921
github.com/moby/term v0.5.2
2022
github.com/opencontainers/image-spec v1.1.1
2123
github.com/pkg/errors v0.9.1
@@ -63,7 +65,6 @@ require (
6365
github.com/containerd/containerd/api v1.8.0 // indirect
6466
github.com/containerd/containerd/v2 v2.0.7 // indirect
6567
github.com/containerd/continuity v0.4.5 // indirect
66-
github.com/containerd/errdefs v1.0.0 // indirect
6768
github.com/containerd/errdefs/pkg v0.3.0 // indirect
6869
github.com/containerd/log v0.1.0 // indirect
6970
github.com/containerd/platforms v1.0.0-rc.1 // indirect
@@ -107,7 +108,6 @@ require (
107108
github.com/mailru/easyjson v0.9.0 // indirect
108109
github.com/mattn/go-colorable v0.1.14 // indirect
109110
github.com/mattn/go-runewidth v0.0.16 // indirect
110-
github.com/moby/docker-image-spec v1.3.1 // indirect
111111
github.com/moby/go-archive v0.1.0 // indirect
112112
github.com/moby/locker v1.0.1 // indirect
113113
github.com/moby/patternmatcher v0.6.0 // indirect

integration-tests/harness/harness.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,19 @@ func (h *Harness) Setup(env *testscript.Env) error {
275275
env.Setenv("RUST_LOG", rustLog)
276276
}
277277

278+
// Propagate SSL/TLS cert environment for corporate proxies (e.g. Cloudflare WARP)
279+
if sslCertFile := os.Getenv("SSL_CERT_FILE"); sslCertFile != "" {
280+
env.Setenv("SSL_CERT_FILE", sslCertFile)
281+
}
282+
if requestsCA := os.Getenv("REQUESTS_CA_BUNDLE"); requestsCA != "" {
283+
env.Setenv("REQUESTS_CA_BUNDLE", requestsCA)
284+
}
285+
286+
// Propagate COG_CA_CERT for CA certificate injection into Docker images
287+
if cogCACert := os.Getenv("COG_CA_CERT"); cogCACert != "" {
288+
env.Setenv("COG_CA_CERT", cogCACert)
289+
}
290+
278291
// Generate unique image name for this test run
279292
imageName := generateUniqueImageName()
280293
env.Setenv("TEST_IMAGE", imageName)

0 commit comments

Comments
 (0)