mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-22 21:59:59 +00:00
## Fixing GitHub workflow issue related to build and push images ## Summary of changes Followup of PR#608[move docker file from build repo to neon to solve issue some issues The build started failing because it missed a validation in logic that determines changes in the docker file Also, all the dependent jobs were skipped because of the build and push of the image job. To address the above issue following changes were made - we are adding validation to generate image tag even if it's a merge to repo. - All the dependent jobs won't skip even if the build and push image job is skipped. - We have moved the logic to generate a tag in the sub-workflow. As the tag name was necessary to be passed to the sub-workflow it made sense to abstract that away where it was needed and then store it as an output variable so that downward dependent jobs could access the value. - This made the dependency logic easy and we don't need complex expressions to check the condition on which it will run - An earlier PR was closed that tried solving a similar problem that has some feedback and context before creating this PR https://github.com/neondatabase/neon/pull/6175 ## Checklist before requesting a review - [x] Move the tag generation logic from the main workflow to the sub-workflow of build and push the image - [x] Add a condition to generate an image tag for a non-PR-related run - [x] remove complex if the condition from the job if conditions --------- Co-authored-by: Alexander Bayandin <alexander@neon.tech> Co-authored-by: Abhijeet Patil <abhijeet@neon.tech>
33 lines
1.0 KiB
Docker
33 lines
1.0 KiB
Docker
# First transient image to build compute_tools binaries
|
|
# NB: keep in sync with rust image version in .github/workflows/build_and_test.yml
|
|
ARG REPOSITORY=neondatabase
|
|
ARG IMAGE=build-tools
|
|
ARG TAG=pinned
|
|
ARG BUILD_TAG
|
|
|
|
FROM $REPOSITORY/$IMAGE:$TAG AS rust-build
|
|
WORKDIR /home/nonroot
|
|
|
|
# Enable https://github.com/paritytech/cachepot to cache Rust crates' compilation results in Docker builds.
|
|
# Set up cachepot to use an AWS S3 bucket for cache results, to reuse it between `docker build` invocations.
|
|
# cachepot falls back to local filesystem if S3 is misconfigured, not failing the build.
|
|
ARG RUSTC_WRAPPER=cachepot
|
|
ENV AWS_REGION=eu-central-1
|
|
ENV CACHEPOT_S3_KEY_PREFIX=cachepot
|
|
ARG CACHEPOT_BUCKET=neon-github-dev
|
|
#ARG AWS_ACCESS_KEY_ID
|
|
#ARG AWS_SECRET_ACCESS_KEY
|
|
ARG BUILD_TAG
|
|
ENV BUILD_TAG=$BUILD_TAG
|
|
|
|
COPY . .
|
|
|
|
RUN set -e \
|
|
&& mold -run cargo build -p compute_tools --locked --release \
|
|
&& cachepot -s
|
|
|
|
# Final image that only has one binary
|
|
FROM debian:bullseye-slim
|
|
|
|
COPY --from=rust-build /home/nonroot/target/release/compute_ctl /usr/local/bin/compute_ctl
|