mirror of https://github.com/linkerd/linkerd2.git
Use cargo frozen flag in build scripts (#206)
The cargo commands in our docker and ci scripts were at risk for modifying Cargo.lock and cache. Using cargo's --frozen flag (and --locked during fetch) ensures our build is consistent with what's defined across Cargo.toml, Cargo.lock, and cached build artifacts. Signed-off-by: Andrew Seigner <siggy@buoyant.io>
This commit is contained in:
parent
9410da471a
commit
4e2eb18f1d
|
@ -18,14 +18,15 @@ jobs:
|
|||
|
||||
# Compile the application and run tests.
|
||||
- stage: test
|
||||
|
||||
language: rust
|
||||
rust: stable
|
||||
cache:
|
||||
cargo: true
|
||||
install:
|
||||
- cargo fetch --locked
|
||||
script:
|
||||
- cargo check
|
||||
- cargo test
|
||||
- cargo check --frozen
|
||||
- cargo test --frozen
|
||||
|
||||
- language: go
|
||||
go: 1.9
|
||||
|
|
|
@ -20,8 +20,8 @@ COPY proto ./proto
|
|||
COPY proxy ./proxy
|
||||
ARG RELEASE
|
||||
RUN if [ -z "$RELEASE" ]; \
|
||||
then cargo build -p conduit-proxy && mv target/debug/conduit-proxy target/conduit-proxy ; \
|
||||
else cargo build -p conduit-proxy --release && mv target/release/conduit-proxy target/conduit-proxy ; \
|
||||
then cargo build --frozen -p conduit-proxy && mv target/debug/conduit-proxy target/conduit-proxy ; \
|
||||
else cargo build --frozen -p conduit-proxy --release && mv target/release/conduit-proxy target/conduit-proxy ; \
|
||||
fi
|
||||
|
||||
## Install the proxy binary into the base runtime image.
|
||||
|
|
|
@ -20,9 +20,9 @@ COPY tower-grpc ./tower-grpc
|
|||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY proto ./proto
|
||||
COPY proxy ./proxy
|
||||
RUN cargo fetch
|
||||
RUN cargo build -p conduit-proxy
|
||||
RUN cargo build -p conduit-proxy --release
|
||||
RUN cargo fetch --locked
|
||||
RUN cargo build --frozen -p conduit-proxy
|
||||
RUN cargo build --frozen -p conduit-proxy --release
|
||||
|
||||
# Preserve dependency sources and build artifacts without maintaining conduit
|
||||
# sources/artifacts.
|
||||
|
|
Loading…
Reference in New Issue