Skip to content

Commit 1336925

Browse files
authored
feat(flake.nix): switch dogfood dev image to buildNixShellImage from dockerTools (#16223)
Replace Depot build action with Nix for Nix dogfood image builds The dogfood Nix image is now built using Nix's native container tooling instead of Depot. This change: - Adds Nix setup steps to the GitHub Actions workflow - Removes the Dockerfile.nix in favor of a Nix-native container build - Updates the flake.nix to support building Docker images - Introduces a hash file to track Nix-related changes - Updates the vendorHash for Go dependencies Change-Id: I4e011fe3a19d9a1375fbfd5223c910e59d66a5d9 Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent 279c08e commit 1336925

32 files changed

+1769
-1755
lines changed

.dockerignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/actions/setup-sqlc/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ runs:
77
- name: Setup sqlc
88
uses: sqlc-dev/setup-sqlc@c0209b9199cd1cce6a14fc27cabcec491b651761 # v4.0.0
99
with:
10-
sqlc-version: "1.25.0"
10+
sqlc-version: "1.27.0"

.github/workflows/ci.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,16 @@ jobs:
251251
- name: go install tools
252252
run: |
253253
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
254-
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
254+
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.34
255255
go install golang.org/x/tools/cmd/goimports@latest
256-
go install github.com/mikefarah/yq/v4@v4.30.6
257-
go install go.uber.org/mock/mockgen@v0.4.0
256+
go install github.com/mikefarah/yq/v4@v4.44.3
257+
go install go.uber.org/mock/mockgen@v0.5.0
258258
259259
- name: Install Protoc
260260
run: |
261261
mkdir -p /tmp/proto
262262
pushd /tmp/proto
263-
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
263+
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protoc-23.4-linux-x86_64.zip
264264
unzip protoc.zip
265265
cp -r ./bin/* /usr/local/bin
266266
cp -r ./include /usr/local/bin/include
@@ -850,7 +850,7 @@ jobs:
850850
run: |
851851
mkdir -p /tmp/proto
852852
pushd /tmp/proto
853-
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
853+
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protoc-23.4-linux-x86_64.zip
854854
unzip protoc.zip
855855
cp -r ./bin/* /usr/local/bin
856856
cp -r ./include /usr/local/bin/include
@@ -862,10 +862,10 @@ jobs:
862862
- name: Install go tools
863863
run: |
864864
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
865-
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
865+
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.34
866866
go install golang.org/x/tools/cmd/goimports@latest
867-
go install github.com/mikefarah/yq/v4@v4.30.6
868-
go install go.uber.org/mock/mockgen@v0.4.0
867+
go install github.com/mikefarah/yq/v4@v4.44.3
868+
go install go.uber.org/mock/mockgen@v0.5.0
869869
870870
- name: Setup sqlc
871871
uses: ./.github/actions/setup-sqlc

.github/workflows/dogfood.yaml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ permissions:
2424
jobs:
2525
build_image:
2626
if: github.actor != 'dependabot[bot]' # Skip Dependabot PRs
27-
runs-on: ubuntu-latest
27+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || 'ubuntu-latest' }}
2828
steps:
2929
- name: Harden Runner
3030
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
@@ -34,6 +34,12 @@ jobs:
3434
- name: Checkout
3535
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
3636

37+
- name: Setup Nix
38+
uses: DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d # v16
39+
40+
- name: Setup GHA Nix cache
41+
uses: DeterminateSystems/magic-nix-cache-action@6221693898146dc97e38ad0e013488a16477a4c4 # v9
42+
3743
- name: Get branch name
3844
id: branch-name
3945
uses: tj-actions/branch-names@6871f53176ad61624f978536bbf089c574dc19a2 # v8.0.1
@@ -71,18 +77,21 @@ jobs:
7177
push: ${{ github.ref == 'refs/heads/main' }}
7278
tags: "codercom/oss-dogfood:${{ steps.docker-tag-name.outputs.tag }},codercom/oss-dogfood:latest"
7379

74-
- name: Build and push Nix image
75-
uses: depot/build-push-action@636daae76684e38c301daa0c5eca1c095b24e780 # v1.14.0
76-
with:
77-
project: b4q6ltmpzh
78-
token: ${{ secrets.DEPOT_TOKEN }}
79-
buildx-fallback: true
80-
context: "."
81-
file: "dogfood/contents/Dockerfile.nix"
82-
pull: true
83-
save: true
84-
push: ${{ github.ref == 'refs/heads/main' }}
85-
tags: "codercom/oss-dogfood-nix:${{ steps.docker-tag-name.outputs.tag }},codercom/oss-dogfood-nix:latest"
80+
- name: Build Nix image
81+
run: nix build .#dev_image
82+
83+
- name: Push Nix image
84+
if: github.ref == 'refs/heads/main'
85+
run: |
86+
docker load -i result
87+
88+
CURRENT_SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')
89+
90+
docker image tag codercom/oss-dogfood-nix:latest-$CURRENT_SYSTEM codercom/oss-dogfood-nix:${{ steps.docker-tag-name.outputs.tag }}
91+
docker image push codercom/oss-dogfood-nix:${{ steps.docker-tag-name.outputs.tag }}
92+
93+
docker image tag codercom/oss-dogfood-nix:latest-$CURRENT_SYSTEM codercom/oss-dogfood-nix:latest
94+
docker image push codercom/oss-dogfood-nix:latest
8695
8796
deploy_template:
8897
needs: build_image

.github/workflows/security.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ jobs:
8686
uses: ./.github/actions/setup-sqlc
8787

8888
- name: Install yq
89-
run: go run github.com/mikefarah/yq/v4@v4.30.6
89+
run: go run github.com/mikefarah/yq/v4@v4.44.3
9090
- name: Install mockgen
91-
run: go install go.uber.org/mock/mockgen@v0.4.0
91+
run: go install go.uber.org/mock/mockgen@v0.5.0
9292
- name: Install protoc-gen-go
9393
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
9494
- name: Install protoc-gen-go-drpc
95-
run: go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
95+
run: go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.34
9696
- name: Install Protoc
9797
run: |
9898
# protoc must be in lockstep with our dogfood Dockerfile or the

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,3 +957,6 @@ else
957957
pnpm playwright:test
958958
endif
959959
.PHONY: test-e2e
960+
961+
dogfood/contents/nix.hash: flake.nix flake.lock
962+
sha256sum flake.nix flake.lock >./dogfood/contents/nix.hash

agent/proto/agent.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agent/proto/agent_drpc.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy