Skip to content

Commit 57fbe8b

Browse files
Update Rust, Docker dependencies, tooling (#1340)
* Use latest Docker frontend * Use latest Rust * Use latest git * Switch to prysk from cram Tested running tests -- works, also tested `run` target\
1 parent 44c3bfa commit 57fbe8b

File tree

5 files changed

+55
-32
lines changed

5 files changed

+55
-32
lines changed

Dockerfile

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# syntax=docker/dockerfile:1.6-labs@sha256:bd24901c537a316a4802d920bf86605f4db8ef676ef7258a3b381e12d90c62c8
1+
# syntax=docker/dockerfile:1.8@sha256:d6d396f3780b1dd56a3acbc975f57bd2fc501989b50164c41387c42d04e780d0
22

3-
ARG ALPINE_VERSION=3.18
3+
ARG ALPINE_VERSION=3.20
44
ARG ARCH=x86_64
55

6-
FROM alpine:${ALPINE_VERSION} as rust-base
6+
FROM alpine:${ALPINE_VERSION} AS rust-base
77

88
RUN apk add --no-cache ca-certificates gcc musl-dev
99

@@ -12,8 +12,12 @@ ENV CARGO_HOME=/usr/local/cargo
1212
ENV PATH=/usr/local/cargo/bin:${PATH}
1313

1414
ARG ARCH
15-
ARG RUSTUP_VERSION=1.26.0
16-
ARG RUST_VERSION=1.74
15+
16+
# Update check: https://github.com/rust-lang/rustup/tags
17+
ARG RUSTUP_VERSION=1.27.1
18+
19+
# Update check: https://github.com/rust-lang/rust/tags
20+
ARG RUST_VERSION=1.79.0
1721
ARG RUST_ARCH=${ARCH}-unknown-linux-musl
1822

1923
# https://github.com/sfackler/rust-openssl/issues/1462
@@ -27,17 +31,18 @@ RUN /tmp/rustup-init \
2731
--default-toolchain ${RUST_VERSION} \
2832
--default-host ${RUST_ARCH}
2933

30-
FROM rust-base as dev-planner
34+
FROM rust-base AS dev-planner
3135

32-
RUN cargo install --version 0.1.62 cargo-chef
36+
# Update check: https://github.com/LukeMathWalker/cargo-chef/releases
37+
RUN cargo install --version 0.1.67 cargo-chef
3338

3439
WORKDIR /usr/src/josh
3540
COPY . .
3641

3742
ENV CARGO_TARGET_DIR=/opt/cargo-target
3843
RUN cargo chef prepare --recipe-path recipe.json
3944

40-
FROM rust-base as dev
45+
FROM rust-base AS dev
4146

4247
RUN apk add --no-cache \
4348
zlib-dev \
@@ -46,25 +51,28 @@ RUN apk add --no-cache \
4651

4752
WORKDIR /usr/src/josh
4853
RUN rustup component add rustfmt
49-
RUN cargo install --version 0.1.62 cargo-chef
54+
RUN cargo install --version 0.1.67 cargo-chef
5055
RUN cargo install --verbose --version 0.10.0 graphql_client_cli
5156

5257
RUN apk add --no-cache \
5358
bash \
59+
coreutils \
5460
curl \
5561
cmake \
5662
make \
5763
expat-dev \
5864
gettext \
5965
python3 \
6066
python3-dev \
67+
libffi-dev \
6168
py3-pip \
6269
tree \
6370
autoconf \
6471
libgit2-dev \
6572
psmisc
6673

67-
ARG GIT_VERSION=2.38.1
74+
# Update check: https://github.com/git/git/tags
75+
ARG GIT_VERSION=2.45.2
6876
WORKDIR /usr/src/git
6977
RUN <<EOF
7078
set -e
@@ -85,10 +93,12 @@ RUN mkdir /opt/git-install/etc
8593
RUN git config -f /opt/git-install/etc/gitconfig --add safe.directory "*" && \
8694
git config -f /opt/git-install/etc/gitconfig protocol.file.allow "always"
8795

88-
ARG CRAM_VERSION=d245cca
89-
ARG PYGIT2_VERSION=1.11.1
90-
RUN pip3 install \
91-
git+https://github.com/brodie/cram.git@${CRAM_VERSION}
96+
# Update check: https://github.com/prysk/prysk/releases
97+
ARG PRYSK_VERSION=0.20.0
98+
99+
# This is a Docker image so --break-system-packages is okay
100+
RUN pip3 install --break-system-packages \
101+
git+https://github.com/prysk/prysk.git@${PRYSK_VERSION}
92102

93103
RUN apk add --no-cache go nodejs npm openssh-client patch
94104

@@ -106,7 +116,7 @@ RUN cp bin/git-lfs /opt/git-lfs/bin
106116

107117
WORKDIR /usr/src/josh
108118

109-
FROM dev as dev-local
119+
FROM dev AS dev-local
110120

111121
RUN mkdir -p /opt/cache && \
112122
chmod 777 /opt/cache
@@ -140,12 +150,12 @@ RUN adduser \
140150
-g '' \
141151
dev
142152

143-
FROM dev as dev-cache
153+
FROM dev AS dev-cache
144154

145155
COPY --from=dev-planner /usr/src/josh/recipe.json .
146156
ENV CARGO_TARGET_DIR=/opt/cargo-target
147157

148-
FROM dev-cache as dev-ci
158+
FROM dev-cache AS dev-ci
149159

150160
RUN mkdir -p /josh/static && \
151161
chmod 777 /josh/static
@@ -156,7 +166,7 @@ RUN mkdir -p josh-ui
156166
COPY josh-ui/package.json josh-ui/package-lock.json josh-ui/
157167
RUN cd josh-ui && npm install
158168

159-
FROM dev-cache as build
169+
FROM dev-cache AS build
160170

161171
RUN cargo chef cook --release --workspace --recipe-path recipe.json
162172

@@ -167,7 +177,7 @@ RUN --mount=target=.git,from=git \
167177
cargo build -p josh-proxy -p josh-ssh-shell --release
168178

169179
ARG ALPINE_VERSION
170-
FROM alpine:${ALPINE_VERSION} as run
180+
FROM alpine:${ALPINE_VERSION} AS run
171181

172182
RUN apk add --no-cache \
173183
zlib \

run-tests.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,36 @@ else
66
TARGET_DIR=${CARGO_TARGET_DIR}
77
fi
88

9-
export PATH="${TARGET_DIR}/debug/:${PATH}"
10-
export PATH="$(pwd)/scripts/:${PATH}"
9+
OS=$(uname -s)
10+
if [ "$OS" = "Darwin" ]; then
11+
DATE_CMD="gdate"
12+
else
13+
DATE_CMD="date"
14+
fi
15+
16+
PATH="${TARGET_DIR}/debug/:${PATH}"
17+
PATH="$(pwd)/scripts/:${PATH}"
18+
export PATH
1119

1220
export JOSH_COMMIT_TIME=0
1321
export GIT_AUTHOR_NAME=Josh
1422
15-
export GIT_AUTHOR_DATE="2005-04-07T22:13:13"
23+
24+
GIT_AUTHOR_DATE=$(${DATE_CMD} -R -d "2005-04-07T22:13:13Z")
25+
export GIT_AUTHOR_DATE
26+
1627
export GIT_COMMITTER_NAME=Josh
1728
18-
export GIT_COMMITTER_DATE="2005-04-07T22:13:13"
19-
export EMPTY_TREE="4b825dc642cb6eb9a060e54bf8d69288fbee4904"
2029

30+
GIT_COMMITTER_DATE=$(${DATE_CMD} -R -d "2005-04-07T22:13:13Z")
31+
export GIT_COMMITTER_DATE
32+
33+
export EMPTY_TREE="4b825dc642cb6eb9a060e54bf8d69288fbee4904"
2134
CONFIG_FILE=$(mktemp)
2235
trap 'rm ${CONFIG_FILE}' EXIT
2336

2437
export GIT_CONFIG_GLOBAL=${CONFIG_FILE}
38+
git config --global init.defaultBranch master
2539

2640
cargo fmt
27-
python3 -m cram "$@"
41+
python3 -m prysk "$@"

tests/proxy/clone_absent_head.t

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
| | | `-- 2fc150c43f13cc56c0e9caeba01b58ec612022
109109
| | |-- info
110110
| | `-- pack
111-
| |-- packed-refs
112111
| `-- refs
113112
| |-- heads
114113
| |-- josh
@@ -127,6 +126,6 @@
127126
|-- namespaces
128127
`-- tags
129128

130-
27 directories, 16 files
129+
27 directories, 15 files
131130

132131
$ cat ${TESTTMP}/josh-proxy.out

tests/proxy/push_error.t

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
To http://localhost:8002/real_repo.git:prefix=pre.git
3333
! [rejected] master -> master (fetch first)
3434
error: failed to push some refs to 'http://localhost:8002/real_repo.git:prefix=pre.git'
35-
hint: Updates were rejected because the remote contains work that you do
36-
hint: not have locally. This is usually caused by another repository pushing
37-
hint: to the same ref. You may want to first integrate the remote changes
38-
hint: (e.g., 'git pull ...') before pushing again.
35+
hint: Updates were rejected because the remote contains work that you do not
36+
hint: have locally. This is usually caused by another repository pushing to
37+
hint: the same ref. If you want to integrate the remote changes, use
38+
hint: 'git pull' before pushing again.
3939
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
4040
[1]
4141

tests/proxy/shell.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
$ sleep 1
3434
$ kill -9 $!
3535
$ grep "init mirror repo" proxy.out
36-
* DEBUG josh_proxy: init mirror repo: "*/cramtests-*/shell.t/../../tmp/mirror" (glob)
36+
* DEBUG josh_proxy: init mirror repo: "*/shell.t/../../tmp/mirror" (glob)
3737
$ rm -Rf ../../tmp

0 commit comments

Comments
 (0)