Skip to content

Commit c889148

Browse files
authored
Merge pull request #1340 from mdecimus/main
CI job fixes
2 parents 4138ef6 + b7d7494 commit c889148

File tree

3 files changed

+35
-22
lines changed

3 files changed

+35
-22
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
needs: [linux]
4242
if: github.event_name == 'push' || inputs.Docker
4343
steps:
44+
- name: Install Cosign
45+
uses: sigstore/cosign-installer@v3
4446
- name: Log In to GitHub Container Registry
4547
uses: docker/login-action@v3
4648
with:
@@ -82,6 +84,8 @@ jobs:
8284
echo "GHCR_DIGEST_SHA=$(cat GHCR_DIGEST_SHA)" | tee -a "${GITHUB_ENV}"
8385
docker buildx imagetools inspect --format '{{json .Manifest}}' index.docker.io/${{github.repository}}:$(jq -r '.target."docker-metadata-action".args.DOCKER_META_VERSION' ${{ runner.temp }}/${{matrix.variant}}/bake-meta.json) | jq -r '.digest' > DOCKERHUB_DIGEST_SHA
8486
echo "DOCKERHUB_DIGEST_SHA=$(cat DOCKERHUB_DIGEST_SHA)" | tee -a "${GITHUB_ENV}"
87+
cosign sign --yes $(jq --arg GHCR_DIGEST_SHA "$(cat GHCR_DIGEST_SHA)" -cr '.target."docker-metadata-action".tags | map(select(startswith("ghcr.io/${{github.repository}}")) | . + "@" + $GHCR_DIGEST_SHA) | join(" ")' ${{ runner.temp }}/${{matrix.variant}}/bake-meta.json)
88+
cosign sign --yes $(jq --arg DOCKERHUB_DIGEST_SHA "$(cat DOCKERHUB_DIGEST_SHA)" -cr '.target."docker-metadata-action".tags | map(select(startswith("index.docker.io/${{github.repository}}")) | . + "@" + $DOCKERHUB_DIGEST_SHA) | join(" ")' ${{ runner.temp }}/${{matrix.variant}}/bake-meta.json)
8589
8690
- name: Attest GHCR
8791
uses: actions/attest-build-provenance@v2
@@ -411,16 +415,25 @@ jobs:
411415
archive/**/*.tar.gz
412416
archive/**/*.zip
413417
418+
- name: Use cosign to sign existing artifacts
419+
uses: sigstore/[email protected]
420+
with:
421+
inputs: |
422+
archive/**/*.tar.gz
423+
archive/**/*.zip
424+
414425
- name: Release
415426
uses: softprops/action-gh-release@v2
416427
with:
417428
files: |
418429
archive/**/*.tar.gz
419430
archive/**/*.zip
431+
archive/**/*.sigstore.json
420432
prerelease: ${{!startsWith(github.ref, 'refs/tags/') || null}}
421433
tag_name: ${{!startsWith(github.ref, 'refs/tags/') && 'nightly' || null}}
434+
# TODO add instructions about using cosign to verify binary artifact
422435
append_body: true
423436
body: |
424437
<hr />
425438
426-
## Check binary attestation at [here](${{ steps.attest.outputs.attestation-url }})
439+
### Check binary attestation at [here](${{ steps.attest.outputs.attestation-url }})

Dockerfile.build

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ RUN \
2828
ln -s "/usr/local/zig-linux-$(uname -m)-${ZIG_VERSION}/zig" /usr/local/bin/zig
2929
# Install cargo-binstall
3030
RUN curl --retry 5 -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
31-
# Install FoundationDB
32-
# TODO According to https://github.com/apple/foundationdb/issues/11448#issuecomment-2417766293
33-
# Once FoundationDB v7.3.53 gets released, we should be able to build the aarch64-unknown-linux-gnu target.
34-
# The last command is for future build use, so if you are building on a native arm64 device, please use docker qemu.
35-
RUN curl --retry 5 -Lso /usr/lib/libfdb_c.so "$(curl --retry 5 -Ls 'https://api.github.com/repos/apple/foundationdb/releases' | jq --arg arch "$(uname -m)" -r '.[] | select(.prerelease == false) | .assets[] | select(.name | test("libfdb_c." + $arch + ".so")) | .browser_download_url' | head -n1)"
3631
# Install cargo-chef & sccache & cargo-zigbuild
3732
RUN cargo binstall --no-confirm cargo-chef sccache cargo-zigbuild
3833

