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
5 changes: 1 addition & 4 deletions .dagger/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import (
"dagger/tapes/internal/dagger"
)

const (
tapesImageName = "tapes"
postgresImageName = "postgres"
)
const tapesImageName = "tapes"

var imagePlatforms = []dagger.Platform{
"linux/amd64",
Expand Down
38 changes: 6 additions & 32 deletions .dagger/postgres.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package main

import (
"context"
"dagger/tapes/internal/dagger"
"fmt"
)

// These consts are exported from the dagger module as a test utility ready
// to use in integration tests throughout the tapes codebase.
const (
testPgUser = "tapes"
testPgPass = "tapes"
testPgDB = "tapes"
testPgPort = 5432
postgresImage = "public.ecr.aws/g4e5l3z3/papercomputeco/postgres:17.7-pgduckdb-1.1.1"
testPgUser = "tapes"
testPgPass = "tapes"
testPgDB = "tapes"
testPgPort = 5432
)

// newPostgresDSN returns a new connection string used by the tapes services
Expand All @@ -23,36 +23,10 @@ func newPostgresDSN() string {

// PostgresService provides a ready to run postgres service with "tapes" user, password, and db
func (m *Tapes) PostgresService() *dagger.Service {
ctr := m.Source.DockerBuild(dagger.DirectoryDockerBuildOpts{
Dockerfile: "postgres/Dockerfile",
})

return ctr.
return dag.Container().From(postgresImage).
WithEnvVariable("POSTGRES_USER", testPgUser).
WithEnvVariable("POSTGRES_PASSWORD", testPgPass).
WithEnvVariable("POSTGRES_DB", testPgDB).
WithExposedPort(testPgPort).
AsService(dagger.ContainerAsServiceOpts{UseEntrypoint: true})
}

// BuildPostgresImage builds the local-platform postgres container image from
// the repository postgres Dockerfile.
func (t *Tapes) BuildPostgresImage() *dagger.Container {
return t.buildDockerfileImage("postgres/Dockerfile", nil)
}

// BuildPushPostgresImages builds a multi-arch postgres image and publishes it
// to the provided registry.
//
// Image naming convention: <registry>/postgres:<tag>
func (t *Tapes) BuildPushPostgresImages(
ctx context.Context,

// Container registry address (e.g., "123456789.dkr.ecr.us-east-1.amazonaws.com")
registry string,

// Image tags to apply (e.g., ["v1.0.0", "latest"])
tags []string,
) ([]string, error) {
return t.publishImageVariants(ctx, registry, postgresImageName, tags, t.buildDockerfileImages("postgres/Dockerfile", nil))
}
9 changes: 0 additions & 9 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,6 @@ jobs:
env:
DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }}

- name: Push nightly postgres image
run: |
dagger call \
build-push-postgres-images \
--registry=${{ vars.REGISTRY }} \
--tags="nightly"
env:
DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }}

- name: Build upload nightly release artifacts
run: |
dagger call \
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@ jobs:
env:
DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }}

- name: Push postgres image
run: |
dagger call \
build-push-postgres-images \
--registry=${{ vars.REGISTRY }} \
--tags="${{ github.event.release.tag_name }}" \
--tags="latest"
env:
DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }}

- name: Build upload release artifacts
run: |
dagger call \
Expand Down
2 changes: 1 addition & 1 deletion cmd/tapes/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

const (
defaultPostgresImage = "public.ecr.aws/g4e5l3z3/papercomputeco/postgres"
defaultPostgresImage = "public.ecr.aws/g4e5l3z3/papercomputeco/postgres:17.7-pgduckdb-1.1.1"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Postgres image version duplicated in two places

The pinned image tag 17.7-pgduckdb-1.1.1 is defined independently in both cmd/tapes/local/local.go and .dagger/postgres.go. When the upstream image is bumped, both constants must be updated together — there is no single source of truth. A missed update would silently run a different Postgres version in Dagger integration tests than in the local CLI workflow.

Prompt To Fix With AI
This is a comment left during a code review.
Path: cmd/tapes/local/local.go
Line: 22

Comment:
**Postgres image version duplicated in two places**

The pinned image tag `17.7-pgduckdb-1.1.1` is defined independently in both `cmd/tapes/local/local.go` and `.dagger/postgres.go`. When the upstream image is bumped, both constants must be updated together — there is no single source of truth. A missed update would silently run a different Postgres version in Dagger integration tests than in the local CLI workflow.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine. At some point we can make it dynamic how this is propagated through to dagger (a seperate Go module)

defaultOllamaImage = "ollama/ollama:latest"
defaultEmbeddingModel = "embeddinggemma"
ollamaEmbeddingModel = defaultEmbeddingModel + ":latest"
Expand Down
5 changes: 1 addition & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
services:
postgres:
build:
context: .
dockerfile: postgres/Dockerfile
image: tapes-postgres-cnpg-pgduckdb:17
image: public.ecr.aws/g4e5l3z3/papercomputeco/postgres:17.7-pgduckdb-1.1.1
environment:
POSTGRES_DB: tapes
POSTGRES_USER: tapes
Expand Down
22 changes: 1 addition & 21 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ release: ## Builds and releases tapes artifacts
--secret-access-key=env://BUCKET_SECRET_ACCESS_KEY

.PHONY: build-images
build-images: build-tapes-image build-postgres-image ## Builds all container artifacts
build-images: build-tapes-image ## Builds all container artifacts

.PHONY: build-tapes-image
build-tapes-image: ## Builds, tags, and loads the tapes container artifact locally
Expand All @@ -114,18 +114,6 @@ build-tapes-image: ## Builds, tags, and loads the tapes container artifact local
export-image \
--name=${REGISTRY}/tapes:latest

.PHONY: build-postgres-image
build-postgres-image: ## Builds, tags, and loads the tapes postgres container artifact locally
$(call print-target)
dagger call \
build-postgres-image \
export-image \
--name=${REGISTRY}/postgres:${VERSION}
dagger call \
build-postgres-image \
export-image \
--name=${REGISTRY}/postgres:latest

.PHONY: build-push-tapes-images
build-push-tapes-images: ## Builds and publishes the multi-arch tapes container images
dagger call \
Expand All @@ -136,14 +124,6 @@ build-push-tapes-images: ## Builds and publishes the multi-arch tapes container
--version=${VERSION} \
--commit=${COMMIT}

.PHONY: build-push-postgres-images
build-push-postgres-images: ## Builds and publishes the multi-arch postgres container images
dagger call \
build-push-postgres-images \
--registry=${REGISTRY} \
--tags=${VERSION} \
--tags=latest

.PHONY: up
up:
docker compose up --build
Expand Down
65 changes: 0 additions & 65 deletions postgres/Dockerfile

This file was deleted.

8 changes: 0 additions & 8 deletions postgres/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions postgres/initdb.d/0000-install-extensions.sql

This file was deleted.

Loading