Light, fluffy, and always free - The AWS Local Emulator alternative
ci: build native compat image on runner and run full matrix against it (#1578)
Hector Venturab9da266b16c9
diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.ymlindex 71ca378225..c859503735 100644--- a/.github/workflows/compatibility.yml+++ b/.github/workflows/compatibility.yml@@ -5,8 +5,9 @@ on:paths:- 'src/**'- 'pom.xml'- - 'docker/Dockerfile.native'- - 'docker/Dockerfile.jvm-package'+ - 'docker/Dockerfile.native-package'+ - 'docker/entrypoint.sh'+ - 'docker/localstack-parity.sh'- 'compatibility-tests/**'- '.github/workflows/compatibility.yml'@@ -18,157 +19,29 @@ concurrency:cancel-in-progress: truejobs:- build:- name: Build JVM floci image- runs-on: ubuntu-latest- timeout-minutes: 20+ build-native:+ name: Build native floci image+ runs-on: ubuntu-24.04-arm+ timeout-minutes: 30steps:- uses: actions/[email protected]- - uses: actions/setup-java@v5+ - uses: graalvm/setup-graalvm@bef4b0e916c7dd079bf60fb95d49139f67e32c5f # v1with:java-version: '25'- distribution: 'temurin'+ distribution: 'mandrel'cache: maven+ github-token: ${{ secrets.GITHUB_TOKEN }}- - name: Build JVM artifact- run: mvn clean package -DskipTests -q-- - uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0-- - name: Build Docker image- uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0- with:- context: .- file: docker/Dockerfile.jvm-package- tags: floci:test- outputs: type=docker,dest=/tmp/floci-image.tar- cache-from: type=gha,scope=floci- cache-to: type=gha,scope=floci,mode=max-- - name: Compress image- run: gzip /tmp/floci-image.tar-- - name: Upload floci image- uses: actions/upload-artifact@v7- with:- name: floci-image- path: /tmp/floci-image.tar.gz- retention-days: 1-- compat-test:- name: JVM / ${{ matrix.test }}- needs: build- runs-on: ubuntu-latest- timeout-minutes: 20- strategy:- fail-fast: false- matrix:- test:- - sdk-test-node- - sdk-test-python- - sdk-test-java # improving execution time- - sdk-test-go- - sdk-test-awscli- - compat-cdk- - compat-terraform- - compat-opentofu-- steps:- - name: Download floci image- uses: actions/download-artifact@v8- with:- name: floci-image- path: /tmp-- - name: Load floci image- run: gunzip -c /tmp/floci-image.tar.gz | docker load-- - name: Create Docker network- run: docker network create compat-net-- - name: Start floci- run: |- DOCKER_GID=$(stat -c '%g' /var/run/docker.sock)- docker run -d --name floci --network compat-net \- -p 4566:4566 \- -v /var/run/docker.sock:/var/run/docker.sock \- --group-add "$DOCKER_GID" \- -e FLOCI_BASE_URL=http://floci:4566 \- -e FLOCI_SERVICES_DOCKER_NETWORK=compat-net \- -e FLOCI_HOSTNAME=floci \- -e FLOCI_SERVICES_LAMBDA_HOT_RELOAD_ENABLED=true \- -e FLOCI_TLS_ENABLED=true \- -e FLOCI_SERVICES_EC2_MOCK=true \- floci:test-- - name: Wait for floci to be ready- run: timeout 60 bash -c 'until curl -sf http://localhost:4566/ >/dev/null 2>&1; do sleep 1; done'-- - name: Checkout repository- uses: actions/[email protected]- with:- sparse-checkout: compatibility-tests-- - uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0-- - name: Build test image- uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0- with:- context: compatibility-tests/${{ matrix.test }}- load: true- tags: compat-${{ matrix.test }}- cache-from: type=gha,scope=${{ matrix.test }}- cache-to: type=gha,scope=${{ matrix.test }},mode=max+ - name: Build native executable (quick build)+ run: mvn clean package -Dnative -DskipTests -B -Dquarkus.native.additional-build-args-append="-Ob"- - name: Run tests- id: tests+ - name: Stage native binary for packagingrun: |- mkdir -p test-results- FLOCI_IP=$(docker inspect -f '{{(index .NetworkSettings.Networks "compat-net").IPAddress}}' floci)- DOCKER_GID=$(stat -c '%g' /var/run/docker.sock)-- EXTRA_ARGS=""- # compat-cdk needs Docker access for CDK's DockerImageFunction (docker build + push to emulated ECR)- if [ "${{ matrix.test }}" = "compat-cdk" ]; then- EXTRA_ARGS="-v /var/run/docker.sock:/var/run/docker.sock --group-add $DOCKER_GID"- fi-- # sdk-test-java: mount a host-side directory so the Docker daemon can- # bind-mount hot-reload code paths that are written by the test container.- if [ "${{ matrix.test }}" = "sdk-test-java" ]; then- mkdir -p /tmp/floci-hot-reload- EXTRA_ARGS="$EXTRA_ARGS -v /tmp/floci-hot-reload:/tmp/floci-hot-reload -e HOT_RELOAD_BASE_DIR=/tmp/floci-hot-reload"- fi-- # --dns injects Floci's embedded DNS so *.floci wildcard subdomains- # (e.g. my-bucket.floci) resolve to Floci's IP inside the test container.- # FLOCI_S3_VHOST_ENDPOINT tells the S3 virtual-host client to use- # http://floci:4566 as the endpoint base instead of the public DNS fallback.- docker run --rm --network compat-net \- --dns "${FLOCI_IP}" \- -e FLOCI_ENDPOINT=http://floci:4566 \- -e FLOCI_S3_VHOST_ENDPOINT=http://floci:4566 \- -v "$(pwd)/test-results:/results" \- $EXTRA_ARGS \- compat-${{ matrix.test }}-- - name: Generate test summary- if: always() && steps.tests.outcome != 'skipped'- uses: test-summary/action@37b508cfee6d4d080eedd00b5bb240a6a784a6a5 # v2- with:- paths: test-results/*.xml-- - name: Dump floci logs- if: failure()- run: docker logs floci-- build-native:- name: Build native floci image- runs-on: ubuntu-latest- timeout-minutes: 45- steps:- - uses: actions/[email protected]+ mkdir -p native/arm64+ cp target/*-runner native/arm64/+ # include any sidecar .so the runtime image may need (matches nightly artifact set)+ cp target/*.so native/arm64/ 2>/dev/null || true- uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0@@ -176,7 +49,7 @@ jobs:uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0with:context: .- file: docker/Dockerfile.native+ file: docker/Dockerfile.native-packagetags: floci:test-nativeoutputs: type=docker,dest=/tmp/floci-native-image.tarcache-from: type=gha,scope=floci-native@@ -195,14 +68,20 @@ jobs:native-compat-test:name: native / ${{ matrix.test }}needs: build-native- runs-on: ubuntu-latest+ runs-on: ubuntu-24.04-armtimeout-minutes: 20strategy:fail-fast: falsematrix:test:+ - sdk-test-node+ - sdk-test-python- sdk-test-java+ - sdk-test-go- sdk-test-awscli+ - compat-cdk+ - compat-terraform+ - compat-opentofusteps:- name: Download native floci image@@ -256,13 +135,25 @@ jobs:run: |mkdir -p test-resultsFLOCI_IP=$(docker inspect -f '{{(index .NetworkSettings.Networks "compat-net").IPAddress}}' floci)+ DOCKER_GID=$(stat -c '%g' /var/run/docker.sock)EXTRA_ARGS=""+ # compat-cdk needs Docker access for CDK's DockerImageFunction (docker build + push to emulated ECR)+ if [ "${{ matrix.test }}" = "compat-cdk" ]; then+ EXTRA_ARGS="-v /var/run/docker.sock:/var/run/docker.sock --group-add $DOCKER_GID"+ fi++ # sdk-test-java: mount a host-side directory so the Docker daemon can+ # bind-mount hot-reload code paths that are written by the test container.if [ "${{ matrix.test }}" = "sdk-test-java" ]; thenmkdir -p /tmp/floci-hot-reloadEXTRA_ARGS="$EXTRA_ARGS -v /tmp/floci-hot-reload:/tmp/floci-hot-reload -e HOT_RELOAD_BASE_DIR=/tmp/floci-hot-reload"fi+ # --dns injects Floci's embedded DNS so *.floci wildcard subdomains+ # (e.g. my-bucket.floci) resolve to Floci's IP inside the test container.+ # FLOCI_S3_VHOST_ENDPOINT tells the S3 virtual-host client to use+ # http://floci:4566 as the endpoint base instead of the public DNS fallback.docker run --rm --network compat-net \--dns "${FLOCI_IP}" \-e FLOCI_ENDPOINT=http://floci:4566 \diff --git a/docker/Dockerfile.jvm-package b/docker/Dockerfile.jvm-packagedeleted file mode 100644index 3ce7d1b0b7..0000000000--- a/docker/Dockerfile.jvm-package+++ /dev/null@@ -1,66 +0,0 @@-FROM eclipse-temurin:25-jre-alpine--ARG VERSION=latest-ARG INSTALL_AWS_CLI=false--ENV FLOCI_VERSION=${VERSION}-ENV FLOCI_STORAGE_PERSISTENT_PATH=/app/data--ENV GOSU_VERSION=1.17-ENV GOSU_AMD64_SHA256=bbc4136d03ab138b1ad66fa4fc051bafc6cc7ffae632b069a53657279a450de3-ENV GOSU_ARM64_SHA256=c3805a85d17f4454c23d7059bcb97e1ec1af272b90126e79ed002342de08389b-RUN set -eux; \- apk add --no-cache shadow ca-certificates; \- useradd -r -u 1001 -g root -d /app -s /sbin/nologin floci; \- arch="$(apk --print-arch)"; \- case "$arch" in \- x86_64) gosuArch='amd64'; gosuSha256="$GOSU_AMD64_SHA256" ;; \- aarch64) gosuArch='arm64'; gosuSha256="$GOSU_ARM64_SHA256" ;; \- *) echo >&2 "unsupported arch: $arch"; exit 1 ;; \- esac; \- wget -q -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${gosuArch}"; \- echo "${gosuSha256} /usr/local/bin/gosu" | sha256sum -c -; \- chmod +x /usr/local/bin/gosu; \- gosu --version; \- gosu nobody true--WORKDIR /app--RUN mkdir -p /app/data \- && chown 1001:root /app \- && chmod "g+rwX" /app \- && chown 1001:root /app/data \- && if [ "$INSTALL_AWS_CLI" = "true" ]; then \- apk add --no-cache aws-cli; \- fi--VOLUME /app/data--COPY --chmod=755 docker/entrypoint.sh /usr/local/bin/docker-entrypoint.sh-COPY --chmod=755 docker/localstack-parity.sh /usr/local/bin/localstack-parity.sh-COPY --chown=1001:root target/quarkus-app quarkus-app/--LABEL org.opencontainers.image.title="Floci" \- org.opencontainers.image.description="Local AWS emulator — open-source alternative to LocalStack Community" \- org.opencontainers.image.url="https://floci.io" \- org.opencontainers.image.source="https://github.com/floci-io/floci" \- org.opencontainers.image.licenses="MIT" \- org.opencontainers.image.vendor="Floci" \- description="Local AWS emulator — open-source alternative to LocalStack Community" \- io.k8s.description="Local AWS emulator — open-source alternative to LocalStack Community" \- io.k8s.display-name="Floci" \- io.openshift.expose-services="4566:tcp" \- io.openshift.tags="floci aws-emulator" \- maintainer="Floci <https://github.com/floci-io/floci>" \- name="floci/floci" \- summary="Local AWS emulator — open-source alternative to LocalStack Community" \- url="https://floci.io" \- vendor="Floci"--EXPOSE 4566 6379-6399--HEALTHCHECK --interval=5s --timeout=3s --retries=5 \- CMD wget -q --spider http://localhost:4566/_floci/health || exit 1--ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]-CMD ["java", "-jar", "/app/quarkus-app/quarkus-run.jar", "-Dquarkus.http.host=0.0.0.0"]