Skip to content

Commit e5c9694

Browse files
committed
flaking
1 parent 4bc9caa commit e5c9694

File tree

4 files changed

+32
-75
lines changed

4 files changed

+32
-75
lines changed

component/ci-light/BUCK

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,12 @@ docker_image(
1212
"//:flake.nix": ".",
1313
"//:flake.lock": ".",
1414
"//:rust-toolchain": ".",
15-
"docker-entrypoint.sh": ".",
1615
},
1716
build_args = {
1817
"BASE_VERSION": "12-slim",
1918
"USER_UID": "2000",
2019
"USER_GID": "2000",
2120
},
22-
run_docker_args = [
23-
"--privileged",
24-
"--volume",
25-
"$PWD:/workdir",
26-
"--volume",
27-
"/workdir/buck-out",
28-
"--volume",
29-
"/workdir/target",
30-
"--volume",
31-
"/workdir/tmp",
32-
"--volume",
33-
"/var/run/docker.sock:/var/run/docker.sock",
34-
],
35-
)
36-
37-
shfmt_check(
38-
name = "check-format-shell",
39-
srcs = ["docker-entrypoint.sh"],
40-
)
41-
42-
shellcheck(
43-
name = "check-lint-shell",
44-
srcs = ["docker-entrypoint.sh"],
4521
)
4622

4723
test_suite(

component/ci-light/Dockerfile

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ FROM debian:${BASE_VERSION}
44
ARG USER_UID
55
ARG USER_GID
66

7+
# Install base system requirements
78
# hadolint ignore=DL3008
89
RUN set -eux; \
910
apt-get update; \
@@ -19,6 +20,7 @@ RUN set -eux; \
1920
; \
2021
rm -rf /var/lib/apt/lists/*
2122

23+
# Install buildevents
2224
ARG BUILDEVENTS_VERSION=v0.17.0
2325
RUN set -eux; \
2426
ARCH="$(dpkg --print-architecture)"; \
@@ -31,49 +33,34 @@ RUN set -eux; \
3133
"https://github.com/honeycombio/buildevents/releases/download/${BUILDEVENTS_VERSION}/buildevents-${BUILDEVENTS_ARCH}" && \
3234
chmod +x /usr/local/bin/buildevents
3335

36+
# Setup workspace and git configuration
3437
RUN set -eux; \
35-
useradd --create-home --shell /bin/bash --uid "${USER_UID}" ci; \
36-
echo 'ci ALL=(ALL:ALL) NOPASSWD: ALL' >/etc/sudoers.d/ci; \
37-
mkdir -p /workdir; \
38-
chown -R ci:ci /workdir
38+
mkdir -p /workspace; \
39+
git config --global --add safe.directory /workspace
3940

40-
RUN groupadd -f docker && usermod -aG docker ci
41-
42-
ENV USER=ci
43-
USER ci:ci
44-
45-
# hadolint ignore=DL3004,DL4006
41+
# Install Nix as root with daemon mode
4642
RUN set -eux; \
47-
sudo install -d -m755 -o $(id -u) -g $(id -g) /nix; \
48-
curl \
49-
--proto '=https' \
50-
--tlsv1.2 -sSf \
51-
-L https://nixos.org/nix/install \
52-
| sh -s -- --no-daemon; \
53-
mkdir -p "$HOME/.config/nix"; \
43+
curl -L https://nixos.org/nix/install | sh -s -- --daemon; \
44+
mkdir -p /root/.config/nix; \
5445
{ \
5546
echo 'extra-nix-path = nixpkgs=flake:nixpkgs'; \
5647
echo 'experimental-features = nix-command flakes impure-derivations ca-derivations'; \
5748
echo 'auto-optimise-store = true'; \
5849
echo 'bash-prompt-prefix = (nix:$name)\040'; \
59-
} >"$HOME/.config/nix/nix.conf"; \
60-
. "$HOME/.nix-profile/etc/profile.d/nix.sh"; \
61-
nix-env -iA nixpkgs.nixVersions.stable; \
62-
grep 'Nix installer' "$HOME/.profile" >>"$HOME/.bashrc"; \
63-
\
64-
git config --global --add safe.directory /workdir; \
65-
mkdir -p "$HOME/.ssh"; \
66-
chmod 0700 "$HOME/.ssh"; \
67-
ssh-keyscan github.com >>"$HOME/.ssh/known_hosts";
50+
} >"/root/.config/nix/nix.conf"; \
51+
mkdir -p "/root/.ssh"; \
52+
chmod 0700 "/root/.ssh"; \
53+
ssh-keyscan github.com >>"/root/.ssh/known_hosts"
6854

69-
WORKDIR /workdir
55+
WORKDIR /workspace
7056

57+
# Copy flake configuration and prebuild Nix environment
7158
COPY flake.nix flake.lock rust-toolchain ./
72-
COPY docker-entrypoint.sh /
7359

7460
RUN set -eux; \
75-
. "$HOME/.nix-profile/etc/profile.d/nix.sh"; \
61+
. /etc/profile.d/nix.sh; \
7662
nix develop .#ci --build; \
77-
rm -f flake.nix flake.lock rust-toolchain
63+
CI_TOOLS=$(nix build --no-link --print-out-paths .#ci-tools); \
64+
cp -rs "$CI_TOOLS/bin/"* /usr/local/bin/ 2>/dev/null || true; \
65+
cp -rs "$CI_TOOLS/share" /usr/local/ 2>/dev/null || true
7866

79-
ENTRYPOINT ["/docker-entrypoint.sh"]

component/ci-light/docker-entrypoint.sh

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

flake.nix

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
gh
7171
gitMinimal
7272
makeWrapper
73-
nodePkgs.pnpm
73+
pnpm
7474
nodejs
7575
python3
7676
ripgrep
@@ -194,12 +194,17 @@
194194
# CI environment - essential tools for CI tasks without heavy build dependencies
195195
ci = mkShell {
196196
packages = buck2NativeBuildInputs ++ [
197+
awscli2
197198
buildkite-test-collector-rust
199+
cargo-sort
200+
deno
198201
docker
199202
docker-compose
200203
gh
201204
jq
202205
shfmt
206+
shellcheck
207+
yapf
203208
];
204209
};
205210

@@ -209,6 +214,14 @@
209214
};
210215
};
211216

217+
packages = {
218+
# Package containing all CI tools for easy installation
219+
ci-tools = pkgs.symlinkJoin {
220+
name = "ci-tools";
221+
paths = devShells.ci.buildInputs ++ devShells.ci.nativeBuildInputs;
222+
};
223+
};
224+
212225
formatter = alejandra;
213226
});
214227
}

0 commit comments

Comments
 (0)