Skip to content

Commit 0f91dd5

Browse files
chrissetoRafalKorepta
authored andcommitted
*: configure nix binary cache
Add a [nix binary cache using S3 as the backend](https://nix.dev/manual/nix/2.25/store/types/s3-binary-cache-store) for CI builds. This shaves about 3m30s off each CI job. (cherry picked from commit 96ef0e1)
1 parent 6e79d28 commit 0f91dd5

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

ci/docker/entrypoint.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
# NB: Only our CI agents push to this cache but we don't have PKI (e.g.
4+
# signing) setup for them.
5+
## So we mark the cache as trusted to skip signature verifications.
6+
CACHE="s3://redpanda-nix-cache-k8s-m6id12xlarge?region=us-west-2&trusted=true"
7+
8+
nix develop --option extra-substituters "$CACHE" --impure --command "$@"
9+
EXIT_CODE="$?"
10+
11+
echo "--- Pushing to :nix: cache"
12+
nix copy --to "$CACHE" .#devshell
13+
14+
exit "$EXIT_CODE"

ci/docker/nix.Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ RUN echo 'experimental-features = nix-command flakes' >> /etc/nix/nix.conf \
1818
# easier to disable this check entirely:
1919
&& git config --global --add safe.directory '*'
2020

21-
ENTRYPOINT ["nix", "develop", "--impure", "--command"]
21+
COPY ci/docker/entrypoint.sh /
22+
23+
ENTRYPOINT ["bash", "/entrypoint.sh"]

ci/scripts/run-in-nix-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fi
3333
set -e
3434

3535
# BUILDKITE environment variables are used by `buildkite-agent` cli to upload artifact
36-
printenv | grep '^BUILDKITE.*=' > env-file-for-buildkite
36+
printenv | { grep '^BUILDKITE.*=' || true; } > env-file-for-buildkite
3737

3838
# Build the base image and grab the SHA.
3939
IMAGE_SHA=$(docker build --quiet -f ./ci/docker/nix.Dockerfile .)

flake.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
{
3535
formatter = pkgs.nixpkgs-fmt;
3636

37+
# Make it possible to reference the devshell context from standard
38+
# nix commands. e.g. nix copy .#devshell.
39+
packages.devshell = self'.devShells.default;
40+
3741
devshells.default = {
3842
env = [
3943
{ name = "GOPRIVATE"; value = "github.com/redpanda-data/flux-controller-shim"; }

taskfiles/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ tasks:
2121
test:unit:
2222
cmds:
2323
- defer: 'buildkite-agent artifact upload "{{.SRC_DIR}}/unit-tests-*.xml"'
24+
- 'echo "--- Running unit tests"'
2425
- task: :test:unit
2526
vars:
2627
GO_TEST_RUNNER: gotestsum --raw-command --junitfile=unit-tests-%.xml -- go test
@@ -30,6 +31,7 @@ tasks:
3031
cmds:
3132
- defer: 'kind delete clusters --all'
3233
- defer: 'buildkite-agent artifact upload "{{.SRC_DIR}}/integration-tests-*.xml"'
34+
- 'echo "--- Running integration tests"'
3335
- task: :test:integration
3436
vars:
3537
GO_TEST_RUNNER: gotestsum --raw-command --junitfile=integration-tests-%.xml -- go test
@@ -39,6 +41,7 @@ tasks:
3941
cmds:
4042
- defer: 'kind delete clusters --all'
4143
- defer: 'buildkite-agent artifact upload "{{.SRC_DIR}}/acceptance-tests-*.xml"'
44+
- 'echo "--- Running acceptance tests"'
4245
- task: :test:acceptance
4346
vars:
4447
GO_TEST_RUNNER: gotestsum --raw-command --junitfile=acceptance-tests-%.xml -- go test

0 commit comments

Comments
 (0)