@@ -56,24 +51,31 @@ ARG BUILD_ENV
5651
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
5752
# Install toolchain and specify some env variables
5853
RUN \
59-
rustup set profile minimal && \
60-
rustup target add ${TARGET} && \
61-
mkdir -p artifact && \
62-
touch /env-cargo && \
63-
if [ ! -z "${BUILD_ENV}" ]; then \
64-
echo "export ${BUILD_ENV}" >> /env-cargo; \
65-
echo "Setting up ${BUILD_ENV}"; \
66-
fi
54+
rustup set profile minimal && \
55+
rustup target add ${TARGET} && \
56+
mkdir -p artifact && \
57+
touch /env-cargo && \
58+
if [ ! -z "${BUILD_ENV}" ]; then \
59+
echo "export ${BUILD_ENV}" >> /env-cargo; \
60+
echo "Setting up ${BUILD_ENV}"; \
61+
fi && \
62+
if [[ "${TARGET}" == *gnu ]]; then \
63+
echo "export FDB_ARCH=${TARGET%%-*}" >> /env-cargo; \
64+
fi
65+
# Install FoundationDB
66+
RUN \
67+
source /env-cargo && \
68+
if [ ! -z "${FDB_ARCH}" ]; then \
69+
curl --retry 5 -Lso /usr/lib/libfdb_c.so "$(curl --retry 5 -Ls 'https://api.github.com/repos/apple/foundationdb/releases' | jq --arg FDB_ARCH "$FDB_ARCH" -r '.[] | select(.prerelease == false) | .assets[] | select(.name | test("libfdb_c." + $FDB_ARCH + ".so")) | .browser_download_url' | head -n1)"; \
70+
fi
6771
# Cargo-chef Cache layer
6872
RUN \
6973
--mount=type=secret,id=ACTIONS_CACHE_URL,env=ACTIONS_CACHE_URL \
7074
--mount=type=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \
7175
--mount=type=cache,target=/usr/local/cargo/registry \
7276
--mount=type=cache,target=/usr/local/cargo/git \
73-
# TODO According to https://github.com/apple/foundationdb/issues/11448#issuecomment-2417766293
74-
# Once FoundationDB v7.3.53 gets released, we should be able to build the aarch64-unknown-linux-gnu target.
7577
source /env-cargo && \
76-
if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ]; then \
78+
if [ ! -z "${FDB_ARCH}" ]; then \
7779
RUSTFLAGS="-L /usr/lib" cargo chef cook --recipe-path recipe.json --zigbuild --release --target ${TARGET} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise"; \
7880
fi
7981
RUN \
@@ -88,16 +90,14 @@ RUN \
8890
COPY . .
8991
ENV RUSTC_WRAPPER="sccache" \
9092
SCCACHE_GHA_ENABLED=true
91-
# Build foundationdb version
93+
# Build FoundationDB version
9294
RUN \
9395
--mount=type=secret,id=ACTIONS_CACHE_URL,env=ACTIONS_CACHE_URL \
9496
--mount=type=secret,id=ACTIONS_RUNTIME_TOKEN,env=ACTIONS_RUNTIME_TOKEN \
9597
--mount=type=cache,target=/usr/local/cargo/registry \
9698
--mount=type=cache,target=/usr/local/cargo/git \
97-
# TODO According to https://github.com/apple/foundationdb/issues/11448#issuecomment-2417766293
98-
# Once FoundationDB v7.3.53 gets released, we should be able to build the aarch64-unknown-linux-gnu target.
9999
source /env-cargo && \
100-
if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ]; then \
100+
if [ ! -z "${FDB_ARCH}" ]; then \
101101
RUSTFLAGS="-L /usr/lib" cargo zigbuild --release --target ${TARGET} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise"; \
102102
mv /app/target/${TARGET}/release/stalwart-mail /app/artifact/stalwart-mail-foundationdb; \
103103
fi

crates/store/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ utils = { path = "../utils" }
99
nlp = { path = "../nlp" }
1010
trc = { path = "../trc" }
1111
rocksdb = { version = "0.23", optional = true, features = ["multi-threaded-cf"] }
12-
foundationdb = { version = "0.9.0", features = ["embedded-fdb-include", "fdb-7_1"], optional = true }
12+
foundationdb = { version = "0.9.2", features = ["embedded-fdb-include", "fdb-7_3"], optional = true }
1313
rusqlite = { version = "0.32", features = ["bundled"], optional = true }
1414
rust-s3 = { version = "=0.35.0-alpha.2", default-features = false, features = ["tokio-rustls-tls", "no-verify-ssl"], optional = true }
1515
azure_core = { version = "0.21.0", optional = true }

0 commit comments

Comments
 (0)